参考 https://www.cnblogs.com/bit-zjh/p/14818743.html
原理介绍: https://cloud.tencent.com/developer/article/2146391
官方安装步骤(英): https://metallb.universe.tf/installation/#preparation
manifest方法:
kustomize方法:
helm方法:
# 官方源------------------
helm repo add metallb https://metallb.github.io/metallb
helm install metallb metallb/metallb
安装时可以指定值文件。建议在Helm值中提供配置
helm install metallb metallb/metallb -f values.yaml
# bitnami源----------------------
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
#直接安装
helm search repo metallb
helm install metallb bitnami/metallb --namespace traefik
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install metallb -f metallb-custom-values.yaml bitnami/metallb --kubeconfig kube_config_cluster.yml --create-namespace -n metallb-system
查看错误的镜像
kg all -n traefik
kg deployment -n traefik
kg daemonset -n traefik
修改配置
k edit deployment/metallb-controller -n traefik
k edit daemonset/metallb-speaker -n traefik
镜像:docker.io/bitnami/metallb-controller:0.14.5-debian-12-r9 改为国内 xx.xx.cn/metallb-controller:0.14.5-debian-12-r9
镜像: docker.io/bitnami/metallb-speaker:0.14.5-debian-12-r10 改为国内 xx.xx.cn/metallb-speaker:0.14.5-debian-12-r10
configInline:
address-pools:
- name: generic-cluster-pool
# 2层协议 和 bgp模式
protocol: layer2
# 内网ip
# 部署在带宽最大的服务器上
addresses:
- 172.21.3.9-172.21.3.9
---
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: first-pool
namespace: metallb # 命名空间
spec:
addresses:
- 192.168.0.5-192.168.0.10 # 部署在带宽最大的服务器上
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: example
namespace: metallb
kubectl apply -f metallb-l2-pool.yaml