How to avoid restarting/dropping all connections when a new ingress is added?


I have a cluster where several projects are deployed under different namespaces.

nginx-ingress was installed with helm on the cluster, and a new ingress is deployed for every project.

The problem is when adding a new project, i.e creating a new namespace and adding several deployments + ingress service, nginx restarts and drop all connections, disrupting services in all other namespaces.

It seems that even if the nginx-ingress service is in the project namespace, the nginx-ingress pods are shared in the default namespace. Thus I am wondering if there's a way to dedicate nginx-ingress pods to every namespace so changing the config for one namespace doesn't disrupt the whole cluster?

-- znat

1 Answer


You can deploy a dedicated Ingress controller per namespace (with use of the Helm chart: and custom ingressClass)

controller.ingressClass name of the ingress class to route through this controller

and than use appropriate Ingress annotations to exploit them:

  name: fooA
  annotations: "namespaceA"

  name: fooB
  annotations: "namespaceB"

  name: fooC
  annotations: "namespaceC"

So all pods within the namespace namespaceA are using a dedicated namespaceA Ingress controller and won't be affected by restarts of Ingress controllers deployed to the other namespaces (including the default one: ingressClass=nginx).

Just keep in mind that deploying a new Ingress controller may cause a new "physical" Load Balancer to be provisioned (adding extra $$ to your cloud provider monthly bills), so it is worth doing only with the services that are being seriously affected by the connection drops (streaming, WebSockets, etc.), well designed REST services shouldn't be seriously affected by short Ingress restarts.

-- Piotr Szwed
Source: StackOverflow