Multitenant application example in Rancher
Example PVC and Application
-
Create and apply the following
pvc.yamlfile:kind: PersistentVolumeClaimapiVersion: v1metadata:name: mysql-dataannotations:volume.beta.kubernetes.io/storage-class: px-storagespec:accessModes:- ReadWriteOnceresources:requests:storage: 2Gi -
Create and apply the following
mysql.yamlfile:apiVersion: apps/v1kind: Deploymentmetadata:name: mysqlspec:strategy:rollingUpdate:maxSurge: 1maxUnavailable: 1type: RollingUpdatereplicas: 1selector:matchLabels:app: mysqltemplate:metadata:labels:app: mysqlversion: "1"spec:containers:- image: mysql:5.6name: mysqlenv:- name: MYSQL_ROOT_PASSWORDvalue: passwordports:- containerPort: 3306volumeMounts:- name: mysql-persistent-storagemountPath: /var/lib/mysqlvolumes:- name: mysql-persistent-storagepersistentVolumeClaim:claimName: mysql-data