How To Install or Upgrade NGINX Ingress Controller
  • 20 Nov 2023
  • 3 Minutes to read
  • Dark
    Light

How To Install or Upgrade NGINX Ingress Controller

  • Dark
    Light

Article summary

Background

RealTheory can notify you if NGINX Ingress Controller is a required component in your environment that is not present on your cluster or if the version of NGINX Ingress Controller that is installed is not in compliance with organizational standards.

Solution - Installation

If NGINX Ingress Controller is a required component in your Kubernetes environment, it is most likely that a Helm chart or the manifest file needed for the installation already exist. Contact your Operations or DevOps team to determine if there are company resources for installing NGINX Ingress Controller BEFORE using either of the following procedures.

Procedure Using HELM Chart Package Manager

To install NGINX Ingress Controller:

  1. Use the Helm Installation Guide to install Helm (if not already installed).

  2. Use the following commands to add the NGINX Helm repository:

    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx

    helm repo update

  3. Create a namespace for NGINX Ingress Controller.

    Example:

    kubectl create namespace ingress-nginx

  4. Do one of the following:

    • To install the latest version, use the following command:

      helm install ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx

    • To install a specific version, use the following command:

      helm install ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx --version <version>

      where <version> is the version number of the NGINX Ingress Controller you want to install.

  5. Verify the NGINX Ingress Controller pods are running:

    kubectl get pods -n ingress-nginx

  6. Obtain the external IP or hostname assigned to the Ingress Controller service:

    kubectl get services -n ingress-nginx

  7. Verify that the NGINX Ingress Controller is accessible by opening a web browser or using a tool like curl or wget to access the external IP or hostname:

    Example:

    curl http://<external-ip>

    where <external-ip> is the external IP or hostname obtained in Step 6.

Procedure Using the YAML Manifest

To install NGINX Ingress Controller:

  1. Create a namespace for the NGINX Ingress Controller.

    Example:

    kubectl create namespace ingress-nginx

  2. Apply the default backend deployment and service, which handle requests that are not matched by any Ingress rules.

    kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml

  3. Verify the NGINX Ingress Controller pods are running:

    kubectl get pods -n ingress-nginx

  4. If you are using Minikube or Kind, you might need to expose the service to an external IP:

    kubectl expose deployment ingress-nginx-controller --type=NodePort --name=ingress-nginx-controller --namespace=ingress-nginx

  5. Obtain the external IP or hostname assigned to the Ingress Controller service:

    kubectl get services -n ingress-nginx

    Note: If you are using Minikube or Kind, you can use the Minikube or Kind IP as the external IP.

  6. Verify that the NGINX Ingress Controller is accessible by opening a web browser or using a tool like curl or wget to access the external IP or hostname:

    Example:

    curl http://<external-ip>

    where <external-ip> is the external IP or hostname obtained in Step 5.

Solution - Upgrade

If a specific version of NGINX Ingress Controller is required in your Kubernetes environment, it is most likely that a Helm chart or the manifest files already exist. Contact your Operations or DevOps team to determine if there are company resources for installing NGINX Ingress Controller BEFORE using either of the following procedures.

Procedure Using HELM Chart Package Manager

To upgrade NGINX Ingress Controller:

  1. Use the Helm Installation Guide to install Helm (if not already installed).

  2. Do one of the following:

    • To upgrade to the latest version, use the following command:

      helm upgrade ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx

    • To upgrade to a specific version, use the following command:

      helm upgrade <release-name> ingress-nginx/ingress-nginx --namespace ingress-nginx --version <version>

      where <release-name> is the name of your NGINX Ingress Controller release and <version> is the version number of the NGINX Ingress Controller you want to upgrade to.

  3. Verify the NGINX Ingress Controller pods are running and have been updated:

    kubectl get pods -n ingress-nginx

Procedure Using YAML Manifest

To upgrade NGINX Ingress Controller:

  1. Obtain the manifests for the version you want to upgrade to from the NGINX Ingress Controller GitHub releases page

    export NGINX_VERSION=<version>

    curl -O https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml

    where <version> is the version number of the NGINX Ingress Controller you want to upgrade to.

  2. Apply the updated manifests:

    kubectl apply -f deploy.yaml

  3. Verify the NGINX Ingress Controller pods are running and have been updated:

    kubectl get pods -n ingress-nginx

  4. Remove the previous NGINX Ingress Controller resources, such as the deployment and service, if they exist:

    kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml


Was this article helpful?