Kubernetes - Can't connect to a service IP from the service's pod Kubernetes - Can't connect to a service IP from the service's pod kubernetes kubernetes

Kubernetes - Can't connect to a service IP from the service's pod


for what you want to do you should be using a Headless Servicehttp://kubernetes.io/v1.0/docs/user-guide/services.html#headless-services

this means setting

clusterIP: None

in your Service

and that means there won't be an IP associated with the service but it will return all IPs of the Pods selected by the selector


Update: The bug is fixed in v1.2.4

You can try container hook.

containers:  - name: kafka    image: Kafka    lifecycle:      postStart:        exec:          command:            - "some.sh" #some shell scripts to get this pod's IP and notify the other Kafka members that "add me into your cluster"      preStop:        exec:          command:            - "some.sh" #some shell scripts to get other Kafka pods' IP and notify the other Kafka members that "delete me from your cluster"

I have got a similar problems on running 3 mongodb pods as a cluster but the pods cannot access themselves through their serivces' IP.

In addition, has the bug been fixed?