Try   HackMD

Installation Guide - Nginx ingress-controller, MetalLB loadbalancer

tags: Kubernetes

Install MetalLB loadbalacer

Creste namespace You will see the metallb-system in namespace

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml

Create deployment You will see the two pods

  • controller
  • speaker
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml

Create sercet

kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"

Create ConfigMap (metallb_configmap.yml)

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: my-ip-space
      protocol: layer2
      addresses:
      - 192.168.100.240-192.168.100.249

Note: The IP addresses range need to be aviliable. Then create the configmap.

kubectl apply -f metallb_configmap.yml

After above steps, we finish to install the metallb.

Install the Ingress-controller

Create an namespace.yml

# namespace controller
apiVersion: v1
kind: Namespace
metadata: 
  name: controller

Create namespace

kubectl apply -f namespace.yml

Use the Helm to install controller

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

p.s. you can use below cmd to install Helm

snap install helm --classic

Reference

http://brobridge.com/bdsres/2019/10/31/如何自己建構-k8s-loadbalancer/

https://metallb.universe.tf/installation/

https://kubernetes.github.io/ingress-nginx/deploy/

https://helm.sh/