NestJS Kubernetes Deployment | Part 3: Ingress Configuration

hüseyin nurbaki
3 min readOct 6, 2021


Deploying NestJS applications on the Kubernetes Cluster series is divided into two main and two follow-up stories.
Part 1: Containerizing a NestJS application with Docker
Part 2: Kubernetes Deployment
Part 3: Bonus: Ingress Configuration
Part 4: Bonus: Kubernetes CronJob — NestJS

This is a follow-up story for . See part 2.

Photo by Tadeusz Lakota on Unsplash

Getting Started 📌

Ingress is an API object that manages external access to the services in a cluster.


Ingress-nginx is preferred in this story which is built around Kubernetes’ ingress and configmap resources. There are many different options. (read more) Find the suiting commands for your provider from here to install ingress-nginx on your cluster if you don’t already have it. This story continues with the installation using Helm.

Installation Using Helm 🔧

$ helm repo add ingress-nginx
$ helm repo update
$ helm install ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx --create-namespace --wait

These commands will create a namespace called ingress-nginx and deploy ingress controller inside it. (see original document)
(Takes few minutes)

Defining Ingress Rule ↗️⬇️⬅️

Create a file named ingress.yaml. Use the following configuration to define your first ingress rule.

$ kubectl apply -f ingress.yaml

In a real-life scenario, you will have your actual hostname instead of kubernetes.docker.internal. This allows us to test our ingress rules locally as much as possible. Running the following command is a good practice to track the state of your ingress definition. It is not usable until it gets an address. Again, in a real-life scenario, you will see the address of your domain.

$ kubectl get ingress --watch

Ta-Da 🎉


See other configurations such as re-writing, annotations, fanout, and more from here.

Extra 🎁

kubernetes.docker.internal is the default host Docker appends to the etc/hosts file during installation.
You can duplicate the kubernetes.docker.internal line and change the host part. See the example below.

After that update the host inside your ingress file and apply again. Now you can access it via your new host.


Minikube users, you are not forgotten.

$ minikube ip

Get your IP and add it to the etc/hosts file. demo.home

Update your ingress file and apply. (replace kubernetes.docker.internal with demo.home) Now you must be able to access the application from the following link. http://demo.home/health

Thank you for reading. Feel free to email me if you have any questions or suggestions.
Cheers! 🎉