開啟ipvs
kubectl edit configmap -n kube-system kube-proxy
apiVersion: kubeproxy.config.k8s.io/v1alpha1 kind: KubeProxyConfiguration mode: "ipvs" ipvs: strictARP: true
安裝metallb
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.2/manifests/namespace.yaml kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.2/manifests/metallb.yaml
設定lb要產生的ip網段
vi layer2-metallb.yaml
apiVersion: v1 kind: ConfigMap metadata: namespace: metallb-system name: config data: config: | address-pools: - name: default protocol: layer2 addresses: - 192.168.1.240-192.168.1.250
kubectl apply -f layer2-metallb.yaml
如果節点有swarm-net的網路可能會衝突
解法註解這個區段
I was able to overcome this by removing the METALLB_ML_BIND_ADDR environment variable from the speaker DaemonSet.