Created
January 24, 2021 15:39
-
-
Save asvignesh/f630b2a14a9a79a51e3af7bebb124526 to your computer and use it in GitHub Desktop.
MySQL K8 Deployment with the PV and PVC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: mysql | |
labels: | |
app: asvignesh | |
spec: | |
ports: | |
- port: 3306 | |
targetPort: 3306 | |
selector: | |
app: asvignesh | |
tier: mysql | |
clusterIP: None | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: mysql | |
labels: | |
app: asvignesh | |
spec: | |
selector: | |
matchLabels: | |
app: asvignesh | |
tier: mysql | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: asvignesh | |
tier: mysql | |
spec: | |
containers: | |
- image: mysql:5.6 | |
name: mysql | |
env: | |
- name: MYSQL_ROOT_PASSWORD | |
value: password | |
ports: | |
- containerPort: 3306 | |
name: mysql | |
volumeMounts: | |
- name: mysql-persistent-storage | |
mountPath: /var/lib/mysql | |
volumes: | |
- name: mysql-persistent-storage | |
persistentVolumeClaim: | |
claimName: _PVC_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: _PV_ | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
awsElasticBlockStore: | |
fsType: xfs | |
volumeID: aws://us-east-1a/vol-xxxxxxxxx | |
capacity: | |
storage: 10Gi | |
persistentVolumeReclaimPolicy: Retain | |
storageClassName: gp2-retain | |
volumeMode: Filesystem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
labels: | |
app: asvignesh | |
name: _PVC_ | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 10Gi | |
storageClassName: gp2-retain | |
volumeMode: Filesystem | |
volumeName: _PV_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment