Ingress-nginx

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

The default nginx-based implementation of a Kubernetes ingress controller. It is build around the Ingress API resource and uses a ConfigMap to store the nginx configuration. The ingress-nginx ingress controller watches Ingress objects from all namespaces. It can be restricted to watch a specific namespace with --watch-namespace.

Installation

https://kubernetes.github.io/ingress-nginx/deploy/

Vendor-Specific

Docker Desktop Kubernetes

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

This deploys ingress-nginx in an "ingress-nginx" namespace. It creates dedicated service accounts, configmap, roles, service, deployment, validating webhook, and jobs to create the SSL certificate used by the admission webhook.

Installation with Helm

https://kubernetes.github.io/ingress-nginx/deploy/#using-helm

Note that by default, the ingress controller is installed in the default namespace.

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

Installation Validation

kubectl -n ingress-nginx get pods

NAME                                        READY   STATUS      RESTARTS   AGE
ingress-nginx-controller-5947756d78-gnvft   1/1     Running     0          4m44s

Operations

Controller Version

Exec into the pod and run:

POD_NAMESPACE=ingress-nginx
POD_NAME=$(kubectl get pods -n $POD_NAMESPACE -l app.kubernetes.io/name=ingress-nginx --field-selector=status.phase=Running -o jsonpath='{.items[0].metadata.name}')
kubectl exec -it $POD_NAME -n $POD_NAMESPACE -- /nginx-ingress-controller --version