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.
This practical sheets is given as information only, Nginx is not mandatory at all, you are free to install any other Ingress Controler on your clusters. No support can be provided on Nginx.
Prerequisites
Before deploying Nginx on the workload cluster, some prerequisite has to be installed either on the admin workstation
We recommend disabling the usage of the option controller.service.appProtocol to utilize a basic L4 load balancer instead of an L7 load balancer in vCloud Director. By doing so, the traffic will be forwarded to your ingress controller, allowing you to manage certificates using your ingress controller, for example.
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.
Please note !
For our demo we will use a public and free DNS service called nip.io. It will help and simplify our demo regarding the DNS resolution, but it is not mandatory at all, you can rely on your classical DNS resolution system.
nip.io will resolve the names by answering the IP provided in the name. Example for :
banana.100.10.12.2.nip.ip will return the ip : 100.100.12.2
apple.100.10.12.2.nip.ip will return the ip : 100.100.12.2
PODs creation
First we need to define our PODS and services, for that, launch these two commands :
kind: Service apiVersion: v1 metadata: name: banana-service spec: selector: app: banana ports: - port: 5678 # Default port for image EOF
Verify that pods status are RUNNING after some times
kubectl get pods banana kubectl get pods apple
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.
Please note !
if you just installed Nginx ingress Controller recently the EXTERNAL-IP address can take some minutes to be affected to your Load Balancer. You can control in vCloud Director that you have enough Virtual Service available in your Edge Gateway
kubectl get svc ingress-nginx-controller NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ingress-nginx-controller LoadBalancer 100.65.85.121 10.x.y.z 80:30536/TCP,443:32691/TCP 14m
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.