Step 1: Install Ingress Controller
An Ingress Controller is a component that manages the inbound traffic into a Kubernetes Cluster. While the Ingress Controller is an implementation (e.g. nginx or traefik), Kubernetes provides a standardized interface (Object Type) to configure it. Therefore, the Ingress Controller is the piece of software you install, and the Ingress Object the configuration for it.
One of the most commonly used Ingress Controllers in Kubernetes is ingress-nginx. You will find many others out there, sometimes also the ones from your cloud provider. Each of them has its pros and cons, many documentations for ecosystem projects deal with nginx, therefore it is often a safe choice.
Especially when multi-cloud is a requirement for you, the Ingress Controller is one of the components you might want to pay more attention to. Although, the Ingress Object is standardized, there are often many implementation-specific annotations that might have an impact on portability.
Installing ingress-nginx is very straightforward. For our Lab, we will use the Helm Chart which can be installed using the following commands:
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install ingress-nginx -n ingress-nginx --wait --create-namespace ingress-nginx/ingress-nginx
As we will use this mechanism more often, let's take a closer look at the two commands.
The first command makes the package manager aware of the repository (https://kubernetes.github.io/ingress-nginx) where the ingress-nginx charts can be found. This will be known as ingress-nginx to the package manager. The second command installs the latest version of the ingress-nginx chart from the ingress-nginx repository (ingress-nginx/ingress-nginx). It will install it in the namespace ingress-nginx (-n ingress-nginx) which will also get created if it doesn't exist (--create-namespace). Finally, it will wait until everything is running.
After the installation succeeded, the ingress-nginx is available in your cluster. You can verify this by taking a look on the IngressClasses of your cluster:
kubectl get ingressclass
There, you should see a new IngressClass called nginx and the output should look like this:
NAME CONTROLLER PARAMETERS AGE
nginx k8s.io/ingress-nginx <none> 52m
Furthermore, you should see some running pods in your ingress-nginx namespace, and the LoadBalancer Service of your nginx should have got an external IP address (if you use a cluster able to deal with LoadBalancer Services). Therefore kubectl get all should give you an output similar to this:
NAME READY STATUS RESTARTS AGE
pod/ingress-nginx-controller-6bd87498ff-vfxgz 1/1 Running 0 53m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/ingress-nginx-controller LoadBalancer 10.100.136.201 138.124.209.109 80:31104/TCP,443:31410/TCP 53m
service/ingress-nginx-controller-admission ClusterIP 10.104.128.16 <none> 443/TCP 53m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/ingress-nginx-controller 1/1 1 1 53m
NAME DESIRED CURRENT READY AGE
replicaset.apps/ingress-nginx-controller-6bd87498ff 1 1 1 53m
You installed an Ingress Controller which will help you managing traffic into your Kubernetes Cluster. In the following steps, we'll build functionalities on top of the Ingress Controller, as DNS and Certificates.
Now that our Ingress Controller is running, we will be able to work with external-dns and cert-manager. It would also be possible to do this with other Service Types and the Gateway API, but this is the most common implementation you will find in the real world. But before, we dive deeper into these topics, let's prepare another pre-requisite for our lab, OpenBao.
