apiVersion: apps/v1
kind: Deployment
metadata:
  name: mariadb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mariadb
  template:
    metadata:
      labels:
        app: mariadb
    spec:
      containers:
      - name: mariadb
        image: mariadb:10.4.8
        resources:
          limits:
            cpu: 250m
          requests:
            cpu: 100m
            memory: 500Mi
        imagePullPolicy: Always
        ports:
          - containerPort: 8080
        envFrom:
          - configMapRef:
              name: mariadb-configmap
        volumeMounts:
        - name: mariadb-pvc
          mountPath: /var/lib/mysql
        - name: mariadb-config
          mountPath: /etc/mysql/mariadb.cnf
          subPath: mariadb.cnf
      volumes:
      - name: mariadb-pvc
        persistentVolumeClaim:
         claimName: mariadb-pvc
      - name: mariadb-config
        configMap:
            name: mariadb-configmap
            items:
              - key: mariadb.cnf
                path: mariadb.cnf

