How to deploy second ingress controller on Kubernetes?

Example Store Microservice Architecture

Via the Kubernetes ingress controller we can divide our application into different microservices and access these microservices using domains, subdomains or paths.

Sometimes, we may want to access microservices that we have developed exclusively for internal users (without any Public access for Private Clusters) through the ingress controller.

In such a case we need to deploy a second ingress controller in our current environment that uses a different ingress class name.

Before I start, I’m assuming there is an ingress controller in the environment where you’re routing a public ip. This way, anyone can access your public applications from outside.

In my example, a Public IP address has already been redirected to the private IP address 10.190.1.171, which you see below.

Services before second ingress controller

But we will deploy ingress controller for our private apps.

Prerequisites:

  • Private Kubernetes cluster
  • MetalLB (or any LB solution for private clusters)
  • Helm

First of all, let’s clone the nginx ingress controller helm files by running the following command.

git clone https://github.com/nginxinc/kubernetes-ingress.git — branch v3.0.2

Let’s move on to the relevant directory.

cd kubernetes-ingress/deployments/helm-chart
vi values.yaml

Replace the variable ingressClass on line 196 with “nginx-internal” and save.

Deploy with the command below.

helm install nginx-internal .

We successfully deployed our second controller.
Now list the available ingress classes.

Ingress classes
Ingress classes

and new services

Ingress services after second controller

Summary:

When we create ingress resources for our applications with the class name “nginx-internal”, another nginx-controller or other users outside our network cannot access the applications.

I hope you enjoyed reading and trying it out.
See you in the next article :)

You can find my other articles by clicking here.

LinkedIn

--

--