Updated on 2024-04-23 GMT+08:00

nginx-ingress Upgrade

Check Items

  • Check whether there is an Nginx ingress route whose ingress type is not specified (kubernetes.io/ingress.class: nginx is not added to annotations) in the cluster.

Fault Locating

For an Nginx ingress, check the YAML. If the ingress type is not specified in the YAML file and the ingress is managed by the Nginx Ingress Controller, the ingress is at risk.

  1. Check the Ingress type.

    Run the following command:
    kubectl get ingress <ingress-name> -oyaml | grep -E ' kubernetes.io/ingress.class: | ingressClassName:'
    • Fault scenario: If the command output is empty, the Ingress type is not specified.
    • Normal scenario: The command output is not empty, indicating that the Ingress type has been specified by annotations or ingressClassName.

  2. Ensure that the Ingress is managed by the Nginx Ingress Controller. The LoadBalancer Ingresses are not affected by this issue.

    • For clusters of v1.19, confirm this issue using managedFields.
      kubectl get ingress <ingress-name> -oyaml | grep 'manager: nginx-ingress-controller'

    • For clusters of other versions, check the logs of the Nginx Ingress Controller pod.
       kubectl logs -nkube-system cceaddon-nginx-ingress-controller-545db6b4f7-bv74t | grep 'updating Ingress status'

    If the fault persists, contact technical support personnel.

Solution

Add an annotation to the Nginx ingresses as follows:

kubectl annotate ingress <ingress-name> kubernetes.io/ingress.class=nginx

There is no need to add this annotation to LoadBalancer ingresses. Verify that these ingresses are managed by Nginx Ingress Controller.