root@k8s-master-u2404-4-100-101:~# curl https://raw.githubusercontent.com/metallb/metallb/main/config/manifests/metallb-native.yaml > metallb-native.yaml
root@k8s-master-u2404-4-100-101:~# kubectl apply -f metallb-native.yaml
# 等 pod 都处于运行状态后
# 开始配置 ip 池
root@k8s-master-u2404-4-100-101:~# cat metallb-ci.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
namespace: metallb-system
name: my-ip-pool
spec:
addresses:
- 172.16.101.200-172.16.101.240 ###添加子网池
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
namespace: metallb-system
name: my-l2-advertisement
spec:
ipAddressPools:
- my-ip-pool
root@k8s-master-u2404-4-100-101:~# kubectl apply -f metallb-ci.yaml