Kubernetes pods IP should be reachable or pingable from external network - apart from master and worker

4/9/2019

I have created a deployment with NodePort. Pod is created and pod has an IP. Only one container is running in a pod. I want to access that container/pod IP from external apart from Master or node. Now I'm able to ping the pod IP from master and node, but not from my device. Container/pod should be pingable from my device. I'm able to ping my device from my pod/container.

What needs to be done to make the pod IP visible/reachable from the outside?

-- Srivalli Ganesh
external
ip
kubernetes
networking
pod

3 Answers

4/9/2019

If you want to access your pod , you should do it like : ${node-ip}:${nodeport}.However you cannot access your pod by its clusterIP, it serves only for in-cluster communication.You can get external IP by changing the service to LoadBalancer, but the IP is received by a cloud provider.

-- Martin Petkov
Source: StackOverflow

4/10/2019

I agree with @Max Lobur and @Мартин Петков conclusions, that using NodePort type of Kubernetes services makes it possible to proxy underlying Pod service port to some port from the pool on the corresponded Node, therefore you might be able to reach Kubernetes Pod outside the cluster on Node IP address and related proxy port.

Alternatively, you can achieve communication with target Kubernetes Pod by applying External IP in a particular service to transmit network traffic to the related Node, however this is quite weighty solution, as it requires some routes to be implemented on external IP to forward network traffic to the nested Kubernetes Node.

-- mk_sta
Source: StackOverflow

4/9/2019

You need to point to Service port (of type NodePort) on a node, not the pod IP.

kubectl get service <my-service>

Check what port did you get. Then get IP of any node of the k8s cluster

kubectl get nodes

And reach it like

telnet <node_ip>:<service_port>

More on service types: https://kubernetes.io/docs/concepts/services-networking/service/

-- Max Lobur
Source: StackOverflow