install
MetalLB与Kubernetes集群挂钩,并提供网络负载平衡实现。简而言之,它允许您在不运行在云提供商上的集群中创建LoadBalancer类型的Kubernetes服务
https://metallb.universe.tf/installation/
1 | ❯ helm repo add metallb https://metallb.github.io/metallb |
1 | ❯ helm install -f ~/oss/k8s-1.26/metallb/value.yaml metallb ~/oss/k8s-1.26/metallb -n metallb-system --create-namespace |
value.yaml
value.yaml
controller:
enabled: true
# -- Controller log level. Must be one of: `all`, `debug`, `info`, `warn`, `error` or `none`
logLevel: info
image:
repository: k8s.org/cs/metallb-controller
tag: v0.14.8
speaker:
enabled: true
# command: /speaker
# -- Speaker log level. Must be one of: `all`, `debug`, `info`, `warn`, `error` or `none`
logLevel: info
image:
repository: k8s.org/cs/metallb-speaker
tag: v0.14.8
frr:
enabled: true
image:
repository: k8s.org/cs/metallb-frrouting-frr
tag: 9.1.0
CRs.
https://metallb.universe.tf/configuration/_advanced_ipaddresspool_configuration/
IPAddress.yaml
IPAddress.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: ippool-ns-service-alloc-sample
namespace: metallb-system
spec:
addresses:
- 192.168.122.20-192.168.122.50
avoidBuggyIPs: true
serviceAllocation:
priority: 50
namespaces:
- apisix
- default
1 | kubectl get svc --namespace apisix apisix-dashboard --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}" |