Having problem to access deployed application in multiclustering kubernetes environment in VirtualBox

4/20/2019

I have create multicluster kubernetes environment and my node details is:

kubectl get nodes -o wide

NAME            STATUS   ROLES    AGE   VERSION   INTERNAL-IP     EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
16-node-121     Ready    <none>   32m   v1.14.1   192.168.0.121   <none>        Ubuntu 16.04.6 LTS   4.4.0-142-generic   docker://18.9.2
master-16-120   Ready    master   47m   v1.14.1   192.168.0.120   <none>        Ubuntu 16.04.6 LTS   4.4.0-142-generic   docker://18.9.2

And I created a service and exposed the service using following command:

$kubectl expose deployment hello-world --port=80 --target-port=8080

The is created and exposed. My service detail information is:

NAME          TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
hello-world   ClusterIP   10.105.7.156   <none>        80/TCP    33m

I exposed my deployment by following command:

kubectl expose deployment hello-world --port=80 --target-port=8080
service/hello-world exposed

Unfortunately when I try to access my service using curl command I'm getting timeout error:

My service details are following:

master-16-120@master-16-120:~$ kubectl describe service hello-world
Name:              hello-world
Namespace:         default
Labels:            run=hello-world
Annotations:       <none>
Selector:          run=hello-world
Type:              ClusterIP
IP:                10.105.7.156
Port:              <unset>  80/TCP
TargetPort:        8080/TCP
Endpoints:         192.168.1.2:8080
Session Affinity:  None
Events:            <none>



curl http://10.105.7.156:80
curl: (7) Failed to connect to 10.105.7.156 port 80: Connection timed out

Here I'm using calico for my multicluster network which is :

wget https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
wget https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml

My Pod networking specification is:

sudo kubeadm init --pod-network-cidr=192.168.0.0/16
-- Assaduzzaman Assad
docker
kubernetes
virtualbox

1 Answer

7/7/2019

At last I have got the solution. Thanks to Daniel's comment which helps me to reach my solution.

I change my kubernetis pod network CIDR and calico as follow:

--pod-network-cidr=10.10.0.0/16

And also configure master which is master-16-120 Hosts (/etc/hosts):

master-16-120 192.168.0.120
16-node-121 192.168.0.121

And in the node which is 16-node-121 Hosts (/etc/hosts)

master-16-120 192.168.0.120
16-node-121 192.168.0.121

Now my kubernetes is ready to go.

-- Assaduzzaman Assad
Source: StackOverflow