liveBook · Manning

Ingress controller

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

An ingress controller is a Kubernetes component that implements Ingress routing rules for external access to services.

An ingress controller implements Ingress rules that route external HTTP and HTTPS requests to Services inside a Kubernetes cluster. The Ingress resource declares which hostname or path reaches each Service; the controller interprets those rules. Install a controller as well as creating an Ingress—rules alone do not provide the routing component. section 6.3

For an exam-style setup, work from the controller to a verified request:

  • Apply an ingress-nginx controller manifest, then run `kubectl -n ingress-nginx get all`. Check that the controller Deployment and pod are ready and that its Service exists. section 6.3
  • Create a workload and its Service: `kubectl create deploy hello --image nginxdemos/hello:plain-text --port 80`, then `kubectl expose deploy hello --name hello-svc --port 80`. Use `kubectl get deploy,svc` to check the Deployment and ClusterIP Service. section 6.3
  • Create an Ingress whose `hello.com` rule sends `/` to `hello-svc` on port 80. Check its host with `kubectl get ing`. After arranging hostname resolution to the reachable node address, use `curl hello.com` to verify that the workload responds. section 6.3

One Ingress, two destinations

A `networking.k8s.io/v1` Ingress can route `hello.com/` to `hello-svc:80` and `app.hello.com/` to a different Service, `nginx:8080`. Rules can also distinguish request paths: `Prefix` matches URL prefixes, while `Exact` matches the specified path. Check the host and path before troubleshooting the backend Service. section 6.3

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hello
spec:
  rules:
  - host: hello.com
    http:
      paths:
      - pathType: ImplementationSpecific
        path: "/"
        backend:
          service:
            name: hello-svc
            port:
              number: 80
  - host: app.hello.com
    http:
      paths:
      - pathType: Exact
        path: "/"
        backend:
          service:
            name: nginx
            port:
              number: 8080

Inspect the Ingress manifest for the host, path type, backend Service name and port in each rule. section 6.3

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Works through controller installation, backend creation, Ingress configuration and request verification without detailing controller internals.
Examples
Uses an ingress-nginx installation, a hello Deployment and ClusterIP Service, a two-host Ingress manifest and a curl check.
What it assumes
Assumes familiarity with Services before forwarding Ingress traffic to them, while walking through the controller and workload setup.
What you can do after
Operate/configure it by installing a controller, defining Service-backed Ingress rules and verifying external requests.
How it connects
Connects Ingress, Services, Deployments, DNS resolution and HTTP host- and path-based routing.

Also explained in

Compare how 4 books explain ingress controller →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.