Platform9 Blog

How To Set Up NGINX Ingress Controller On Kubernetes Using Platform9

In this article, you will learn how to set up NGINX Ingress Controller on Kubernetes using a free Platform9 Kubernetes account.

The Need For Ingress Controllers With Kubernetes

The vast majority of Kubernetes clusters are used to host containers that process incoming requests from micro-services to full web applications. Having these incoming requests come into a central location, then get handed out via services in Kubernetes, is the most secure way to configure a cluster.

Ingress is used as an entry point for clients to publicly access the services on a Kubernetes cluster. In the absence of an ingress, the services are typically exposed to the outside via a Kubernetes resource of the type LoadBalancer. Load balancers are expensive resources in the cloud and using them for every service is just not practical even in your on-premises private cloud. Ingress controllers not only solve this problem but also provide additional features like SSL termination and host-based or path-based routing.

Ingress overcomes restrictions with using Kubernetes services like nodePort where one is restricted to use port 30000 and above. Cloud load balancers also overcome this restriction but at a higher cost as the services that are exposed grow the number of load balancers that required also keep growing. Cloud load balancers are expensive. This is where an ingress controller has an advantage as it can expose multiple services using a single cloud load balancer.

The cloud load balancer talks with ingress which in turn routes the traffic to an underlying service on Kubernetes. In Kubernetes both LoadBalancer and ingress have service endpoints connected with each other. On public clouds ingress controllers can provision cloud load balancers for themselves, whereas private cloud clusters use MetalLB as load balancer.

Read on to learn how to deploy the NGINX Ingress Controller on Kubernetes using a free Platform9 Managed Kubernetes cluster.

Getting Started

To get started, create your free Platform9 Kubernetes account by entering your email below, then select the ‘Deploy Now’ option. Once you have created and verified your account, follow the steps outlined below. 

Step 1: Create your free account

Step 1: Create your free account

In addition to the Platform9 Managed Kubernetes account, you will use a MetalLB load balancer on baremetal servers/VMs running Ubuntu 18.04 or CentOS 7.6.

Download the Buyer's Guide to Distributed Kubernetes Solutions: Compare Google Anthos, Amazon EKS Anywhere, VMware Tanzu, Azure Arc and Platform9 and learn how the solutions stack-up.

Get the Guide

Deployment of NGINX Ingress Controller on Kubernetes

To deploy the NGINX Ingress Controller on Kubernetes, clone the ingress repository in KoolKubernetes organization and apply it on your cluster.

$ git clone

$ kubectl apply -f ingress/nginx/nginx-v0.33.0.yaml
namespace/ingress-nginx created
serviceaccount/ingress-nginx created
configmap/ingress-nginx-controller created created created created created
service/ingress-nginx-controller-admission created
service/ingress-nginx-controller created
deployment.apps/ingress-nginx-controller created created created created
job.batch/ingress-nginx-admission-create created
job.batch/ingress-nginx-admission-patch created created created
serviceaccount/ingress-nginx-admission created

Validate the ingress controller pods are running. Notice that NGINX ingress has got the load balancer IP from MetalLB.

$ kubectl get ns ingress-nginx
NAME            STATUS   AGE
ingress-nginx   Active   80s

$ kubectl get all -n ingress-nginx
NAME                                            READY   STATUS      RESTARTS   AGE
pod/ingress-nginx-admission-create-9dt62        0/1     Completed   0          82s
pod/ingress-nginx-admission-patch-fzlvg         0/1     Completed   0          82s
pod/ingress-nginx-controller-58f68f5ccc-c9gmt   1/1     Running     0          93s

NAME                                         TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)                      AGE
service/ingress-nginx-controller             LoadBalancer   80:32755/TCP,443:32569/TCP   93s
service/ingress-nginx-controller-admission   ClusterIP   <none>           443/TCP                      93s

NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/ingress-nginx-controller   1/1     1            1           93s

NAME                                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/ingress-nginx-controller-58f68f5ccc   1         1         1       93s

NAME                                       COMPLETIONS   DURATION   AGE
job.batch/ingress-nginx-admission-create   1/1           6s         92s
job.batch/ingress-nginx-admission-patch    1/1           8s         92s

Clone the cicd repo to test the ingress controller with the pf9-react-app.

$ git clone

Deploy the app with ingress resource to leverage NGINX ingress controller.

$ kubectl apply -f cicd/jenkins/webapp01/k8s/ingress-nginx-app.yaml
namespace/p9-react-app created
deployment.apps/p9-react-app created
service/p9-react-app created created

Validate the app is running in p9-react-app namespace with an ingress resource.

$ kubectl get all -n p9-react-app
NAME                                READY   STATUS    RESTARTS   AGE
pod/p9-react-app-67d4df6bb6-5f944   1/1     Running   0          17s
pod/p9-react-app-67d4df6bb6-t8p45   1/1     Running   0          17s

NAME                   TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
service/p9-react-app   ClusterIP   <none>        80/TCP    18s

NAME                           READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/p9-react-app   2/2     2            2           18s

NAME                                      DESIRED   CURRENT   READY   AGE
replicaset.apps/p9-react-app-67d4df6bb6   2         2         2       18s

$ kubectl get ingress -n p9-react-app
NAME             HOSTS                    ADDRESS         PORTS   AGE
pf9app-routing   80      40m

The ingress resource gets created as shown below.

$ kubectl describe ingress -n p9-react-app
Name:             pf9app-routing
Namespace:        p9-react-app
Default backend:  default-http-backend:80 (<none>)
  Host                    Path  Backends
  ----                    ----  --------
                          /   p9-react-app:80 (,
Annotations:  {"apiVersion":"","kind":"Ingress","metadata":{"annotations":{},"name":"pf9app-routing","namespace":"p9-react-app"},"spec":{"rules":[{"host":"","http":{"paths":[{"backend":{"serviceName":"p9-react-app","servicePort":80},"path":"/"}]}}]}}

  Type    Reason  Age                  From                      Message
  ----    ------  ----                 ----                      -------
  Normal  CREATE  45m                  nginx-ingress-controller  Ingress p9-react-app/pf9app-routing

The Service p9-react-app within Kubernetes namespace p9-react-app is now exposed outside via hostname One should make a local hosts file entry to visit this URL from the LAN. Modify the Manifest to set the hostname of your choice before deploying the app manifest on the cluster.

Ingress controller should be running on a node which has enough resources. It can be further configured to add authentication, TLS termination, etc.


Next Steps

In this blog, we walked through a tutorial on how to set up NGINX Ingress Controller on Kubernetes. We hope you found this blog informative and engaging. For more reads like this one, visit our blog page or subscribe for up-to-date news, projects, and related content in real-time.   

Check out our additional complete stack projects in our Github repos

You may also enjoy

EKS Plug and Play: Centralized Management of your applications across AWS EKS clusters

By Chris Jones

Why Managed Calico?

By Chris Jones

The browser you are using is outdated. For the best experience please download or update your browser to one of the following: