<h1>Infrastructure Background:</h1>
<p>I have 4 nodes in my Kubernetes (K3s) cluster.</p>
<pre><code>k3s-server location=home   (VM) maily used for etcd replication 
k3s-agent  location=home   (VM) runs most pods
mercury    location=home   (RPI4) backup for important pods
moon       location=cloud  (Cloud VM) runs certain workloads in a public cloud
</code></pre>
<p>I am running 2 different instances of the <code>ingress-nginx</code> helm chart in two namespaces. One to exposes local services at my home when <code>ingressClassName=nginx</code> using <code>loadBalancerIP: 192.168.113.230</code> running in the <code>nginx-ingres-home</code> namespace. The cloud controller uses <code>ingressClassName=nginx-cloud</code> with <code>loadBalancerIP: 91.x.x.x</code> and runs inside the <code>nginx-ingress-cloud</code> namespace. (Values for the Helm charts &amp; example Ingress below)</p>
<h1>The Problem</h1>
<p>I now have multiple Ingresses defined, which are using the different classes. However using <code>kubectl get ingress -A</code> provides the following output.</p>
<pre><code>NAMESPACE              NAME                   CLASS         HOSTS                        ADDRESS           PORTS     AGE
kubernetes-dashboard   kubernetes-dashboard   nginx         k3s.local.example.com        192.168.113.230   80, 443   4d3h
longhorn-system        longhorn-ingress       nginx         longhorn.local.example.com   192.168.113.230   80, 443   10d
mailu                  mailu                  nginx-cloud   mail.example.com             192.168.113.230   80, 443   2d23h
pihole                 pihole                 nginx         dns.local.example.com        192.168.113.230   80, 443   10d
ubiquiti               unifi-web-interface     nginx         unifi.local.example.com       192.168.113.230   80, 443   24h
</code></pre>
<p>You can see that regardless of the <code>ingressClassName</code> set in the Ingress, the addresses are always the ones from one of the ingress-controllers. The addresses are switching periodically. The logs of <code>nginx-ingress-home</code> show, that the controller permanently updates the addresses of the Ingresses (1m interval):</p>
<pre><code>I0510 19:46:12.087815       7 status.go:300] &quot;updating Ingress status&quot; namespace=&quot;pihole&quot; ingress=&quot;pihole&quot; currentValue=[{IP:91.x.x.x Hostname: Ports:[]}] newValue=[{IP:192.168.113.230 Hostname: Ports:[]}]
I0510 19:46:12.087857       7 status.go:300] &quot;updating Ingress status&quot; namespace=&quot;ubiquiti&quot; ingress=&quot;unifi-web-interface&quot; currentValue=[{IP:91.x.x.x Hostname: Ports:[]}] newValue=[{IP:192.168.113.230 Hostname: Ports:[]}]
I0510 19:46:12.088485       7 status.go:300] &quot;updating Ingress status&quot; namespace=&quot;mailu&quot; ingress=&quot;mailu&quot; currentValue=[{IP:91.x.x.x Hostname: Ports:[]}] newValue=[{IP:192.168.113.230 Hostname: Ports:[]}]
I0510 19:46:12.088782       7 status.go:300] &quot;updating Ingress status&quot; namespace=&quot;longhorn-system&quot; ingress=&quot;longhorn-ingress&quot; currentValue=[{IP:91.x.x.x Hostname: Ports:[]}] newValue=[{IP:192.168.113.230 Hostname: Ports:[]}]
I0510 19:46:12.090051       7 status.go:300] &quot;updating Ingress status&quot; namespace=&quot;kubernetes-dashboard&quot; ingress=&quot;kubernetes-dashboard&quot; currentValue=[{IP:91.x.x.x Hostname: Ports:[]}] newValue=[{IP:192.168.113.230 Hostname: Ports:[]}]
</code></pre>
<p>Of course the <code>nginx-ingress-cloud</code> does the same thing, just replacing <code>192.168.113.230</code> with <code>91.x.x.x</code>.</p>
<p>Does somebody know, how to stop them from &quot;taking owernship&quot; of all Ingresses and only updating the ones with the same IngressClass assigned?</p>
<h3>Configs</h3>
<h4>Values of nginx-ingress-home</h4>
<pre><code>controller:
  ingressClass: &quot;nginx&quot;
  ingressClassResource:
    name: nginx
    enabled: yes
    default: yes
  service:
    type: &quot;LoadBalancer&quot;
    loadBalancerIP: 192.168.113.230
  nodeSelector:
    location: home
  tolerations: #Allow running on backup nodes
    - key: &quot;backup&quot;
      operator: &quot;Equal&quot;
      value: &quot;true&quot;
      effect: &quot;NoSchedule&quot;
  affinity: #Prefer running on nodes labled type=power
    nodeAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
        - weight: 1
          preference:
            matchExpressions:
              - key: type
                operator: In
                values:
                  - power
</code></pre>
<h4>Values of nginx-ingress-cloud</h4>
<pre><code>controller:
  ingressClass: &quot;nginx-cloud&quot;
  ingressClassResource:
    name: nginx-cloud
    enabled: yes
    default: no
  service:
    type: &quot;LoadBalancer&quot;
    loadBalancerIP: 91.x.x.x
  nodeSelector:
    location: cloud
</code></pre>
<h4>Example home Ingress: Pihole</h4>
<pre><code>---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  ingressClassName: nginx
  tls:
    - hosts:
        - k3s.local.example.com
      secretName: kubernetes-dashboard-tls
  rules:
    - host: k3s.local.example.com
      http:
        paths:
          - backend:
              service:
                name: kubernetes-dashboard
                port:
                  number: 443

            path: /
            pathType: Prefix
</code></pre>

Florian7843
<p>With the help of a comment from <a href="https://stackoverflow.com/questions/76222260/kubernetes-ingress-controllers-fighting-over-address-in-ingress#comment134416606_76222260">Blender Fox</a> I was able to figure out the solution.</p>
<p>The <code>IngressClass</code> objects have the property <code>spec.controller</code>, which seems to be the value, for which a ingress controller looks, when choosing if the ingressClass is part of his set of classes. I was able to change that value in the Helm Chart, by setting the <code>controller.ingressClassResource.controllerValue</code> to different values. In my case I chose <code>k8s.io/ingress-nginx/nginx</code> and <code>k8s.io/ingress-nginx/nginx-cloud</code> instead of the default <code>k8s.io/ingress-nginx</code>.</p>
