Search code examples
kubernetesnginx-ingressingress-nginx

Does ingress-nginx-controller have to be present on every node?


I installed ingress-nginx to my cluster like that:

helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace --set controller.service.loadBalancerIP=REDACTED --set controller.service.externalTrafficPolicy=Local

Initially, my cluster had only one node, but now I added another. I see that ingress-nginx-controller deployment is present only on the first node - shouldn't it be present on every node though? What should I do about it?


Solution

  • No, the nginx controller does not need to be present on every node in your k8s cluster for a helm upgrade.

    During a helm upgrade the helm charts only modifies the existing deployment or Daemonset configuration; it does not impact the number of nginx ingress controller pods running in the cluster.

    If you want ingress-nginx-controller deployment to be present on every node though you can use the daemonset or if you want to make sure Nginx ingress controller POD only runs on nodes on which your backend service is running, you can use affinity and anti-affinity.

    If you want multiple Ingress Controllers to coexist in one cluster you can ingress class concepts.

    The Ingress class has the following characteristics:

    1. Every Ingress Controller must only handle Ingress resources for its particular class.

    2. Ingress resources need to have the ingressClassName field set to the value of the class of the Ingress Controller the user wants to use.

    3. VirtualServer, VirtualServerRoute, Policy, and TransportServer resources need to have the ingressClassName field set to the value of the class of the Ingress Controller the user wants to use.

    You can also refer to this link on Installation with helm for more information.