Created
June 10, 2020 07:59
-
-
Save appcoreopc/6dafbfeb527c439204274cd83cd1cb30 to your computer and use it in GitHub Desktop.
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 | |
spec: | |
ports: | |
- port: 3306 | |
selector: | |
app: mysql | |
clusterIP: None | |
--- | |
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 | |
kind: Deployment | |
metadata: | |
name: mysql | |
spec: | |
selector: | |
matchLabels: | |
app: mysql | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: mysql | |
spec: | |
containers: | |
- image: mysql:5.6 | |
name: mysql | |
env: | |
# Use secret in real usage | |
- 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: mysql-pv-claim | |
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: mysql-pv-volume | |
labels: | |
type: local | |
spec: | |
storageClassName: manual | |
capacity: | |
storage: 20Gi | |
accessModes: | |
- ReadWriteOnce | |
hostPath: | |
path: "/mnt/data" | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: mysql-pv-claim | |
spec: | |
storageClassName: manual | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 20Gi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment