apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  namespace: t0
  labels:
    app: mysql
    version: "1.0"
    environment: testing
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
      version: "1.0"
      environment: testing
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mysql
        version: "1.0"
        environment: testing
    spec:
      volumes:
        - name: pv-storage
          persistentVolumeClaim:
            claimName: nfs-pvc
      containers:
        - image: mysql:5.7
          name: mysql
          env:
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: spring-secrets
                  key: mysqlpass
          ports:
            - containerPort: 3306
              name: mysql
          volumeMounts:
            - name: pv-storage
              mountPath: /var/lib/mysql
