k8s

phpMyAdmin on Kubernetes

📦 phpMyAdmin on Kubernetes

This repository provides the necessary manifests to deploy phpMyAdmin on Kubernetes for managing MariaDB and MySQL databases.

📌 Requirements

  • Kubernetes cluster (v1.24+)
  • An existing MySQL or MariaDB service running in the cluster
  • phpMyAdmin will connect using ClusterIP service name

🗂 Deployment Files

1. phpMyAdmin Deployment

# phpmyadmin-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpmyadmin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: phpmyadmin
  template:
    metadata:
      labels:
        app: phpmyadmin
    spec:
      containers:
        - name: phpmyadmin
          image: phpmyadmin:5.2
          env:
            - name: PMA_HOST
              value: "mysql"  # or "mariadb" depending on your DB service
            - name: PMA_PORT
              value: "3306"
          ports:
            - containerPort: 80

2. phpMyAdmin Service

# phpmyadmin-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: phpmyadmin
spec:
  type: NodePort  # or ClusterIP if exposing internally only
  selector:
    app: phpmyadmin
  ports:
    - port: 80
      targetPort: 80
      nodePort: 30080

🚀 Deploy phpMyAdmin

kubectl apply -f phpmyadmin-deployment.yaml
kubectl apply -f phpmyadmin-service.yaml

🌐 Accessing phpMyAdmin

  • If NodePort is used:
    http://<NodeIP>:30080
    
  • Login using the DB credentials of your MySQL or MariaDB instance.

⚙️ Customization

  • Change PMA_HOST to point to the correct database service:
    • mysql for MySQL
    • mariadb for MariaDB

🛡️ Security

For production, consider enabling HTTPS and protecting access using Ingress or authentication.


📄 License

MIT

0
Uncategorized