<p>After upgrading Kubernetes node pool from 1.21 to 1.22, ingress-nginx-controller pods started crashing. The same deployment has been working fine in EKS. I'm just having this issue in GKE. Does anyone have any ideas about the root cause?</p>
<p><code>$ kubectl logs ingress-nginx-controller-5744fc449d-8t2rq -c controller</code></p>
<pre><code>-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:       v1.3.1
  Build:         92534fa2ae799b502882c8684db13a25cde68155
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: nginx/1.19.10

-------------------------------------------------------------------------------

W0219 21:23:08.194770       8 client_config.go:617] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0219 21:23:08.194995       8 main.go:209] &quot;Creating API client&quot; host=&quot;https://10.1.48.1:443&quot;
</code></pre>
<p>Ingress pod events:</p>
<pre><code>Events:
  Type     Reason             Age                  From               Message
  ----     ------             ----                 ----               -------
  Normal   Scheduled          27m                  default-scheduler  Successfully assigned infra/ingress-nginx-controller-5744fc449d-8t2rq to gke-infra-nodep-ffe54a41-s7qx
  Normal   Pulling            27m                  kubelet            Pulling image &quot;registry.k8s.io/ingress-nginx/controller:v1.3.1@sha256:54f7fe2c6c5a9db9a0ebf1131797109bb7a4d91f56b9b362bde2abd237dd1974&quot;
  Normal   Started            27m                  kubelet            Started container controller
  Normal   Pulled             27m                  kubelet            Successfully pulled image &quot;registry.k8s.io/ingress-nginx/controller:v1.3.1@sha256:54f7fe2c6c5a9db9a0ebf1131797109bb7a4d91f56b9b362bde2abd237dd1974&quot; in 6.443361484s
  Warning  Unhealthy          26m (x6 over 26m)    kubelet            Readiness probe failed: HTTP probe failed with statuscode: 502
  Normal   Killing            26m                  kubelet            Container controller failed liveness probe, will be restarted
  Normal   Created            26m (x2 over 27m)    kubelet            Created container controller
  Warning  FailedPreStopHook  26m                  kubelet            Exec lifecycle hook ([/wait-shutdown]) for Container &quot;controller&quot; in Pod &quot;ingress-nginx-controller-5744fc449d-8t2rq_infra(c4c166ff-1d86-4385-a22c-227084d569d6)&quot; failed - error: command '/wait-shutdown' exited with 137: , message: &quot;&quot;
  Normal   Pulled             26m                  kubelet            Container image &quot;registry.k8s.io/ingress-nginx/controller:v1.3.1@sha256:54f7fe2c6c5a9db9a0ebf1131797109bb7a4d91f56b9b362bde2abd237dd1974&quot; already present on machine
  Warning  BackOff            7m7s (x52 over 21m)  kubelet            Back-off restarting failed container
  Warning  Unhealthy          2m9s (x55 over 26m)  kubelet            Liveness probe failed: HTTP probe failed with statuscode: 502
</code></pre>

cosmos-1905-14
<p>The Beta API versions (<code>extensions/v1beta1 and networking.k8s.io/v1beta1</code>) of <code>Ingress</code> are no longer served (removed) for GKE clusters created on versions 1.22 and later. Please refer to the official <a href="https://cloud.google.com/kubernetes-engine/docs/deprecations/apis-1-22#ingress-v122" rel="nofollow noreferrer">GKE ingress documentation</a> for changes in the GA API version.</p>
<p>Also refer to Official Kubernetes documentation for <a href="https://kubernetes.io/blog/2021/07/14/upcoming-changes-in-kubernetes-1-22/#api-changes" rel="nofollow noreferrer">API removals for Kubernetes v1.22</a> for more information.</p>
<p>Before upgrading your Ingress API as a client, make sure that every ingress controller that you use is compatible with the v1 Ingress API. See <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#prerequisites" rel="nofollow noreferrer">Ingress Prerequisites</a> for more context about Ingress and ingress controllers.</p>
<p><strong>Also check below possible causes for Crashloopbackoff :</strong></p>
<ol>
<li><p>Increasing the <code>initialDelaySeconds</code> value for the livenessProbe setting may help to alleviate the issue, as it will give the container more time to start up and perform its initial work operations before the liveness probe server checks its health.</p>
</li>
<li><p>Check <code>“Container restart policy”</code>, the spec of a Pod has a restartPolicy field with possible values Always, OnFailure, and Never. The default value is Always.</p>
</li>
<li><p><strong>Out of memory or resources :</strong> Try to increase the VM size. Containers may crash due to memory limits, then new ones spun up, the health check failed and Ingress served up 502.</p>
</li>
<li><p>Check <code>externalTrafficPolicy=Local</code> is set on the NodePort service will prevent nodes from forwarding traffic to other nodes.</p>
</li>
</ol>
<p>Refer to the Github issue <a href="https://github.com/kubernetes/ingress-gce/issues/34" rel="nofollow noreferrer">Document how to avoid 502s #34</a> for more information.</p>
