10

嗨,在 centos 中使用 kubeadm 安装了 Kubernetes 当我在 yaml 文件中使用类型负载均衡器创建部署时,外部 IpPending用于 Kubernetes LB,它卡在 Pending 状态

NAME         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP      10.96.0.1       <none>        443/TCP        13m
service    LoadBalancer   10.101.168.76   <pending>     80:32225/TCP   4m52s
4

1 回答 1

5

请尝试运行:

kubectl describe svc <service-name>

并检查错误/警告。

下面示例输出中的 events 字段下描述了一个可能的错误示例 - (SyncLoadBalancerFailed - 找不到任何合适的子网来创建 ELB):

Name:                     some-service
Namespace:                default
Labels:                   <none>
Annotations:              kubectl.kubernetes.io/last-applied-configuration:
                            {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"some-service","namespace":"default"},"spec":{"ports":[{"port":80,...
Selector:                 app=some
Type:                     LoadBalancer
IP:                       10.100.91.19
Port:                     <unset>  80/TCP
TargetPort:               5000/TCP
NodePort:                 <unset>  31022/TCP
Endpoints:                <none>
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type     Reason                  Age                From                Message
  ----     ------                  ----               ----                -------
  Normal   EnsuringLoadBalancer    68s (x8 over 11m)  service-controller  Ensuring load balancer
  Warning  SyncLoadBalancerFailed  67s (x8 over 11m)  service-controller  Error syncing load balancer: failed to ensure load balancer: could not find any suitable subnets for creating the ELB
于 2020-07-26T21:29:58.747 回答