Kubernetes Pod can't ping external IP

Informations :
Version of Kubernetes : 2.19.0
Installations done :
- Kubectl : 1.18.5-00
- Kubelet : 1.18.5-00
- Kubeadm: 1.18.5-00

Number of node: one node master 

Dns resolver: core-dns deployment
Network Kubernetes: calico deployment

Hi everybody. I have installed Kubernetes cluster using kubelet, kubeadm and Kubectl. I have installed prometheus using Helm inside my kubernetes cluster on the node master (IP: 192.168.40.39) and create service of type NodePort to access prometheus. Now i want prometheus to access metrics on another host machine of ip 192.168.40.35 (there is no kubernetes on this machine). I have noticed this :
- Prometheus can’t access metrics on external host ip (example of 192.168.40.35 )
- Prometheus can access metrics on the node master (192.168.40.39)
- I can’t ping external host inside all Kubernetes pods (i try ping with 192.168.40.35 on different pods)

My question is how can i allow a specific pod to communicate with an external ip address ?

Hello, dev-winnersek
You can use nodePort service type.

Thanks @tej-singh-rana for you reply. I have created my Prometheus service with NodePort. The problem i have is that inside prometheus pod (on master node), i can’t ping external ip address on the same network as the node master.
Node master ip: 192.168.40.39
I execute prometheus pod
Inside prometheus pod, i ping 192.168.40.35. It doesn’t work. So i can’t monitor external host with my prometheus server that is on the node master.

https://speakerdeck.com/thockin/bringing-traffic-into-your-kubernetes-cluster

https://speakerdeck.com/thockin/kubernetes-and-networks-why-is-this-so-dang-hard

Do these help?