Virtualbox kubernetes NodePort access

7/25/2019

Morning,

I have a simple nginx setup that is using NodePort to access on an alternate port 30000. I cannot seem to figure out how to actually access it on my workstation that has the virtualbox installed.

Some basic stuff:

NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          
AGE
kubernetes               ClusterIP   10.96.0.1        <none>        443/TCP          
25h
nginx-55bc597fbf-zb2ml   ClusterIP   10.101.124.73    <none>        8080/TCP         
24h
nginx-service-np         NodePort    10.105.157.230   <none>        
8082:30000/TCP   22h
user-login-service       NodePort    10.106.129.60    <none>        
5000:31395/TCP   38m

I am using flannel

kubectl cluster-info
Kubernetes master is running at https://192.168.56.101:6443
KubeDNS is running at https://192.168.56.101:6443/api/v1/namespaces/kube- 

system/services/kube-dns:dns/proxy

kubectl get nodes
NAME                 STATUS   ROLES    AGE   VERSION
k8s-master    Ready    master   25h   v1.15.1
k8s-worker1   Ready    <none>   94m   v1.15.1
k8s-worker2   Ready    <none>   98m   v1.15.1

I did port forwarding for NAT where it is supposed to forward 30000 to 80 and also did 31395 to 31396 for the user-login-service

Trying to access using master ip https://192.168.56.101:80 or https://192.168.56.101:31396 fails. I did try http as well, but cluster-info seems to show master using https and kubernetes is using 443/tcp.

There are two adapters for master and the workers. One adapter is NAT and used to allow flow of traffic outbound (e.g., for use with apt-get commands)

This seems to use 10.0.3.15 address assigned to all three nodes

The other adapter is host-ip and is what is giving the servers addresses in the 192.168.56.0 network. I did set those as static using netplan.

The three servers can see each other fine. I can do external traffic fine.

/etc/netplan# kubectl get pods -n kube-system
NAME                                        READY   STATUS    RESTARTS   AGE
coredns-5c98db65d4-4xg8h                    1/1     Running   17         
120m
coredns-5c98db65d4-xn797                    1/1     Running   17         
120m
etcd-k8s-master                      1/1     Running   8          25h
kube-apiserver-k8s-master            1/1     Running   8          25h
kube-controller-manager-dashap-k8s-master   1/1     Running   12         25h
kube-flannel-ds-amd64-6fw7x                 1/1     Running   0          25h
kube-flannel-ds-amd64-hd4ng                 1/1     Running   0          
122m
kube-flannel-ds-amd64-z2wls                 1/1     Running   0          
126m
kube-proxy-g8k5l                            1/1     Running   0          25h
kube-proxy-khn67                            1/1     Running   0          
126m
kube-proxy-zsvqs                            1/1     Running   0          
122m
kube-scheduler-k8s-master            1/1     Running   10         25h
weave-net-2l5cs                             2/2     Running   0          44m
weave-net-n4zmr                             2/2     Running   0          44m
weave-net-v6t74                             2/2     Running   0          44m

This is my first setup, so it is hard to troubleshoot for me. Any help on how to reach the the two services using my browser on my workstation and not within the nodes would be appreciated.

-- archcutbank
kubernetes

0 Answers