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