Context-based routing
Often, we want to configure context-based routing for our Kubernetes cluster. Kubernetes offers us various ways to do this. The preferred and most scalable way currently is to use IngressController. The following diagram tries to illustrate how this ingress controller works:
Figure 16.24 – Context-based routing using a Kubernetes ingress controller
In the preceding diagram, we can see how context-based (or layer 7) routing works when using an IngressController, such as Nginx. Here, we have the Deployment of an application service called web. All the pods of this application service have the following label: app=web. Then, we have a Kubernetes Service called web that provides a stable endpoint to those pods. The Service has a VIP of 52.14.0.13 and exposes a 30044 port. That is, if a request comes to any node of the Kubernetes cluster for the name web and 30044 port, then it is forwarded to this Service. The Service then load...