<p>I have a Kubernetes cluster <code>v1.22.1</code> set up in bare metal CentOS. I am facing a problem when setting up Nginx Ingress controller following <a href="https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/" rel="noreferrer">this link</a>.</p>
<p>I followed exactly the same in step 1-3 but got a <code>CrashLoopBackOff</code> error in nginx ingress controller pod. I checked the logs of the pod and found below:</p>
<pre><code>[root@dev1 deployments]# kubectl logs -n nginx-ingress nginx-ingress-5cd5c7549d-hw6l7
I0910 23:15:20.729196       1 main.go:271] Starting NGINX Ingress controller Version=1.12.1 GitCommit=6f72db6030daa9afd567fd7faf9d5fffac9c7c8f Date=2021-09-08T13:39:53Z PlusFlag=false
W0910 23:15:20.770569       1 main.go:310] The '-use-ingress-class-only' flag will be deprecated and has no effect on versions of kubernetes &gt;= 1.18.0. Processing ONLY resources that have the 'ingressClassName' field in Ingress equal to the class.
F0910 23:15:20.774788       1 main.go:314] Error when getting IngressClass nginx: the server could not find the requested resource
</code></pre>
<p>I believe I have the IngressClass setup properly as shown in below:</p>
<pre><code>[root@dev1 deployments]# kubectl get IngressClass
NAME    CONTROLLER                     PARAMETERS   AGE
nginx   nginx.org/ingress-controller   &lt;none&gt;       2m12s
</code></pre>
<p>So I have no idea why it said Error when getting IngressClass nginx. Can anyone shed me some lights please?</p>

Steve
<h2>Reproduction and what happens</h2>
<p>I created a one node cluster using <code>kubeadm</code> on CentOS 7. And got the same error.</p>
<p>You and I were able to proceed further only because we missed this command at the beginning:</p>
<pre><code>git checkout v1.12.1
</code></pre>
<p>The main difference is <code>ingress-class.yaml</code> has <code>networking.k8s.io/v1beta1</code> in <code>v1.12.1</code> and <code>networking.k8s.io/v1</code> in <code>master</code> branch.</p>
<p>After I went here for the second time and switched the branch, I immediately saw this error:</p>
<pre><code>$ kubectl apply -f common/ingress-class.yaml
error: unable to recognize &quot;common/ingress-class.yaml&quot;: no matches for kind &quot;IngressClass&quot; in version &quot;networking.k8s.io/v1beta1&quot;
</code></pre>
<p>That looks like other resources are not updated to be used on kubernetes <code>v1.22+</code> yet.</p>
<p>Please <a href="https://kubernetes.io/docs/reference/using-api/deprecation-guide/#ingress-v122" rel="nofollow noreferrer">see deprecated migration guide - v1.22 - ingress</a></p>
<h2>How to proceed further</h2>
<ul>
<li><p>I tested exactly the same approach on a cluster with <code>v1.21.4</code> and it worked like a charm. So you may consider downgrading the cluster.</p>
</li>
<li><p>If you're not tight to using NGINX ingress controller (supported by <code>Nginx inc</code>, you can try <code>ingress nginx</code> which is developed by <code>kubernetes community</code>. I tested it on <code>v1.22</code>, it works fine. Please find
<a href="https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal" rel="nofollow noreferrer">Installation on bare metal cluster</a>.</p>
</li>
</ul>
<p>P.S. It may be confusing, but there are two free nginx ingress controllers which are developed by different teams. Also there's a third option - NGINX Plus which is paid and has more option. Please <a href="https://docs.nginx.com/nginx-ingress-controller/intro/nginx-ingress-controllers/" rel="nofollow noreferrer">see here the difference</a></p>
