apiVersion: v1
kind: Service
metadata:
  name: phpmyadmin-mysql-cluster
  namespace: mysql-cluster
  labels:
    app: wordpress
spec:
  selector:
    app: wordpress
    tier: phpmyadmin
  type: NodePort
  ports:
    - name: phpadmin
      nodePort: 30087
      port: 80
      targetPort: phpmyadm
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpmyadmin-mysql-cluster
  namespace: mysql-cluster
  labels:
    app: wordpress
spec:
  selector:
    matchLabels:
      app: wordpress
      tier: phpmyadmin
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: wordpress
        tier: phpmyadmin
    spec:
      containers:
        - name: phpmyadmin
          image: harbor.reymota.es/sistema/phpmyadmin-custom:1.1
          ports:
            - containerPort: 80
              name: phpmyadm
          env:
            - name: PMA_UPLOADDIR
              value: /var/www/html/subidas
            - name: PMA_HOST
              # value: wordpress-mysql
              value: mycluster-instances.mysql-cluster.svc.cluster.local
            - name: PMA_PORT
              value: "3306"
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mypwds
                  key: rootPassword
