Member-only story
How does ingress work in Kubernetes?
And how to set up ingress in minikube
Why Do We Need Ingress?
Some pods will require user input of some kind to interact with the running container.
An example of this might be a web application. Without the user being able to browse the application in their web browser, the application is useless.
Within Kubernetes, setting up access to a pod from outside is referred to as Ingress. Ingress allows you to manage traffic and routing rules via a resource that is running as part of your cluster or via an external offering such as a load balancer, which is then also managed from within the cluster.
An Ingress resource is essentially a collection of rules for routing that allow or deny users access to services running within a cluster.
Currently, there are three ways to handle Ingress with Kubernetes:
- Ingress controllers
- Node port
- Load balancer
Ingress Controllers
Ingress refers to the abstraction of ingress, which essentially is a third-party proxy running inside a pod and that handles routing, usually based on the URL path or header routing.
The major players in the proxy space have implementations of Ingress controllers such as nginx and HAProxy, and there are others that have gained popularity as Kubernetes has matured, such as Traefik and Contour.
Node Port
A Node Port is essentially a port on your cluster that Kubernetes routes incoming traffic from to your pod. Node port ports usually are within the range of 30000 to 32767, the downside being that this is a non-standard port for traffic such as HTTP and HTTPS. You can edit the ports, but generally, it’s good to look at other options if you are headed down this road.
The idea of node port is that it is easy to use for development purposes, but should really be used in conjunction with something else (such as a load balancer sitting above it) if using anything more important than development.