<p>I have a brand new (so empty) AKS cluster. I want to install two instances of the nginx ingress controller, in different namespaces and with different ingress class, using helm.</p>
<p>I start with the first:</p>
<pre><code>helm install ingress1 ingress-nginx/ingress-nginx --namespace namespace1 --set controller.ingressClass=class1

NAME: ingress1
LAST DEPLOYED: Fri Sep 24 20:46:28 2021
NAMESPACE: namespace1
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The ingress-nginx controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
</code></pre>
<p>All good</p>
<p>Now I go with the second:</p>
<pre><code>helm install ingress2 ingress-nginx/ingress-nginx --namespace namespace2 --set controller.ingressClass=class2

Error: rendered manifests contain a resource that already exists. Unable to continue with install: IngressClass &quot;nginx&quot; in namespace &quot;&quot; exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key &quot;meta.helm.sh/release-name&quot; must equal &quot;ingress2&quot;: current value is &quot;ingress1&quot;; annotation validation error: key &quot;meta.helm.sh/release-namespace&quot; must equal &quot;namespace2&quot;: current value is &quot;namespace1&quot;
</code></pre>
<p>What is the correct way to install multiple nginx ingress controller instances in the same cluster?</p>

<p>I think that you're setting the wrong values, thus the class name is <code>nginx</code> in both installs. Take a look at the template here: <a href="https://github.com/kubernetes/ingress-nginx/blob/3ae09fd1fac381fce9f5066febf172a4a70c10a9/charts/ingress-nginx/templates/controller-ingressclass.yaml#L13" rel="noreferrer">controller-ingressclass</a></p>
<p>If you're using the official ingress-nginx Helm repository: <code>https://kubernetes.github.io/ingress-nginx</code> then try setting this instead: <code>controller.ingressClassResource.name=class1|class2</code> instead:</p>
<pre class="lang-sh prettyprint-override"><code>helm install ingress1 ingress-nginx/ingress-nginx --namespace namespace1 --set controller.ingressClassResource.name=class1

helm install ingress2 ingress-nginx/ingress-nginx --namespace namespace2 --set controller.ingressClassResource.name=class2
</code></pre>
<p>depending on your needs, you may also require to change the other values <a href="https://github.com/kubernetes/ingress-nginx/blob/3ae09fd1fac381fce9f5066febf172a4a70c10a9/charts/ingress-nginx/values.yaml#L98" rel="noreferrer">of the ingressClassResource</a></p>
