Where does kubernete's kubelet create service environment variables?
The environment variables for a given service are put in every container that is started after the service was created.
For example, if you create a pod foo
and then later a service bar
, the pod's containers won't have any environment variables for bar
.
If you instead create service bar
and then a pod foo
, the pod's containers should have environment variables something like:BAR_PORT=tcp://10.167.240.1:80BAR_SERVICE_HOST=10.167.240.1
You can test this out by attaching a terminal to one of your containers, as explained here.