Kubernetes service IP confusion

6/27/2020

I'm aware that what I'm about to ask is probably an extremely basic networking question, but I'm not even sure the best way to word this to do a Google search that returns anything useful.

I'm working through a Kubernetes tutorial which suggests to get the IP address of one of my services with this command:

minikube service web --url

This returns to me http://192.168.64.2:30169. The part that confuses me is that my computer's IP address is 192.168.64.1. It seems like there are actually two IP addresses on my local network that "live" on my laptop, but when I try to access the service address from another machine on my home network the service does not load.

Question

What is really going on when each service is assigned a different IP address? What network is that on and why can I only access those services from my laptop?

-- wheresmycookie
kubernetes

1 Answer

6/27/2020

I think "http://192.168.64.2" could be the IP address of the VM that minikube is running. You can check it using minikube ip. 30169 could refer to the port where the service is accessible if the service is of NodePort type. Also, these IPs are locally exposed on your computer so they may not be accessible from another computer. Each service is assigned a virtual IP address inside the kubernetes cluster. They can be accessed from outside the cluster if they are of NodePort type. You can access them on any node of the cluster (hence multiple different IP addresses) or you could loadbalance across those node by adding a Loadbalancer or Ingress.

-- quantdaddy
Source: StackOverflow