Kubernetes - Traefik外部IP卡在待定状态

4

我在AWS上搭建了一个两个节点的集群,并使用helm安装了traefik。我发现服务的外部IP一直处于挂起状态。查看了几个来源,但没有找到解决问题的方法。感谢任何帮助。

helm install stable/traefik



ubuntu@ip-172-31-34-78:~$ kubectl get pods -n default
NAME                                      READY   STATUS    RESTARTS   AGE
unhinged-prawn-traefik-67b67f55f4-tnz5w   1/1     Running   0          18m
ubuntu@ip-172-31-34-78:~$ kubectl get services -n default
NAME                     TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
kubernetes               ClusterIP      10.96.0.1       <none>        443/TCP                      55m
unhinged-prawn-traefik   LoadBalancer   10.102.38.210   <pending>     80:30680/TCP,443:32404/TCP   18m
ubuntu@ip-172-31-34-78:~$ kubectl describe service unhinged-prawn-traefik
Name:                     unhinged-prawn-traefik
Namespace:                default
Labels:                   app=traefik
                          chart=traefik-1.52.6
                          heritage=Tiller
                          release=unhinged-prawn
Annotations:              <none>
Selector:                 app=traefik,release=unhinged-prawn
Type:                     LoadBalancer
IP:                       10.102.38.210
Port:                     http  80/TCP
TargetPort:               http/TCP
NodePort:                 http  30680/TCP
Endpoints:                10.32.0.6:80
Port:                     https  443/TCP
TargetPort:               httpn/TCP
NodePort:                 https  32404/TCP
Endpoints:                10.32.0.6:8880
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

ubuntu@ip-172-31-34-78:~$ kubectl get svc unhinged-prawn-traefik --namespace default -w
NAME                     TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
unhinged-prawn-traefik   LoadBalancer   10.102.38.210   <pending>     80:30680/TCP,443:32404/TCP   24m
1个回答

4

我不确定你是如何安装你的集群的,但基本上,kube-controller-manager/kubelet/kube-apiserver无法与AWS API通信,以创建负载均衡器为你的服务提供流量。

  • It could be just as simple as your instance missing the required instance profile with the permissions to create a load balancer and routes.

  • It could also that you need to add this flag to all your kubelets, your kube-apiserver, and your kube-controller-manager:

    --cloud-provider=aws
    
  • It could also be that you are missing these EC2 tags on your instances:

    KubernetesCluster=<yourclustername>
    kubernetes.io/cluster/kubernetes=owned
    k8s.io/role/node=1
    
请注意,在您的节点所在的子网上,您可能还需要使用 KubernetesCluster = <yourclustername> 标签。
  • It could also be that your K8s nodes don't have a ProviderID: spec that looks like this:

    ProviderID: aws:///<aws-region>/<instance-id>
    # You can add it with kubectl edit <node-name>
    
请注意,--cloud-provider标志正在被弃用,取而代之的是Cloud Providers控制器。

感谢 Rico。很抱歉回复有延迟。问题与创建负载均衡器的 IAM 权限相关。 - IT_novice
@IT_novice,你需要添加哪些权限来解决这个问题? - Increasingly Idiotic

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接