So, I have a really simple Flask app that I'm deploying in a Kubernetes environment using helm. Now, I have the following defined in my values.yaml
:
...
service:
type: ClusterIP
port: 5000
targetPort: 5000
# can add
# flaskPort: "5000"
ingress:
...
I know that I can set environment variables in my helm install
command by typing helm install python-service . --values values-dev.yaml --set flaskPort=5000
and in my python code just do :
PORT = os.environ.get("flaskPort")
app.run(port=PORT, debug=True, host=0.0.0.0)
I can also define in my values-dev.yaml
and in my templates/deployment.yaml
entries for this environment variable flaskPort
. But what about the port
and targetPort
entries in my values-dev.yaml
? Wouldn't that clash with whatever flaskPort
I set? How do I modify my chart to make sure that whatever port I specify in my helm install
command, my python app is started on that port. The python app is a small mock server which responds to simple GET/POST commands.