Install the Contour Ingress Controller

This practical sheet provides a step by step procedure to install Contour 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 Contour on the workload cluster, some prerequisite has to be installed either on the admin workstation or in the target workload cluster.

On the admin station

Install the Tanzu packages tools, 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

Install tkg package repository

Connect to the target cluster, then apply kapp controller yaml file :

Add the repository

Install Cert-Manager

Get the correct version to install depending of the repository added in the above step. Use the LATEST-VERSION column and note the version, it will be required in next steps.

Install cert manager in desired namespace :

  • Replace NAMESPACE and VERSION using the version founded in the above step

Example :

erify that cert-manager is successfully install

Contour installation

Create a file named : contour-data-values.yaml with the following content :

Get the correct version to install depending of the repository added in the above step. Use the LATEST-VERSION column and note the version, it will be required in next steps.

Install contour in desired namespace :

  • Replace NAMESPACE and VERSION using the version founded in the above step

Exemple :

Verify that contour is successfully installed

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 adress that are accessible outside the cluster (Envoy IP), it correspond to the service (type LoadBalancer) that we create during the contour installation process.

PODs creation

First we need to define our PODS and services, for that create these two files :

apple.yaml

banana.yaml

Deploy the PODS

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.

Create a file named ingress.yaml with the below content

  • 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.

Deploy the ingress object.

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 :