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.
NOTE
The code files for this chapter are available at https://github.com/luksa/kubernetes-in-action-2nd-edition/tree/master/Chapter12.
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.
Definition
Ingress (noun)—The act of going in or entering; the right to enter; a means or place of entering; entryway.