apiVersion: apps/v1
kind: StatefulSet
metadata:
  namespace: larak8s
  name: mysql
spec:
  serviceName: mysql
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - image: mysql:5.7
        name: mysql
        env:
          - name: MYSQL_ROOT_PASSWORD
            valueFrom:
               secretKeyRef:
                 name: mysql-secrets
                 key: MYSQL_ROOT_PASSWORD
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: mysql-storage
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-storage
        persistentVolumeClaim:
          claimName: laravel-claim
