Building a Kubernetes 1.18 multi-master cluster - p02 (LB and Ingress)

Installing MetalLB

Configmap for metallb:

metallb-configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: rpi-kube-pool-1
      protocol: layer2
      addresses:
      - 192.168.122.190-192.168.122.209
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
kubectl apply -f metallb-configmap.yaml

Installing Nginx Ingress Controller

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.34.1/deploy/static/provider/baremetal/deploy.yaml

Setting an external IP for the ingress by adding

externalIPs:
  - 192.168.122.189
  

to the service definition

kubectl edit svc/ingress-nginx-controller -n ingress-nginx
spec:
  clusterIP: 10.99.55.172
  externalIPs:
  - 192.168.122.189
  externalTrafficPolicy: Cluster
  ports:
  - name: http
    nodePort: 31869
    port: 80
    protocol: TCP
    targetPort: http
  - name: https
    nodePort: 30636
    port: 443
    protocol: TCP
    targetPort: https
  selector:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
  sessionAffinity: None
  type: NodePort
status:
  loadBalancer: {}