2018年7月13日 | Leave a comment kubernetes --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-mysql-keycloak-dev spec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi storageClassName: cbs # volumeName: pvc-mysql-keycloak-dev # selector: # matchLabels: # app: pv-mysql-keycloak-dev --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: mysql-keycloak-deploy-dev spec: replicas: 1 template: metadata: labels: app: mysql-keycloak-dev spec: containers: - name: mysql-keycloak-dev image: mysql:5.7 ports: - containerPort: 8080 volumeMounts: - name: mysql-data mountPath: /var/lib/mysql env: - name: MYSQL_ROOT_PASSWORD value: Lookeng2018 - name: MYSQL_DATABASE value: keycloak volumes: - name: mysql-data persistentVolumeClaim: claimName: pvc-mysql-keycloak-dev --- apiVersion: v1 kind: Service metadata: name: mysql-keycloak-service-dev spec: selector: app: mysql-keycloak-dev ports: - name: tcp3306 protocol: TCP port: 3306 targetPort: 3306 type: ClusterIP 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 ---apiVersion: v1kind: PersistentVolumeClaimmetadata: name: pvc-mysql-keycloak-devspec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi storageClassName: cbs # volumeName: pvc-mysql-keycloak-dev # selector: # matchLabels: # app: pv-mysql-keycloak-dev ---apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: mysql-keycloak-deploy-devspec: replicas: 1 template: metadata: labels: app: mysql-keycloak-dev spec: containers: - name: mysql-keycloak-dev image: mysql:5.7 ports: - containerPort: 8080 volumeMounts: - name: mysql-data mountPath: /var/lib/mysql env: - name: MYSQL_ROOT_PASSWORD value: Lookeng2018 - name: MYSQL_DATABASE value: keycloak volumes: - name: mysql-data persistentVolumeClaim: claimName: pvc-mysql-keycloak-dev---apiVersion: v1kind: Servicemetadata: name: mysql-keycloak-service-devspec: selector: app: mysql-keycloak-dev ports: - name: tcp3306 protocol: TCP port: 3306 targetPort: 3306 type: ClusterIP