k8s service LoadBalancer

install

MetalLB与Kubernetes集群挂钩,并提供网络负载平衡实现。简而言之,它允许您在不运行在云提供商上的集群中创建LoadBalancer类型的Kubernetes服务

https://metallb.universe.tf/installation/

1
2
3
❯ helm repo add metallb https://metallb.github.io/metallb
"metallb" has been added to your repositories
❯ helm pull metallb/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
2
3
4
5
6
kubectl get svc --namespace apisix apisix-dashboard --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"


❯ kubectl get -n apisix svc/apisix-gateway
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
apisix-gateway LoadBalancer 10.100.233.160 192.168.122.21 80:31388/TCP,443:30529/TCP 45h
点击打赏
文章目录
  1. 1. install
    1. 1.1. CRs.
载入天数...载入时分秒... ,