apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: redpacket-mysql
  labels:
    app: redpacket
spec:
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: redpacket
        tier: mysql
    spec:
      containers:
      - image: dockerhub.qingcloud.com/mysql:5.6
        name: mysql
        env:
          # $ kubectl create secret generic mysql-pass --from-file=password.txt
          # make sure password.txt does not have a trailing newline
        - name: MYSQL_ROOT_PASSWORD
          value: Quantgroup2017
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: mysql-pv-claim