apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
spec:
  selector:
    matchLabels:
      app: mysql
  strategy:
    type: Recreate
  replicas: 1
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - image: my_mysql
        name: mysql
        imagePullPolicy: Never
        volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
        ports:
        - name: mysql-port
          containerPort: 3306
        livenessProbe:
          exec:
            command:
            - sh
            - -c
            - "service telegraf status && service mariadb status"
          initialDelaySeconds: 5
          periodSeconds: 5
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: mysql-volume
