chapter twelve

12 Using Ingress to route traffic to services

 

This chapter covers

  • Creating Ingress objects
  • Ingress controllers and how to deploy them
  • Securing Ingresses with Transport Layer Security
  • Adding additional configuration to an Ingress
  • Using IngressClasses when multiple controllers are installed
  • Using Ingresses with nonservice backends

In the previous chapter, you learned how to use the Service object to expose a group of pods at a stable IP address. If you use the LoadBalancer service type, the service is made available to clients outside the cluster through a load balancer. This approach is fine if you only need to expose a single service externally, but it becomes problematic when the number of services is large, since each service needs its own public IP address.

Fortunately, when exposing these services through an Ingress object, you only need a single IP address. Additionally, the Ingress provides other features such as HTTP authentication, cookie-based session affinity, URL rewriting, and others that Service objects can’t.

12.1 Introducing Ingresses

Before I explain what an Ingress is in the Kubernetes context, defining the general term ingress may help readers who are not native speakers of English.

12.1.1 Introducing the Ingress object kind

12.1.2 Introducing the Ingress controller and the reverse proxy

12.1.3 Installing an ingress controller

12.2 Creating and using Ingress objects

12.2.1 Exposing a service through an Ingress

12.2.2 Path-based ingress traffic routing

12.2.3 Using multiple rules in an Ingress object

12.2.4 Setting the default backend

12.3 Configuring TLS for an Ingress

12.3.1 Configuring the Ingress for TLS passthrough

12.3.2 Terminating TLS at the Ingress

12.4 Additional Ingress configuration options

12.4.1 Configuring the Ingress using annotations