<p>I try to create a second ingress for my azure Kubernetes cluster (AKS). One for company internal use and one for customers.</p>

<p>The first controller is built by the following script:</p>

<p><a href="https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.27.0/deploy/static/mandatory.yaml" rel="nofollow noreferrer">https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.27.0/deploy/static/mandatory.yaml</a></p>

<p>And the service:</p>

<p><a href="https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.27.0/deploy/static/provider/cloud-generic.yaml" rel="nofollow noreferrer">https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.27.0/deploy/static/provider/cloud-generic.yaml</a></p>

<p>The official tutorial from Nginx (<a href="https://kubernetes.github.io/ingress-nginx/user-guide/multiple-ingress/" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/user-guide/multiple-ingress/</a>) says that I need to use the --ingress-class flag to separate the two controllers. And when both controllers are created, I need to reference each resource which controller is used by ingress.class annotation. </p>

<h3>first question</h3>

<p>That makes sense because I can create two different ingresses with routing specifications. But do I also need to reference the controller in the Nginx-service?</p>

<h3>second question</h3>

<p>I edit the mandatory.yaml on my machine and applied it by a local YAML file. 
So I passed the --ingress-class flag to the arguments of the controller (started on mandatory.yaml line 218):</p>

<pre><code>containers:
  - name: nginx-ingress-controller
    image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:master
    args:
      - /nginx-ingress-controller
      - --configmap=$(POD_NAMESPACE)/nginx-configuration
      - --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
      - --udp-services-configmap=$(POD_NAMESPACE)/udp-services
      - --publish-service=$(POD_NAMESPACE)/ingress-nginx
      - --annotations-prefix=nginx.ingress.kubernetes.io
      - --ingress-class=nginx-external
</code></pre>

<p>When I redeploy it the mandatory.yaml with --ingress-class=nginx-internal, the existing controller will be reconfigured, but no second controller will be deployed.
What I'm doing wrong?</p>

Nico Schuck
<ol>
<li><p>For the nginx service you need to provide selector and labels such that it selects your second nginx ingress controller pods.</p></li>
<li><p>You just changed existing deployment with name <code>nginx-ingress-controller</code> of the existing ingress controller. That's the reason why it reconfigured your existing ingress controller.You need to create new deployment yaml with a <strong>different name</strong> and add <code>--ingress-class</code> flag in the new deployment.</p></li>
</ol>

<p>I would suggest to create two different namespaces and two different set of yamls for ingress controller 1 and ingress controller 2 and change the name, namespace, labels and selectors in those yamls.</p>
