apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-dev-deploy
  namespace: mysql
  labels:
    app.kubernetes.io/name: mysql-dev
    app.kubernetes.io/instance: mysql-dev-deploy
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/instance: mysql-dev-pod
  template:
    metadata:
      labels:
        app.kubernetes.io/name: mysql-dev
        app.kubernetes.io/instance: mysql-dev-pod
    spec:
      containers:
        - name: mysql-dev-pod
          image: mysql:8.0.21
          ports:
            - containerPort: 3306

          env:
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: dbsecret
                  key: MYSQL_ROOT_PASSWORD

          volumeMounts:
            - mountPath: /var/lib/mysql
              name: mysql-dev-volume
      volumes:
        - name: mysql-dev-volume
          persistentVolumeClaim:
            claimName: mysql-dev-pvc
