Scalable-WordPress-deployment-on-Kubernetes icon indicating copy to clipboard operation
Scalable-WordPress-deployment-on-Kubernetes copied to clipboard

pods scheduled on different node can not communicate with each other

Open k19810703 opened this issue 8 years ago • 1 comments
trafficstars

I created my cluster(k8s 1.8) by kubeadm on 2 physical server( os:ubuntu 16.04)

$ kubectl get nodes
NAME      STATUS    AGE       VERSION
digital   Ready     21m       v1.8.0
next      Ready     22m       v1.8.0
$ kubectl get pods
NAME                               READY     STATUS    RESTARTS   AGE
wordpress-76b66d5644-76rtc         1/1       Running   4          7m
wordpress-mysql-5cdbc78858-vxnmn   1/1       Running   0          7m

By following this guide , I tried to deploy it on my cluster. WordPress pod was deployed on master node , and mysql pod was deployed on another worker node.

But wordpress pod can not connect mysql.

$ kubectl logs -f wordpress-76b66d5644-76rtc 

MySQL Connection Error: (2002) No route to host

Warning: mysqli::mysqli(): (HY000/2002): No route to host in - on line 22

Warning: mysqli::mysqli(): (HY000/2002): No route to host in - on line 22

k19810703 avatar Oct 12 '17 12:10 k19810703

I had the same error, Then I made changes in the MySQL service file and it worked for me. Below is my MySQL_service.yaml file

================= apiVersion: v1 kind: Service metadata: name: wordpress-mysql labels: app: wordpress spec: ports: - port: 3306 selector: app: wordpress tier: mysql

=================

Karthick-kumaravel avatar Jul 29 '20 09:07 Karthick-kumaravel