3

I have an nginx Dockerimage listening on some port as defined int its nginx.conf. That image is deployed as a workload in Kubernetes (GKE) and an ingress points to it. The image's port is - both as port and targetPort - set in the workload config Yaml file.

That set-up is running in a production environment.

Now I want to change the port, i.e. nginx should listen to a different port.

How do I do that without risking downtime? I'm afraid that I cannot change

  1. the deployed container itself
  2. the workload config
  3. the ingress config

at the very same moment. And if any of those are not in sync I would get downtime.

What is best practice in such cases? It would be nice if the ingress could point both to the old and the new port, but that's obviously not possible.

cis
  • 217
  • 2
  • 9

1 Answers1

4

Create a new deployment using the new image and then create a new service pointing to that deployment, then create a new ingress with a different hostname, do your app test and if everything is working fine, change the reference to the service in the old ingress

c4f4t0r
  • 5,149
  • 3
  • 28
  • 41