apiVersion: v1
kind: ReplicationController
metadata:
  name: mysql-server
  labels:
    app: zabbix
    tier: mysql-server
  namespace: zabbix
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: mysql-server
        app: zabbix
        tier: mysql-server
    spec:
      containers:
        - name: zabbix-db
          image: mysql:8.0
          ports:
          - containerPort: 3306
            name: mysql
          env:
          - name: MYSQL_USER
            valueFrom:
             secretKeyRef:
              name: db-secret
              key: db-zbx-user
          - name: MYSQL_PASSWORD
            valueFrom:
             secretKeyRef:
              name: db-secret
              key: db-zbx-pass
          - name: MYSQL_ROOT_PASSWORD
            valueFrom:
             secretKeyRef:
              name: db-secret
              key: db-root-pass
          - name: MYSQL_DATABASE
            value: "zabbix"
          args: ["--default-authentication-plugin=mysql_native_password"]
          volumeMounts:
          - name: mysql
            mountPath: /var/lib/mysql
      volumes:
       - hostPath:
          path: /MYSQL
         name: mysql