Kubernetes getting sibling-pod IP/properties from the same deployment/replicaset

7/8/2018

Need to set the ip and/or any metadata of the deployment to be available as env vars to each pod under the same deployment...

ex: having a 3 replica deploment. need to set env var for other IP address for each of the two other pods. need to set the host name for each other two pods. as of having

HOSTNAME=deplymentNAME-d74cf6f77-q57jx
deplymentNAME_PORT=tcp://10.152.183.27:13000

need to add:

HOSTNAME2=deplymentNAME-d74cf6f77-y67kl
HOSTNAME3=deplymentNAME-d74cf6f77-i90ro
deplymentNAME_PORT2=tcp://10.152.183.45:13000
deplymentNAME_PORT3=tcp://10.152.16.28:13000

those should be available on the three pods relatively. as of now each pod have only its own data, we need to spread others data to the other replicas in the same deployment.

-- Michael Eino
environment-variables
kubernetes
kubernetes-deployment

1 Answer

8/13/2018

Well, I figured out that my application is a stateful and not stateless application, that requires fixed/stable hostname/storage etc...

I have decided to use the statefulset controller

references:

-- Michael Eino
Source: StackOverflow