</code></pre></div><h2id=what-has-caused-this-change-in-behaviour>What has caused this change in behaviour ?<aclass=headerlinkhref=#what-has-caused-this-change-in-behaviourtitle="Permanent link"> ¶</a></h2><p>There are 2 reasons primarily.</p><p>(Reason #1) Until K8s version 1.21, it was possible to create a ingress resource, with the "apiVersion:" field set to a value like:</p><ul><li>extensions/v1beta1</li><li>networking.k8s.io/v1beta1</li></ul><p>You would get a message about deprecation but the ingress resource would get created.</p><p>From K8s version 1.22 onwards, you can ONLY set the "apiVersion:" field of a ingress resource, to the value "networking.k8s.io/v1". The reason is <ahref=https://kubernetes.io/blog/2021/07/26/update-with-ingress-nginx/>official blog on deprecated ingress api versions</a>.</p><p>(Reason #2) When you upgrade to K8s version v1.22, while you are already using the Ingress-NGINX controller, there are several scenarios where the old existing ingress objects will not work. Read this FAQ to check which scenario matches your use case.</p><h2id=what-is-ingressclassname-field>What is ingressClassName field ?<aclass=headerlinkhref=#what-is-ingressclassname-fieldtitle="Permanent link"> ¶</a></h2><p>ingressClassName is a field in the specs of a ingress object.</p><p><divclass=highlight><pre><span></span><code>% k explain ingress.spec.ingressClassName
</code></pre></div> the spec.ingressClassName behavior has precedence over the annotation.</p><h2id=i-have-only-one-instance-of-the-ingresss-nginx-controller-in-my-cluster-what-should-i-do>I have only one instance of the Ingresss-NGINX controller in my cluster. What should I do ?<aclass=headerlinkhref=#i-have-only-one-instance-of-the-ingresss-nginx-controller-in-my-cluster-what-should-i-dotitle="Permanent link"> ¶</a></h2><ul><li>If you have only one instance of the Ingress-NGINX controller running in your cluster, and you still want to use ingressclass, you should add the annotation "ingressclass.kubernetes.io/is-default-class" in your ingress class, so any new Ingress objects will have this one as default ingressClass.</li></ul><p>In this case, you need to make your Controller aware of the objects. If you have several Ingress objects and they don't yet have the <ahref=https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#ingress-v1-networking-k8s-io>ingressClassName</a> field, or the ingress annotation (<code>kubernetes.io/ingress.class</code>), then you should start your ingress-controller with the flag <ahref="## What is the flag '--watch-ingress-without-class' ?">--watch-ingress-without-class=true</a> .</p><p>You can configure your helm chart installation's values file with <code>.controller.watchIngressWithoutClass: true</code>. </p><p>We highly recommend that you create the ingressClass as shown below: <divclass=highlight><pre><span></span><code>apiVersion: networking.k8s.io/v1
</code></pre></div> And add the value "spec.ingressClassName=nginx" in your Ingress objects</p><h2id=i-have-multiple-ingress-objects-in-my-cluster-what-should-i-do>I have multiple ingress objects in my cluster. What should I do ?<aclass=headerlinkhref=#i-have-multiple-ingress-objects-in-my-cluster-what-should-i-dotitle="Permanent link"> ¶</a></h2><ul><li>If you don't care about ingressClass, or you have a lot of ingress objects without ingressClass configuration, you can run the ingress-controller with the flag <code>--watch-ingress-without-class=true</code>.</li></ul><h2id=what-is-the-flag-watch-ingress-without-class>What is the flag '--watch-ingress-without-class' ?<aclass=headerlinkhref=#what-is-the-flag-watch-ingress-without-classtitle="Permanent link"> ¶</a></h2><ul><li>Its a flag that is passed,as an argument, to the ingress-controller executable, in the pod spec. It looks like this ; <divclass=highlight><pre><span></span><code>...
</code></pre></div></li></ul><h2id=i-have-more-than-one-controller-in-my-cluster-and-already-use-the-annotation>I have more than one controller in my cluster and already use the annotation ?<aclass=headerlinkhref=#i-have-more-than-one-controller-in-my-cluster-and-already-use-the-annotationtitle="Permanent link"> ¶</a></h2><p>No problem. This should still keep working, but we highly recommend you to test!</p><h2id=i-have-more-than-one-controller-running-in-my-cluster-and-i-want-to-use-the-new-spec>I have more than one controller running in my cluster, and I want to use the new spec ?<aclass=headerlinkhref=#i-have-more-than-one-controller-running-in-my-cluster-and-i-want-to-use-the-new-spectitle="Permanent link"> ¶</a></h2><p>In this scenario, you need to create multiple ingressClasses (see example one). But be aware that ingressClass works in a very specific way: you will need to change the .spec.controller value in your IngressClass and point the controller to the relevant ingressClass. Let's see some example, supposing that you have two Ingress Classes:</p><ul><li>Ingress-Nginx-IngressClass-1 with .spec.controller equals to "k8s.io/ingress-nginx1"</li><li>Ingress-Nginx-IngressClass-2 with .spec.controller equals to "k8s.io/ingress-nginx2"</li></ul><p>When deploying your ingress controllers, you will have to change the <code>--controller-class</code> field as follows:</p><ul><li>Ingress-Nginx-Controller-nginx1 with <code>k8s.io/ingress-nginx1</code></li><li>Ingress-Nginx-Controller-nginx2 with <code>k8s.io/ingress-nginx2</code></li></ul><p>Then, when you create an Ingress Object with IngressClassName = <code>ingress-nginx2</code>, it will look for controllers with <code>controller-class=k8s.io/ingress-nginx2</code> and as <code>Ingress-Nginx-Controller-nginx2</code> is watching objects that points to <code>ingressClass="k8s.io/ingress-nginx2</code>, it will serve that object, while <code>Ingress-Nginx-Controller-nginx1</code> will ignore the ingress object.</p><p>Bear in mind that, if your <code>Ingress-Nginx-Controller-nginx2</code> is started with the flag <code>--watch-ingress-without-class=true</code>, then it will serve:</p><ul><li>objects without ingress-class</li><li>objects with the annotation configured in flag <code>--ingress-class</code> and same class value</li><li>and also objects pointing to the ingressClass that have the same .spec.controller as configured in <code>--controller-class</code></li></ul><h2id=i-am-seeing-this-error-message-in-the-logs-of-the-ingress-nginx-controller-ingress-class-annotation-is-not-equal-to-the-expected-by-ingress-controller-why>I am seeing this error message in the logs of the Ingress-NGINX controller "ingress class annotation is not equal to the expected by Ingress Controller". Why ?<aclass=headerlinkhref=#i-am-seeing-this-error-message-in-the-logs-of-the-ingress-nginx-controller-ingress-class-annotation-is-not-equal-to-the-expected-by-ingress-controller-whytitle="Permanent link"> ¶</a></h2><ul><li>It is highly likely that you will also see the name of the ingress resource in the same error message. This error messsage has been observed on use the deprecated annotation, to spec the ingressClass, in a ingress resource manifest. It is recommended to use the ingress.spec.ingressClassName field, of the ingress resource, to spec the name of the ingressClass of the ingress resource being configured.</li></ul><h2id=how-to-easily-install-multiple-instances-of-the-ingress-nginx-controller-in-the-same-cluster>How to easily install multiple instances of the ingress-NGINX controller in the same cluster ?<aclass=headerlinkhref=#how-to-easily-install-multiple-instances-of-the-ingress-nginx-controller-in-the-same-clustertitle="Permanent link"> ¶</a></h2><ul><li>Create a new namespace <divclass=highlight><pre><span></span><code>kubectl create namespace ingress-nginx-2
</code></pre></div></li><li>Use helm to install the additional instance of the ingress controller</li><li>Ensure you have helm working (refer to helm documentation)</li><li>We have to assume that you have the helm repo for the ingress-NGINX controller already added to your helm config. But, if you have not added the helm repo then you can do this to add the repo to your helm config; <divclass=highlight><pre><span></span><code>helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
</code></pre></div></li><li>Now you install the additional instance of the ingress-NGINX controller like this ; <divclass=highlight><pre><span></span><code>helm install ingress-nginx-2 ingress-nginx/ingress-nginx \
</code></pre></div></li><li>If you need to install yet another instance, then repeat the procedure to create a new namespace, change the values like names & namespaces (for example from "-2" to "-3"), or anything else that meets your needs.</li></ul></article></div></div></main><footerclass=md-footer><divclass=md-footer-nav><navclass="md-footer-nav__inner md-grid"aria-label=Footer><ahref=how-it-works/class="md-footer-nav__link md-footer-nav__link--next"rel=next><divclass=md-footer-nav__title><divclass=md-ellipsis><spanclass=md-footer-nav__direction> Next </span> How it works </div></div><divclass="md-footer-nav__button md-icon"><svgxmlns=http://www.w3.org/2000/svgviewbox="0 0 24 24"><pathd="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg></div></a></nav></div><divclass="md-footer-meta md-typeset"><divclass="md-footer-meta__inner md-grid"><divclass=md-footer-copyright> Made with <ahref=https://squidfunk.github.io/mkdocs-material/target=_blankrel=noopener> Material for MkDocs </a></div></div></div></footer></div><scriptsrc=assets/javascripts/vendor.93c04032.min.js></script><scriptsrc=assets/javascripts/bundle.83e5331e.min.js></script><scriptid=__langtype=application/json>{"clipboard.copy":"Copy to clipboard","clipboard.copied":"Copied to clipboard","search.config.lang":"en","search.config.pipeline":"trimmer, stopWordFilter","search.config.separator":"[\\s\\-]+","search.placeholder":"Search","search.result.placeholder":"Type to start searching","search.result.none":"No matching documents","search.result.one":"1 matching document","search.result.other":"# matching documents","search.result.more.one":"1 more on this page","search.result.more.other":"# more on this page","search.result.term.missing":"Missing"}</script><script>