<p>I have a cluster where several projects are deployed under different namespaces.</p>

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

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

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

znat
<p>You can deploy a dedicated Ingress controller per namespace (with use of the Helm chart: <a href="https://github.com/helm/charts/tree/master/stable/nginx-ingress" rel="nofollow noreferrer">https://github.com/helm/charts/tree/master/stable/nginx-ingress</a> and custom ingressClass)</p>

<pre><code>controller.ingressClass name of the ingress class to route through this controller
</code></pre>

<p>and than use appropriate Ingress annotations to exploit them:</p>

<pre><code>metadata:
  name: fooA
  annotations:
    kubernetes.io/ingress.class: "namespaceA"

metadata:
  name: fooB
  annotations:
    kubernetes.io/ingress.class: "namespaceB"

metadata:
  name: fooC
  annotations:
    kubernetes.io/ingress.class: "namespaceC"
</code></pre>

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

<p>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.</p>
