---
apiVersion: v1
kind: Service
metadata:
  name: mysql
  labels:
    app: asvignesh
spec:
  ports:
    - port: 3306
      targetPort: 3306
  selector:
    app: asvignesh
    tier: mysql
  clusterIP: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  labels:
    app: asvignesh
spec:
  selector:
    matchLabels:
      app: asvignesh
      tier: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: asvignesh
        tier: mysql
    spec:
      containers:
      - image: mysql:5.6
        name: mysql
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: password
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: _PVC_
