Kubernetes Ingress with MetalLB

From PKC
Jump to navigation Jump to search

Background

This page is to document the attempt of installing Kubernetes Ingress with MetalLB at AWS Cluster. Beforehand the kubernetes cluster is installed an all worker nodes has joined the master node. Refer to K8S Installation Process for installation process.

One can check the cluster nodes by using below command

kubectl get nodes
NAME      STATUS   ROLES                  AGE     VERSION
kmaster   Ready    control-plane,master   23d     v1.21.3
w1        Ready    <none>                 4d10h   v1.22.0
w2        Ready    <none>                 23d     v1.21.3

Below are the structured of installation process that we are going to perform

  1. Install Helm
  2. Install Kubernetes Ingress
  3. Apply configuration
  4. Check Result

Install Helm

This document using helm version v3.4.2. Start with downloading and unpack the binary release of this version.

wget https://get.helm.sh/helm-v3.4.2-linux-amd64.tar.gz
tar -xzvf helm-v3.4.2-linux-amd64.tar.gz

Then, move to desire location

mv linux-amd64/helm /usr/local/bin/helm

You might need sudo to execute it, once it executed, you can add the chart repository of bitnami into the helm installation

helm repo add bitnami https://charts.bitnami.com/bitnami

Then you can check the repository content of helm

helm search repo bitnami
NAME                                        	CHART VERSION	APP VERSION  	DESCRIPTION
bitnami/bitnami-common                      	0.0.9        	0.0.9        	DEPRECATED Chart with custom templates used in ...
bitnami/airflow                             	10.2.8       	2.1.2        	Apache Airflow is a platform to programmaticall...
bitnami/apache                              	8.6.0        	2.4.48       	Chart for Apache HTTP Server
bitnami/argo-cd                             	1.0.1        	2.0.5        	Declarative, GitOps continuous delivery tool fo...
bitnami/aspnet-core                         	1.3.14       	3.1.18       	ASP.NET Core is an open-source framework create...
bitnami/cassandra                           	8.0.2        	4.0.0        	Apache Cassandra is a free and open-source dist...
bitnami/cert-manager                        	0.1.12       	1.5.0        	Cert Manager is a Kubernetes add-on to automate...
bitnami/common                              	1.8.0        	1.8.0        	A Library Helm Chart for grouping common logic ...
bitnami/concourse                           	0.1.3        	7.4.0        	Concourse is a pipeline-based continuous thing-...
...

Getting Started with NGINX Ingress

First thing to be done, is to register the repository of NGINX Ingress into helm, update the repository, and install it through helm chart

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install ingress-nginx ingress-nginx/ingress-nginx
helm repo update

Response

"ingress-nginx" has been added to your repositories

Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "ingress-nginx" chart repository
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈

And, check on available repository, will display available ingress-nginx helm chart

helm search repo ingress
NAME                            	CHART VERSION	APP VERSION	DESCRIPTION
bitnami/nginx-ingress-controller	7.6.19       	0.48.1     	Chart for the nginx Ingress controller <<<--- helm chart
ingress-nginx/ingress-nginx     	3.35.0       	0.48.1     	Ingress controller for Kubernetes using NGINX a...
bitnami/contour                 	5.1.0        	1.18.0     	Contour Ingress controller for Kubernetes
bitnami/kong                    	3.8.2        	2.5.0      	Kong is a scalable, open source API layer (aka ...

In order to install the MetalLB ingress, we are not going to execute all helm chart directly, but we need to made several modification of available helm chart repo. Below is the instruction on how to change the helm chart.

Save the helm chart into you choice of temporary or working folder, by executing

helm show values ingress-nginx/ingress-nginx --version=3.19.0 > ingress-nginx.yaml

Note, that we are going this specific version to align the result with the reference tutorial document. Once the command executed, edit the file with your preferable text editing document. Below are the changes that need to be made

Changes on YAML File
No Parameter Before After
1 hostNetwork false true
2 hostPort.enabled false true
3 Kind Deployment DaemonSet

Once the changes are made ans saved into the temporary files, then we are all set to install the ingress-nginx.

Executing Installation yaml file

Since we are going to install ingress-nginx into different namespace, then we need to create new namespace beforehand, and check the result

kubeclt create ns ingress-nginx
kubectl get namespace

To install the helm chart into specific namespace, which in this case is the ingress-nginx namespace, use below command

helm install [your-installation-name] [repo]/[helm chart] -n [namespace] --value [yaml file]
helm install myingress ingress-nginx/ingress-nginx -n ingress-nginx --values ./ingress-nginx.yaml
  1. Host Network Parameter

helm install argocd argo/argo-cd -f argocd-helm-values.yaml --version=1.6.2 -n argocd helm install ingress-nginx ingress-nginx/ingress-nginx

External Links

1. Tutorial references {{#ev:youtube |UvwtALIb2U8 }}

2. Github Kubernetes Ingress repository :
https://github.com/kubernetes/ingress-nginx

3. Getting started document :
https://kubernetes.github.io/ingress-nginx/deploy/