How do I inject the nodePort generated by the service into the deployment? How do I inject the nodePort generated by the service into the deployment? kubernetes kubernetes

How do I inject the nodePort generated by the service into the deployment?


What you can do is to specify a port from the service-node-port-range (by default 30000-32767) in your Service yaml file under ports with the name nodePort. Then you'll know the nodePort in advance. You could use helm to pass in the nodePort to use as a parameter so that this parameter is used in the Service yaml and also your ConfigMap and Deployment.