kubernetes k3 s+金属LB:metallb控制器无法为“default/nginx”分配IP:无可用IP

jvidinwx  于 2023-03-07  发布在  Kubernetes
关注(0)|答案(1)|浏览(213)

我创建了一个k3s集群并禁用了服务负载均衡器& traefik。我通过清单文件安装了metallb。另外,我在下面创建了一个名为"config"的带有地址池的配置Map,所以我不知道为什么metallb控制器说"no available ips"。

ubuntu@mark:~$ k describe svc nginx
Name:                     nginx
Namespace:                default
Labels:                   app=nginx
Annotations:              <none>
Selector:                 app=nginx
Type:                     LoadBalancer
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.43.29.17
IPs:                      10.43.29.17
Port:                     <unset>  80/TCP
TargetPort:               80/TCP
NodePort:                 <unset>  30584/TCP
Endpoints:                10.42.4.4:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type     Reason            Age   From                Message
  ----     ------            ----  ----                -------
  Warning  AllocationFailed  34s   metallb-controller  Failed to allocate IP for "default/nginx": no available IPs
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
      - name: default
    protocol: layer2
      addresses:
      - 192.168.136.206-192.168.136.209
jljoyd4f

jljoyd4f1#

安装最新的稳定版本:

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.9/config/manifests/metallb-native.yaml

定义IP地址池

---
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: nat
  namespace: metallb-system
spec:
  addresses:
    - 192.168.136.206-192.168.136.209
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: empty
  namespace: metallb-system

相关问题