liveBook · Manning

Chapter 12: Using Ingress to route traffic to services

What you will learn in chapter 12 of Kubernetes in Action, Second Edition

Introduces Ingress as a way to expose multiple services through one public IP address while offering HTTP features beyond those of Services.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces Ingress as a way to expose multiple services through one public IP address while offering HTTP features beyond those of Services.

Key terms: Ingress object, LoadBalancer service type, public IP address

12.1 Introducing Ingresses

Introduces Ingress as a way for external clients to reach services in a Kubernetes cluster and distinguishes the components and proxy terminology involved.

Key terms: Ingress, Ingress API object, ingress controller, L7 load balancer, reverse proxy, backend services, forward proxy, backend servers, L4, L7

12.1.1 Introducing the Ingress object kind

This section introduces Ingress as a shared external entrypoint for services and explains how HTTP requests are routed to them.

Key terms: Ingress object, Service objects, L7 load balancer, HTTP reverse proxy, common entrypoint, rules, HTTP request, host, path, public DNS entries

12.1.2 Introducing the Ingress controller and the reverse proxy

Explains how an Ingress controller configures a reverse proxy from Kubernetes objects and how that proxy routes external HTTP requests to pod endpoints.

Key terms: Ingress controller, Ingress object, reverse proxy, cluster add-on, Kubernetes API server, Ingress, Service, Endpoints, EndpointSlice, L7 load balancer

12.1.3 Installing an ingress controller

Explains how to ensure an ingress controller is available before creating Ingresses, with setup considerations for managed, kind, and Minikube clusters.

Key terms: ingress controller, managed cluster, Nginx ingress controller, kind, Chapter12/create-kind-cluster.sh, ingress-ready=true, Minikube, minikube tunnel

12.2 Creating and using Ingress objects

Introduces the upcoming Kiada Ingress exercises and notes that the suite’s pods and services must be deployed first.

12.2.1 Exposing a service through an Ingress

Shows how to expose the kiada Service through an Ingress, find its public address, and send requests with the hostname needed for routing.

Key terms: Ingress object, Ingress rule, ClusterIP, Service, host, path, kubectl get ingresses, kubectl describe, Ingress IP address, ingress controller

12.2.2 Path-based ingress traffic routing

This section shows how one Ingress routes requests for the same host to different services by path and explains how each path type matches requests.

Key terms: Ingress, rule, paths, Service, backend, pathType, Exact, Prefix, path element, ImplementationSpecific

12.2.3 Using multiple rules in an Ingress object

This section shows how one Ingress can route requests to multiple Kiada services through multiple rules, and explains how wildcard hosts match.

Key terms: Ingress object, rules, public IP address, virtual hosts, Host header, backend services, requested path, host field, wildcards, exactly matches

12.2.4 Setting the default backend

This section shows how to configure an Ingress default backend to handle requests that match no rule, and why an Ingress can be useful even without rules.

Key terms: default backend, spec.defaultBackend, backend service, LoadBalancer, Transport Layer Security (TLS)

12.3 Configuring TLS for an Ingress

This section explains why the existing HTTP-only Ingress needs HTTPS support and identifies two places where TLS can be terminated.

Key terms: Ingress, HTTPS, ingress proxy, TLS connection, backend pod

12.3.1 Configuring the Ingress for TLS passthrough

This subsection explains that TLS passthrough is configured in a controller-specific way rather than through a standard Ingress setting.

Key terms: TLS passthrough, Ingress object, annotations, Nginx ingress controller, --enable-ssl-passthrough

12.3.2 Terminating TLS at the Ingress

This section explains how an Ingress proxy terminates client TLS connections and how to configure the certificate and key it uses.

Key terms: TLS termination, ingress proxy, backend pod, Secret, tls, secretName, tls.hosts, tls.crt, tls.key

12.4 Additional Ingress configuration options

The section explains why the Ingress spec has few built-in configuration options and how ingress controllers provide additional, implementation-specific options.

Key terms: Ingress object’s schema, annotations, custom Kubernetes API objects, ingress controller, kubectl explain, spec, defaultBackend, rules, tls, ingressClassName

12.4.1 Configuring the Ingress using annotations

This section explains why the Nginx ingress controller can provide cookie-based session affinity, how to enable it with annotations, and how to observe it in requests.

Key terms: nginx.ingress.kubernetes.io/affinity, nginx.ingress.kubernetes.io/session-cookie-name, cookie-based session affinity, Nginx ingress controller, client IP-based session affinity, layer 4, layer 7, Ingress, Cookie header, session affinity

12.4.2 Configuring the Ingress using additional API objects

Shows how GKE uses a BackendConfig object to add Ingress configuration, using cookie-based session affinity as an example.

Key terms: BackendConfig, cloud.google.com/backend-config, GENERATED_COOKIE, cookie-based session affinity, Service, Ingress

12.5 Using multiple ingress controllers

Explains why a cluster may use multiple ingress controllers and how an IngressClass connects each Ingress to the controller that processes it.

Key terms: ingress implementations, ingress controllers, Ingress object, IngressClass, spec, controller, optional parameters, kubernetes.io/ingress.class annotation

12.5.1 Introducing the IngressClass object kind

This section shows how to find IngressClass objects and read which ingress controller an existing class identifies.

Key terms: IngressClass, nginx, k8s.io/ingress-nginx, controller parameters

12.5.2 Specifying the IngressClass in the Ingress object

This subsection explains how an Ingress selects an IngressClass explicitly or uses the cluster’s default class.

Key terms: ingressClassName, IngressClass, controller, default IngressClass, ingressclass.kubernetes.io/is-default-class

12.5.3 Adding parameters to an IngressClass

This section explains how an IngressClass can reference controller-specific parameters to provide different ingress configurations, even with a single controller.

Key terms: IngressClass, IngressClassParams, ingressClassName, ingress controller

12.6 Using custom resources instead of services as backends

This section explains that some ingress controllers accept resources other than Services as Ingress backends, most commonly to configure advanced routing through a custom resource.

Key terms: Ingress, Service objects, resource backends, custom resource, ingress controller

12.6.1 Using a custom object to configure Ingress routing

Shows how an Ingress can delegate HTTP routing to a custom resource instead of naming a Service as its backend.

Key terms: Citrix ingress controller, HTTPRoute, resource backend, kind, apiGroup, name

12.7 Summary

Summarizes how Ingress exposes multiple services through a controller-managed Layer 7 proxy, routes HTTP requests, and supports TLS and controller-specific configuration.

Where this is used later

Concepts explained in this chapter

← Chapter 11: Exposing pods with services Chapter 13: Routing traffic using the Gateway API →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.