apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: mariadb
  name: mariadb
spec:
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: mariadb
  serviceName: mariadb
  template:
    metadata:
      labels:
        app: mariadb
    spec:
      containers:
      - image: mariadb:10.6
        imagePullPolicy: IfNotPresent
        name: mariadb
        envFrom:
          - secretRef:
              name: mariadb
        ports:
        - containerPort: 3306
          protocol: TCP
        volumeMounts:
        - name: data
          mountPath: /var/lib/mysql
      restartPolicy: Always
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: mariadb-pvc
