0
votes

I am working on a Chart development, which includes Service.yaml and Deployment.yaml 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 templates/deployment.yaml

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

Is this possible, without hard coding a Service NodePort?

1

1 Answers

1
votes

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.

Can a kubernetes Deployment inject the service nodeport as an environment variable?