apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  namespace: default
  labels:
    app: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - name: mysql
        image: mysql
        imagePullPolicy: Always
        ports:
        - containerPort: 3306
        env:
          - name: MYSQL_ROOT_PASSWORD
            value: "password"
        volumeMounts:
          - mountPath: /var/lib/mysql
            name: mysql
      restartPolicy: Always
      volumes:
        - name: mysql
          persistentVolumeClaim:
            claimName: mysql