Kubernetes refusing connection using apache/phpmyadmin

10/23/2019

I have a local custom cluster i'm trying to run a php application with a MySQL database. I have exposed the MySQL service and deployment with PersistentVolumes and can access them fine through a local PHP instance but when trying to deploy Apache to run the web server my browser keeps rejecting the connection.

Ive tried to expose different ports on the deployment.yaml in the phpmyadmin deployment, i've tried port 80 and 8080 but they wouldn't expose correctly. Once i tried port 8088 they did deploy correctly but now my browser rejects the connection.

Ive tried going into the individual pod and run lsof to see if apache is listening on 80 and it is so im really at a loss with this.

root@ras1:/home/pi/k3s# ./k3s kubectl get endpoints 
NAME                 ENDPOINTS            AGE
kubernetes           192.168.1.110:6443   16d
mysql-service        10.42.1.79:3306      51m
phpmyadmin-service   10.42.1.85:8088      2m45s

root@ras1:/home/pi/k3s# ./k3s kubectl get services
NAME                 TYPE           CLUSTER-IP      EXTERNAL-IP                   PORT(S)          AGE
kubernetes           ClusterIP      10.43.0.1       <none>                        443/TCP          16d
mysql-service        LoadBalancer   10.43.167.186   192.168.1.110,192.168.1.111   3306:31358/TCP   49m
phpmyadmin-service   LoadBalancer   10.43.126.107   192.168.1.110,192.168.1.111   8088:31445/TCP   10s

The Cluster IP is 192.168.1.110 for the node1 and 192.168.1.111 for node2 (where the deployment is running)

Thanks for the help.

-- virshan
apache
cluster-computing
docker
kubernetes
phpmyadmin

1 Answer

10/23/2019

Managed to find a solution for this. Turns out my own ingress controller was already using port 80 and 8080 as "LoadBalancer" so I created an ingress.yaml and linked it to my phpmyadmin service which I set to "ClusterIP" rather than "LoadBalancer" now I can access my PHP app through port 80.

-- virshan
Source: StackOverflow