apiVersion: apps/v1
kind: StatefulSet
metadata:
    name: mysql
spec:
    replicas: 1
    serviceName: mysql
    selector:
        matchLabels:
            app: mysql
    template:
        metadata:
            labels:
                app: mysql
        spec:
            containers:
                - name: mysql
                  image: mysql:8.0.23
                  args: ["--default-authentication-plugin=mysql_native_password"]
                  envFrom:
                      - secretRef:
                           name: mysql-secrets
                  ports:
                      - containerPort: 3306
                        name: mysql
                  volumeMounts:
                  - name: mysql-volume
                    mountPath: /var/lib/mysql
                  resources:
                    limits:
                        memory: 1Gi
                        cpu: "1"
                    requests:
                        memory: 256Mi
                        cpu: "0.2"

            volumes:
            - name: mysql-volume
              persistentVolumeClaim:
                claimName: mysql-pv-claim
