apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysqldb-deployment
  labels:
    app: login-application
spec:
  replicas: 1
  selector:
    matchLabels:
      name: mysqldb-pod
      app: login-application
  template:
    metadata:
      name: mysqldb
      labels:
        name: mysqldb-pod
        app: login-application
    spec:
      containers:
      - name: mysqldb
        image: muralindia/java_test_mysql:1.0
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
               name: mysql-secret
               key: password
#          value: root
        ports:
        - containerPort: 3306
        volumeMounts:
        - name: persistent-volume
          mountPath: /var/lib/mysql
      nodeSelector:
        type: backend
      volumes:
      - name: persistent-volume
        hostPath:
          path: /var/mysql_data_backup
          type: DirectoryOrCreate
