NGINX Ingress Controller
  • 23 Feb 2022
  • 2 Minutes to read
  • PDF

NGINX Ingress Controller

  • PDF

Article Summary

NGINX Ingress Controller is a specialized load balancer for Kubernetes environments. An Ingress Controller is a daemon that runs alongside NGINX community or plus version. The daemon monitors the NGINX Ingress resources for load balancing requests across services. The document explains configuring Traceable agent for NGINX Ingress Controller. The following diagram shows a high-level deployment of Traceable agent for NGINX Ingress Controller:


Before you begin

Before you begin installing and configuring Traceable agent, make sure:

  • NGINX Ingress Controller is installed. For example, you can install the latest version of NGINX Ingress Controller by entering the following command:
    ActionScript
    kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml

    For more information on installing NGINX Ingress Controller, see NGINX Ingress Controller Installation Guide.

  • Make sure that you have installed Traceable platform agent1.15.0 or later in Kubernetes environment. For more information, see Helm installation.
  • You should have basic understanding and knowledge of NGINX Ingress Controller.

Traceable configuration

To configure Traceable for NGINX Ingress Controller, you have to add the traceableai-inject-tme label to the namespace. The injected Traceable module extension (TME) creates SPANS and sends it to the Traceable Platform agent as shown in the deployment diagram above.

Add label

To add the namespace label for Traceable Module Extension (TME) injection, enter the following command:

ActionScript
kubectl label namespace ingress-nginx traceableai-inject-tme=enabled

TME automatically sets up the NGINX Ingress Lua plugin in the Ingress controller container. TME checks the pod labels to identify the NGINX Ingress Controller. In particular, the labels are:

app.kubernetes.io/component=controller
app.kubernetes.io/instance=ingress-nginx
app.kubernetes.io/name=ingress-nginx

You can additionally force the TME to set up the NGINX Ingress Controller Lua plugin by using a pod annotation. This should be set on the controller pod.

nginx.traceable.ai/inject: true 

Restart the deployment

Enter the following command to restart the deployment:

kubectl rollout restart deployment -n ingress-nginx ingress-nginx-controller

Verification

To verify that the installation was successful, check whether the sidecar was injected. Enter the following command and verify that the ingress-controller has two containers:

❯ kubectl get pod -n ingress-nginx

NAME                                       READY   STATUS      RESTARTS   AGE
ingress-nginx-admission-create-n88nn       0/1     Completed   0          26h
ingress-nginx-admission-patch-jrznd        0/1     Completed   0          26h
ingress-nginx-controller-5fb9c6b96-bs2v6   2/2     Running     0          25h

Upgrade

To upgrade the Traceable agent, make a note of the points mentioned in the Traceable agent installation, that is:

  • NGINX Lua plugin is setup as part of setup of Traceable agent.
  • Make sure that the Traceable agent version is 1.15.0 or later.

Enter the following command to upgrade the Traceable agent using Helm chart:

cd ./deployments/traceable-agent/helm
helm upgrade traceable-agent ./ -n traceableai --values ./values.yaml

Restart the deployment

Enter the following command to restart the deployment:

kubectl rollout restart deployment -n ingress-nginx ingress-nginx-controller

To verify a successful upgrade, repeat the steps mentioned in the Verification section. 


Uninstall

Uninstalling Traceable agent involves removing namespace label for TME and restarting the deployment. Complete the following steps:

  1. Remove the namespace label for Traceable Module Extension (TME) injection. Enter the following command:
    ActionScript
    kubectl label namespace ingress-nginx traceableai-inject-tme=enabled-
  2. Restart the deployment:
    ActionScript
    kubectl rollout restart deployment -n ingress-nginx ingress-nginx-controller
  3. Check whether the sidecar is no longer part of deployment. Verify that ingress-controller has one container:
    ActionScript
    ❯ kubectl get pod -n ingress-nginx
    NAME                                       READY   STATUS      RESTARTS   AGE
    ingress-nginx-admission-create-n88nn       0/1     Completed   0          26h
    ingress-nginx-admission-patch-jrznd        0/1     Completed   0          26h
    ingress-nginx-controller-5fb9c6b96-bs2v6   1/1     Running     0          25h
    

Was this article helpful?

What's Next