How to obtain the new ip on a restarted pod, from another pod

7/5/2016

POD A (APP) has connection pool pointing to POD B's ip (DATABASE) if I restart POD B its ip might change, how can I get this new ip on POD A

right now I'm just using the pod's ip

-- PaulMB
gcloud
kubernetes

2 Answers

7/6/2016

I figure it out, i didn't understand to well the concept of services in kubernetes. the ENV variables in kubernetes contains the info from the services(ports, ip, etc), so my app pod is just gonna point to the service and not to the pod's ip, so if the database pod dies or get restarted is the service task to locate this new pod's endpoint with the selector.

-- PaulMB
Source: StackOverflow

7/6/2016

Yeah just define a service for your pool of pods running the same containers. You will beneficiate of the Virtual IP and the dynamic load balancing accross pods

-- Jonathan MULLER
Source: StackOverflow