apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpmyadmin
  namespace: mariadb
  labels:
    app: phpmyadmin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: phpmyadmin
  template:
    metadata:
      labels:
        app: phpmyadmin
    spec:
      containers:
      - name: phpmyadmin
        image: arm64v8/phpmyadmin
        ports:
          - containerPort: 80
        env:
        - name: PMA_HOST
          value: mariadb
        - name: PMA_PORT
          value: "3306"
        - name: MYSQL_ROOT_PASSWORD
          value: "zabbix" 
#        volumeMounts:
#        - name: phpconfig
#          mountPath: /etc/phpmyadmin
#      volumes:
#      - name: phpconfig
#        persistentVolumeClaim:
#          claimName: phpmyadmin-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: phpmyadmin
  namespace: mariadb
spec:
  selector:
    app.kubernetes.io/name: phpmyadmin
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  selector:
    app: phpmyadmin
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: phpmyadmin-tls-alldcs
  namespace: mariadb
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`phpmyadmin-dev.alldcs.nl`)
    kind: Rule
    services:
    - name: phpmyadmin
      port: 80
  tls:
    certResolver: letsencrypt
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: phpmyadmin-pv
  labels:
    type: local
spec:
  storageClassName: ""
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteMany
  nfs:
    server: 192.168.40.100
    path: /mnt/nfs_share/phpmyadmin
    readOnly: false
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: phpmyadmin-pvc
  namespace: mariadb
spec:
  storageClassName: ""
  volumeName: phpmyadmin-pv
  accessModes:
    - ReadWriteMany
  volumeMode: Filesystem
  resources:
    requests:
      storage: 1G

