<p>I have 2 namespaces in my kubernetes cluster, one called <code>first-nginx</code> and the other called <code>second-nginx</code>. I am using the chart <a href="https://ingress-nginx%20https://kubernetes.github.io/ingress-nginx" rel="nofollow noreferrer"><strong>ingress-nginx</strong></a>.. <strong>NOT</strong> the <strong>stable/nginx-ingress</strong> as that is now deprecated.</p>
<p>I am attemtping to install multiple nginx controllers, because i need them to be exposed by an already created static ip in GKE. I have successfully installed my first chart in the first-nginx namespace like this</p>
<pre><code>helm install nginx-ingress ingress-nginx/ingress-nginx --namespace first-nginx --set ingress-class=&quot;nginx-devices --set controller.service.loadBalancerIP={first-IP-address}&quot;
</code></pre>
<p>I am now attempting to do the same with in the second namespace like this</p>
<pre><code>helm install nginx-ingress-2 ingress-nginx/ingress-nginx --namespace second-nginx --set ingress-class=&quot;nginx-devices --set controller.service.loadBalancerIP={second-IP-address}&quot;
</code></pre>
<p>However i get an error as shown below.</p>
<blockquote>
<p>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;nginx-ingress-2&quot;: current
value is &quot;nginx-ingress&quot;; annotation validation error: key
&quot;meta.helm.sh/release-namespace&quot; must equal &quot;second-nginx&quot;: current
value is &quot;first-nginx&quot;</p>
</blockquote>
<p>How do i solve this ? This seems to work when i use the stable/nginx-ingress chart where i can do something like this <code>helm install nginx-ingress-devices stable/nginx-ingress --namespace second-nginx --set controller.ingressClass=&quot;nginx-devices&quot;</code></p>
<p>How do i acheive the same thing with the <strong>ingress-nginx</strong></p>

floormind
<p>You need to define additional <code>controller.ingressClassResource.controllerValue</code> for the second ingress-nginx, so that when an ingress resource refer to this class, it knows which controller to engage.</p>
<pre><code>helm install nginx-ingress-devices ingress-nginx/ingress-nginx  \
  --namespace second-nginx \
  --set controller.ingressClassResource.name=second-nginx \
  --set controller.ingressClassResource.controllerValue=&quot;k8s.io/second-nginx&quot; \
  --set controller.ingressClassResource.enabled=true \
  --set controller.ingressClassByName=true
</code></pre>
