<p>I have very specific case when my Pod should access to another LoadBalancer service via an ExternalIP. </p>

<p>Is there any way to assign LoadBalancer ExternalIP as an ENV variable to Deployment.yaml?</p>

<p>Thank you in advance!</p>

<p>I don't think this is directly possible in any of the standard templating tools.  Part of the problem is that creating a cloud-hosted load balancer is an asynchronous operation, so that external-IP value won't be available until some time after <code>kubectl apply</code> (or the equivalent <code>helm install</code>) has finished.</p>

<p>If you can create the Service in advance then you can hard-code its external IP address or host name into other configuration, but this is intrinsically two steps.  (If you're bought into Kubernetes operators, this should be possible with custom code: watch the Service, and once it gets its external address, create a corresponding ConfigMap that holds the address.)</p>

<p>Depending on your specific use case it may also work to just target the LoadBalancer Service within your cluster, the same as any other Service.  This won't go out through the cloud provider's load-balancer tier, but it <em>should</em> be indistinguishable otherwise.</p>
