<p>I am working on a Chart development, which includes <code>Service.yaml</code> and <code>Deployment.yaml</code> template.
Deployment POD/Containers expects an environment variable which should be the exposed NodePort of the service. So I need to inject Service Nodeport into <code>templates/deployment.yaml</code></p>

<p>I would like to have the template engine render and create the object for <code>Service.yaml</code> first, and then based on the returned/Created Service object, use the exposed Service <code>NodePort</code> as a template variable in <code>Deployment.yaml</code>.</p>

<p>Is this possible, without hard coding a Service NodePort?</p>

Venu S
<p>I think you are looking for something like this. It is the similar question. However I would advise you to use ingress controller as this is not a best practice when it comes to kubernetes. You can implement things on it but moving forward, if this scenario will be supported it's highly unlikely. More hacks lead to more confusion.</p>

<p><a href="https://stackoverflow.com/questions/45315181/can-a-kubernetes-deployment-inject-the-service-nodeport-as-an-environment-variab">Can a kubernetes Deployment inject the service nodeport as an environment variable?</a></p>
