helm-for-kubernetes-cluster

With Helm as the package manager for Kubernetes Cluster on Raspberry, you can find, share and and use software built for Kubernetes

Helm on Kubernetes Cluster

(Total Setup Time: 10 mins)

 

Helm is the package manager for Kubernetes. In this guide, I will install helm and setup ingress nginx controller with metallb as the layer 2 load balancer.

 

Installing Helm

(3 min)

 

Because I am installing Helm for Kubernetes Cluster runnning on a mixture of Raspberry Pi 4 and 3, I will download the Helm linux arm64 variant:

wget https://get.helm.sh/helm-v3.3.0-rc.1-linux-arm64.tar.gz
tar -xzvf helm-v3.3.0-rc.1-linux-arm64.tar.gz
sudo mv linux-arm64/helm /usr/local/bin/helm

 

Afer Helm 3 is setup, you may check the version:

helm version

# Helm output
version.BuildInfo{Version:"v3.3.0-rc.1", GitCommit:"5c2dfaad847df2ac8f289d278186d048f446c70c", GitTreeState:"dirty", GoVersion:"go1.14.4"}

 

Installing NGINX Ingress Controller

(1 mins)

 

For external to access our Kubernetes cluster, I will install NGINX Ingress using helm.

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

 

Setting up Load Balancer

(1 mins)

 

MetallB hooks into our Kubernetes cluster and I will use it as a layer 2 network load-balancer.

sudo mkdir -p /mnt/hdd/master1k8s/app/metallb
cd /mnt/hdd/master1k8s/app/metallb
wget https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml -O metallb-namespace.yaml
kubectl apply -f metallb-namespace.yaml
wget https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml -O metallb.yaml
kubectl apply -f metallb.yaml
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"

This is my setting for the layer 2 configuration:

sudo vi metallb-config.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 192.168.100.200-192.168.100.250
	  
kubectl apply -f metallb-config.yaml

 

After the metallb is setup, I am able to get external IP addresses:

kubectl --namespace default get services -o wide -w my-nginx-ingress-nginx-controller

This is the sample result:

NAME                                  TYPE           CLUSTER-IP     EXTERNAL-IP       PORT(S)                      AGE   SELECTOR
my-nginx-ingress-nginx-controller   LoadBalancer   10.104.36.43   192.168.100.200   80:31710/TCP,443:30063/TCP   11h   app.kubernetes.io/component=controller,app.kubernetes.io/instance=my-nginx,app.kubernetes.io/name=ingress-nginx

Re-visiting Gitea setup

(5 mins)

 

With the metallb usage, I change my Gitea service (you may refer to the previous Gitea post) to the following:

apiVersion: v1
kind: Service
metadata:
  name: gitea
  annotations:
    metallb.universe.tf/allow-shared-ip: home-net
spec:
  ports:
  - port: 3000
    targetPort: 3000
    name: gitea-http
  - port: 2222
    targetPort: 2222
    nodePort: 32222
    name: gitea-ssh
  selector:
    app: gitea
  type: LoadBalancer
  loadBalancerIP: 192.168.100.250

 

In this guide, I complete the Helm for Kubernetes Cluster setup and demonstrate how easy this package manager is, for my existing Kubernetes Cluster on Raspberry Pi.