apiVersion: apps/v1
kind: Deployment
metadata:
  name: autoscale-mariadb-dep
spec:
  replicas: 1
  selector:
    matchLabels:
      app: autoscale-mariadb-app
  template:
    metadata:
      labels:
        app: autoscale-mariadb-app
    spec:
      containers:
      - name: app
        image: mariadb
        imagePullPolicy: IfNotPresent
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: "mypassword"
        - name: MYSQL_DATABASE
          value: "Cafeteria"
        volumeMounts:
        - name: schema
          mountPath: /docker-entrypoint-initdb.d/schema.sql
          subPath: schema.sql
        ports:
        - name: db
          containerPort: 3306
      volumes:
        - name: schema
          configMap:
            name: autoscale-mariadb-schema


