How to Inject Kubernetes Service to my java class? How to Inject Kubernetes Service to my java class? kubernetes kubernetes

How to Inject Kubernetes Service to my java class?


Pods are automatically injected with environment variables containing information about services in their namespace. As an example, say your pod is in a namespace that also contains a service named 'foo'. The containers in your pod will be injected with:

FOO_SERVICE_HOST=<host service foo is reachable at>FOO_SERVICE_PORT=<port service foo is reachable at>

as well as docker-links style environment variables. Check out the docs here.