Last active
September 25, 2019 20:57
-
-
Save zioproto/1e00f77098bacfaca0caa6e62a72add3 to your computer and use it in GitHub Desktop.
Kubernetes on Openstack Mysql service with Cinder persistent volume claim
This file contains hidden or 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
--- | |
kind: StorageClass | |
apiVersion: storage.k8s.io/v1 | |
metadata: | |
name: default | |
annotations: | |
storageclass.beta.kubernetes.io/is-default-class: "true" | |
provisioner: kubernetes.io/cinder | |
--- | |
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
name: mysql-pvc | |
annotations: | |
volume.beta.kubernetes.io/storage-class: default | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 30Gi | |
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: mysql | |
labels: | |
name: mysql | |
spec: | |
containers: | |
- resources: | |
limits : | |
cpu: 0.5 | |
image: mysql:5.7.27 | |
name: mysql | |
args: | |
- "--ignore-db-dir" | |
- "lost+found" | |
env: | |
- name: MYSQL_ROOT_PASSWORD | |
# change this | |
value: yourpassword | |
ports: | |
- containerPort: 3306 | |
name: mysql | |
volumeMounts: | |
# name must match the volume name below | |
- name: mysql-persistent-storage | |
# mount path within the container | |
mountPath: /var/lib/mysql | |
volumes: | |
- name: mysql-persistent-storage | |
persistentVolumeClaim: | |
claimName: mysql-pvc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment