apiVersion: apps/v1
kind: Deployment
metadata:
  name: kube-znn-db
  labels:
    app: kube-znn-db
    tier: db
spec:
  selector:
    matchLabels:
      app: kube-znn-db
      tier: db
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: kube-znn-db
        tier: db
    spec:
      containers:
      - image: mysql:5.6
        name: mysql
        env:
        - name: MYSQL_DATABASE
          value: znn_data 
        - name: MYSQL_USER
          value: znn
        - name: MYSQL_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-pass
              key: password
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-pass
              key: password
        livenessProbe:
          tcpSocket:
            port: 3306
        ports:
        - containerPort: 3306
          name: mysql
       # volumeMounts:
       # - name: mysql-persistent-storage
       #   mountPath: /var/lib/mysql
      #volumes:
      #- name: mysql-persistent-storage
      #  persistentVolumeClaim:
      #    claimName: mysql-pv-claim
      nodeSelector:
        kops.k8s.io/instancegroup: kubeznn-db