CodeBlanks Logo Icon CodeBlanks

Ingress controller

Learn what an Ingress controller is.

Ingress controller

An Ingress controller is a pod that watches Ingress objects and updates its own proxy configuration (nginx, Envoy, HAProxy). It isn't in the cluster by default; it must be installed. Common options: ingress-nginx, Traefik, HAProxy, the cloud providers' own controllers.

# Minikube
minikube addons enable ingress
# in general (with Helm)
helm install ingress-nginx ingress-nginx/ingress-nginx -n ingress-nginx --create-namespace
kubectl get pods -n ingress-nginx

IngressClass

A cluster can have several controllers. An IngressClass defines each controller with a name; an Ingress chooses which one processes it with spec.ingressClassName. One can be marked as the default:

$ kubectl get ingressclass
NAME    CONTROLLER             PARAMETERS   AGE
nginx   k8s.io/ingress-nginx   <none>       3d

spec:
  ingressClassName: nginx

Practice Install the controller

Write three commands: enable the ingress add-on in Minikube; list the pods in the ingress-nginx namespace; list the IngressClasses.

Starter code

terminal
# buraya yaz

Sample solution

terminal
minikube addons enable ingress
kubectl get pods -n ingress-nginx
kubectl get ingressclass

Expected output

🌟  The 'ingress' addon is enabled
NAME                                        READY   STATUS      RESTARTS   AGE
ingress-nginx-controller-7c6974c4d8-x9k2m   1/1     Running     0          60s
NAME    CONTROLLER             PARAMETERS   AGE
nginx   k8s.io/ingress-nginx   <none>       60s

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What happens if you create an Ingress without a controller installed?

  • Kubernetes installs the controller itself
  • The services are deleted
  • The object is saved but no traffic is routed Correct answer
  • It errors

Explanation: An Ingress is a request; the software fulfilling it must run separately.

2 Choose which controller processes it.

Question
spec:
  ____: nginx
Answer
spec:
  ingressClassName: nginx

Explanation: ingressClassName is the name of an IngressClass.

3 Match.

Term Meaning
ingress-nginx nginx-based controller
Traefik Another controller
IngressClass Controller definition
ingressClassName The Ingress's choice

All lessons in Advanced