AKS: Nginx ingress pod stuck in `Pending` state due to nodeSelector

10/17/2019

Today I have deployed AKS service in Azure cloud and tried to start test services on it, however faced an error that Ingress pod stuck in Pending state because of the following:

0/2 nodes are available: 2 node(s) didn't match node selector.

I have checked nodeSelector for Nginx ingress:

  nodeSelector:
    kubernetes.io/os: linux

To fix the issue I have removed nodeSelector from deployment and now everything work as expected.

Below evidence that I'm using correct OS on my Kubernetes nodes:

enter image description here

Ingress version is 0.26.1 - deployed using manifests from github.

So, it is clear how to fix the issue, but what is a root cause here? Is it bug or knowledge gap?

-- DariyN
azure-aks
kubernetes
kubernetes-ingress
nginx-ingress

2 Answers

10/17/2019

I think it would be a better solution to have labeled the nodes:

kubectl label node --all kubernetes.io/os=linux

-- suren
Source: StackOverflow

10/17/2019

I'm using Kubernetes version 1.13.10.

Starting from Kubernetes version 1.16, beta.kubernetes.io/os has been deprecated and now actual one is kubernetes.io/os. So, ingress uses parameters in accordance with latest Kubernetes release.

To permanently fix the issue, it is required to use beta.kubernetes.io/os parameter in version of kubernetes lower than 1.16.

Kuberentes 1.16 release notes.

I have added patch into my pipeline to fix the issue:

kubectl patch deployment nginx-ingress-controller -p '{"spec":{"template":{"spec":{"nodeSelector":{"beta.kubernetes.io/os":"linux"}}}}}
-- DariyN
Source: StackOverflow