Install the Nginx Ingress Controller

This practical sheet provides a step by step procedure to install Nginx as Ingress Controller on workload clusters.

It is given as an example about how to use an Ingress Controller, but others Ingress Controller can be used. It is just for information and to help starting using an Ingress Controller.


To know more about Ingress Controller :

Kubernetes : Ingress Controller

KaaS Standard#ingress_controller

Prerequisites

Before deploying Nginx on the workload cluster, some prerequisite has to be installed either on the admin workstation

On the admin station

Install the Helm tool, using this page

On the cluster

Configure the vipSubnet to use

It is required to configure the vipSubnet to use for the load balancer.


Please follow the steps provided in this page : HERE

Add Nginx Helm repository

Install Nginx as Ingress Controller

Ingress controller sample usage

To test our Ingress Controller we will deploy two pods. One POD that will display a webpage with the text apple, and another POD that will display a webpage with the text banana.

Depending of the host url used to access the service the Ingress Controller will use the correct POD to give the answer to the web client.

This implementation require only one IP address that are accessible outside the cluster (Nginx IP), it correspond to the service (type LoadBalancer) that has been created during the Nginx installation process.

PODs creation

First we need to define our PODS and services, for that, launch these two commands :

apple app

banana app

Verify that pods status are RUNNING after some times

Ingress Deployment

Get the ingress controller service IP. For that use the EXTERNAL-IP value, note the IP it will be required for next step.

Launch the following command to create Ingress objects :

  • replace the [IP] in the host parameter by the external-ip retrieved with the above command
  • you can also use your own dns extension instead of nip.io, but for test purpose it will be more easier to use nip.io.

Verify the status of the ingress

Test the web page access

Open a web browser that can access to your Ingress Controller IP and try the both ingress URL.

  • http://banana.[IP].nip.io (replace the [IP] with the exernal ip)
  • http://apple.[IP].nip.io (replace the [IP] with the exernal ip)

Additional test usage

It is also possible to use a same url and redirect the flow depending of the path in the url.

For example :

  • http://myapp.[IP].nip.io/apple will use the POD apple
  • http://myapp.[IP].nip.io/banana will use the POD banana

The sample yaml file to use for this kind of ingerss is :