Kubernetes: How to access a load balancer externalIP inside Pod

11/5/2019

I have a use case where i have to deploy a distributed database using Kubernetes Statefulset. I want to access all Pods from outside cluster. There are few ways to do it, one of them is by creating Load balancer service per Pod. Now i want to inject this external PublicIP of Load balancer in Pod (Some DB related config file needs this info).

I tried to check if there is any ENV var inside Pod which can have this type of info. There are some ENV vars related to services, but they don't tell externalIP. They only show internal service IP. Any suggestions to get this externalIP inside Pod?

-- Sud
kubernetes
pod
service

0 Answers