In a Kubernetes cluster, there is a Docker network IP which looks to be the API server. However, not sure how to identify the physical IP and location of the box in which it is working.

If there is a guidance how to proceed, it would be appreciated. I have been handed over the system but no information.

$ curl
  "paths": [

$ kubectl get pods -o wide
NAME                    READY     STATUS    RESTARTS   AGE       IP
logging-fluentd-2vc4v   1/1       Running   0          1d
logging-fluentd-bvdtz   1/1       Running   0          1d
logging-fluentd-xvxrk   1/1       Running   0          1d    

$ sudo iptables -t nat -L -n
Chain KUBE-SERVICES (2 references)
target                     prot opt source               destination         
KUBE-SVC-NPX46M4PTMTKRN6Y  tcp  --             /* default/kubernetes:https cluster IP */ tcp dpt:443
KUBE-SVC-BA6I5HTZKAAAJT56  tcp  --             /* default/kubernetes:dns-tcp cluster IP */ tcp dpt:53

$ ip route
default via dev eth0 proto static metric 100 dev eth0 proto kernel scope link src metric 100 dev tun0 proto kernel scope link dev docker0 proto kernel scope link src dev tun0 scope link 
  • Based on the output of the ip route command the IP address of that machine is Is that the address you're looking for? – Adrian Dec 13 '17 at 19:43
  • the api server is usually on your master node, do you know where that is? – Jeff Garrett Jun 26 '18 at 16:51

The apiserver runs on master nodes. To get a list of all the master node IP's, this should help-

kubectl -n kube-system get po | grep -i apiserver | cut -f1 -d" " | xargs kubectl -n kube-system get po $1 -o=jsonpath="{.items[*].status.hostIP}"

Based on the version of Kubernetes you are running, you might need to update the location of the hostIP in the jsonPath parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.