我有一个本地、公开的 k8s 节点,并已将 metallb 配置为具有 Traefik 2.0 第 4 层 LB 的 LB 提供程序。
我试图弄清楚为什么 Traefik LB 服务被分配了 NodePorts:
kubectl describe svc traefik
Name: traefik
Namespace: default
Labels: <none>
Annotations: metallb.universe.tf/address-pool: default
Selector: app=traefik
Type: LoadBalancer
IP: 10.102.106.163
LoadBalancer Ingress: x.x.x.x
Port: web 80/TCP
TargetPort: 80/TCP
NodePort: web 30481/TCP
Endpoints: 192.168.152.4:80
Port: admin 8080/TCP
TargetPort: 8080/TCP
NodePort: admin 30839/TCP
Endpoints: 192.168.152.4:8080
Port: websecure 443/TCP
TargetPort: 443/TCP
NodePort: websecure 30647/TCP
Endpoints: 192.168.152.4:443
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal IPAllocated 53m metallb-controller Assigned IP "x.x.x.x"
Normal nodeAssigned 2m21s (x13 over 53m) metallb-speaker announcing from node "x-lp-xxx-xx-xxxxx"
在什么情况下,LB 服务会被分配 NodePort?
它们是在您使用外部负载均衡器时自动创建的。
从文档:
https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types