In this article, we'll guide you through the step-by-step process of setting up and configuring the Nginx Ingress Controller to efficiently manage external access to your containerized applications.
You can find source code in our Github repo
Prerequisites:
- Kubernetes Cluster: You'll need a running Kubernetes cluster. If you don't have one, follow our guide on creating an EKS cluster using Terraform to set up a Kubernetes cluster on AWS Elastic Kubernetes Service (EKS)
- Kubectl: Ensure that you have kubectl installed on your local machine to interact with your Kubernetes cluster. You can install it following the instructions in the official Kubernetes documentation.
- Helm: Helm is a package manager for Kubernetes that we'll use to install the Nginx Ingress Controller. Install Helm by following the steps outlined in the Helm documentation.
Connecting to our EKS Cluster
To update kubeconfig file for your cluster use:
aws eks --region <YOUR_CLUSTER_REGION> update-kubeconfig --name <YOUR_CLUSTER_NAME> --profile <YOUR_PROFILE_NAME>
Then we can check if we can connect to our cluster:
kubectl get no
We would have output with all nodes in our cluster
Installing NGINX Ingress Controller
In order to search for available chart versions you can run:
helm search repo ingress-nginx/ingress-nginx --versions
For the latest version of Ingress NGINX Helm Chart visit this GitHub repo
In order to install selected chart run:
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx --create-namespace --version 4.8.1
To check if it is installed and running you can run:
kubectl get service -A
In your output after a while you should see your Load Balancer address in External Ip field
TYPE NAME EXTERNAL-IP
ClusterIP kubernetes <none>
LoadBalancer ingress-nginx-controller example.elb.amazonaws.com
ClusterIP ingress-nginx-controller-admission <none>
ClusterIP kube-dns <none>
Copy EXTERNAL-IP Address to your clipboard and open it in a browser. Expected result would be 404 Not Found nginx
error as we don't have any ingresses defined
If you would like to uninstall helm chart from your cluster, and delete load balancer - run:
helm uninstall ingress-nginx -n ingress-nginx
You can find source code in our Github repo