kind: Pod
apiVersion: v1
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  containers:
    - name: mysql
      image: mysql:5.7.27
      imagePullPolicy: Always
      # args:
      #   - "--datadir=/gh/.data/.k8s/mysql" # this config will crush pod
      ports:
        - containerPort: 3306
          name: mysql
      env:
        - name: MYSQL_ROOT_PASSWORD
          value: "root"
        - name: MYSQL_DATABASE
          value: "test"
        - name: MYSQL_USER
          value: "dbu"
        - name: MYSQL_PASSWORD
          value: "dbp"
      volumeMounts:
        - name: mysql-config-volume
          mountPath: /etc/mysql/conf.d/default_auth.cnf
          subPath: default_auth
        - name: mysql-config-volume-2
          # mountPath: /etc/mysql/mysql.conf.d/mysqld.cnf # this line will crush pod
          mountPath: /etc/mysql/conf.d/custom_mysqld.cnf
          subPath: custom_mysqld
        - mountPath: /gh
          name: xvol


  volumes:
    - name: mysql-config-volume
      configMap:
        name: mysql-config
    - name: mysql-config-volume-2
      configMap:
        name: mysql-config
    - name: xvol
      hostPath:
        path: /gh
        type: DirectoryOrCreate



