Kubernetes is an open-source platform that automates the deployment, scaling, and operations of application containers. Kubernetes routes network traffic through the use of ingress controllers which are Kubernetes objects that tell Kubernetes the type of routing the cluster should do for external requests.
In this post, I will discuss how Kubernetes handles external requests by looking at three different types of Kubernetes ingress controllers: NodePort, LoadBalancer and ExternalName.
NodePort Ingress Controller: Kubernetes routes network traffic to services on nodes in the cluster by creating a port on every node that is exposed to the outside world. This type of ingress controller is useful for clusters that do not have a load balancer or public IP address. The NodePort ingress controller creates a new service for every Kubernetes deployment and maps the port on each node to the service. Kubernetes then uses routing rules to determine which nodes should receive traffic for a particular service.
LoadBalancer Ingress Controller: A load balancer ingress controller directs network traffic to services in a Kubernetes cluster by creating a new service for every Kubernetes deployment and mapping the load balancer’s IP address to the services. Kubernetes then uses routing rules to determine which nodes should receive traffic for a particular service. This type of ingress controller is useful for clusters that have a public IP address or need to load balance traffic across multiple Kubernetes services.
ExternalName Ingress Controller: Kubernetes uses an external name type controller, which is not yet supported in Kubernetes v.0.20, to route traffic based on the value of a custom URL parameter (e.g., app=web). This ingress controller allows users to use their own load balancers or public IP addresses to route traffic. Kubernetes uses a URL map, which tells Kubernetes how to translate the custom URL parameter into a port on each node that is exposed to the outside world. Kubernetes then routes external requests directly to nodes with matching ports using routing rules.