A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

April 11, 2018

Lab 3.2/3.3 master to node network problem

I am doing the labs in VirtualBox.  I had to make a few changes to the instructions to get this far but I wonder if there are other things that I need to do differently for VirtualBox to work.

The VirtualBox NAT network interface lets you access the internet but you cannot access other VMs so each VM has 2 interfaces, a NAT interface to access the internet and a Host Only interface to access it from my host and so they can talk to each other.  To make this work, I needed to add the --apiserver-advertise-address=192.168.56.10 option on the kubeadm init command otherwise the second VM could not access the API server.  I also needed to disable the firewall using the ufw disable command on both boxes.

I was able to finish Lab 3.2 after making these changes.

On Lab 3.3 step 2, when I run the exec command from my master, I get an error:

jsissom@kmaster:~$ kubectl get po -o wide
NAME                     READY     STATUS    RESTARTS   AGE       IP           NODE
nginx-768979984b-nfh6r   1/1       Running   0          10m       10.244.1.6   knode1
nginx-768979984b-pqszn   1/1       Running   0          10m       10.244.1.5   knode1
nginx-768979984b-ssdkq   1/1       Running   0          9m        10.244.1.7   knode1

jsissom@kmaster:~$ kubectl exec nginx-768979984b-pqszn -- printenv
error: unable to upgrade connection: pod does not exist

I told it to increase the replicas to 10 to get some running on master and if I try to exec to one running on the master node, I get connected and it works:

jsissom@kmaster:~$ kubectl get po -o wide
NAME                     READY     STATUS    RESTARTS   AGE       IP            NODE
nginx-768979984b-4b7cc   1/1       Running   0          42s       10.244.0.4    kmaster
nginx-768979984b-7j9k2   1/1       Running   0          42s       10.244.1.8    knode1
nginx-768979984b-9rqfk   1/1       Running   0          42s       10.244.1.11   knode1
nginx-768979984b-cq9r2   1/1       Running   0          42s       10.244.0.6    kmaster
nginx-768979984b-gn9g4   1/1       Running   0          42s       10.244.1.10   knode1
nginx-768979984b-hfgx7   1/1       Running   0          42s       10.244.1.9    knode1
nginx-768979984b-nfh6r   1/1       Running   0          11m       10.244.1.6    knode1
nginx-768979984b-pqszn   1/1       Running   0          11m       10.244.1.5    knode1
nginx-768979984b-ssdkq   1/1       Running   0          10m       10.244.1.7    knode1
nginx-768979984b-vqznn   1/1       Running   0          42s       10.244.0.5    kmaster

jsissom@kmaster:~$ kubectl exec nginx-768979984b-4b7cc -- printenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=nginx-768979984b-4b7cc
KUBERNETES_PORT_443_TCP_PORT=443
NGINX_SERVICE_HOST=10.108.68.108
KUBERNETES_SERVICE_HOST=10.96.0.1
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
NGINX_SERVICE_PORT=80
NGINX_PORT=tcp://10.108.68.108:80
NGINX_PORT_80_TCP=tcp://10.108.68.108:80
NGINX_PORT_80_TCP_PROTO=tcp
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_PORT=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
NGINX_PORT_80_TCP_ADDR=10.108.68.108
KUBERNETES_SERVICE_PORT=443
NGINX_PORT_80_TCP_PORT=80
NGINX_VERSION=1.13.12-1~stretch
NJS_VERSION=1.13.12.0.2.0-1~stretch
HOME=/root

jsissom@kmaster:~$ kubectl exec nginx-768979984b-7j9k2 -- printenv
error: unable to upgrade connection: pod does not exist

Is there something I need to change in my environment to allow me to exec into a pod running on my node?

If I continue with the lab, in step 6, if I curl my public IP at the LoadBalancer port over and over, I get connected sometimes, but not others:

jsissom@host ~ $ curl http://kmaster:31166/
curl: (55) getpeername() failed with errno 22: Invalid argument
jsissom@host ~ $ curl http://kmaster:31166/
curl: (55) getpeername() failed with errno 22: Invalid argument
jsissom@host ~ $ curl http://kmaster:31166/
<!DOCTYPE html>
jsissom@host ~ $ curl http://kmaster:31166/
curl: (55) getpeername() failed with errno 22: Invalid argument
jsissom@host ~ $ curl http://kmaster:31166/
<!DOCTYPE html>

Thanks

Jay

 

Click Here!