Pod to pod communication

#1

I have a pod running in my k8 environment at home. It’s a nagios container to monitor various things on the network. Some of the things I would like to monitor for instance are services running in other pods.

What is the best way to let my nagios container communicate with the other services running in other pods?

0 Likes

#2

Hi CC,
Have you investigated Kubernetes Services(Services - Kubernetes)? This is the standard way of allowing communication between pods. By wrapping a pod/deployment in a service you create an abstraction and a concrete IP/Port combination that other pods can use to communicate with that service.

0 Likes

#3

hmmmm. I have services setup.

pods

svc

So i have service ips.

if i want to monitor port 1883 on the mosquito svc would i use the external IP or the clusterIP? both i get “No Route to Host”

something I am missing maybe?

0 Likes

#4

I can get DNS to resolve “mosquitto-loadbalancer” but can’t connect to 1883

0 Likes

#5

Cluster IP should work so I am not sure why the route is not accessible.

FYI, the cluster IP/Port should be available as env values in your other containers(assuming they were started after service creation).
i.e.
REDIS_MASTER_SERVICE_HOST=10.0.0.11
REDIS_MASTER_SERVICE_PORT=6379
REDIS_MASTER_PORT=tcp://10.0.0.11:6379
REDIS_MASTER_PORT_6379_TCP=tcp://10.0.0.11:6379
REDIS_MASTER_PORT_6379_TCP_PROTO=tcp
REDIS_MASTER_PORT_6379_TCP_PORT=6379
REDIS_MASTER_PORT_6379_TCP_ADDR=10.0.0.11

0 Likes