LoadBalancer external-ip 卡在挂起状态 [英] LoadBalancer external-ip stuck in pending

查看:30
本文介绍了LoadBalancer external-ip 卡在挂起状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 kubeadm 创建了一个带有 AWS ec2 实例的 Kubernetes 集群,但是当我尝试创建一个类型为 LoadBalancer 的服务时,我得到一个 EXTERNAL-IP 挂起状态

I've created a Kubernetes cluster with AWS ec2 instances using kubeadm but when I try to create a service with type LoadBalancer I get an EXTERNAL-IP pending status

NAME         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
kubernetes   ClusterIP      10.96.0.1       <none>        443/TCP         123m
nginx        LoadBalancer   10.107.199.170  <pending>     8080:31579/TCP  45m52s

我的创建命令是

kubectl expose deployment nginx --port 8080 --target-port 80 --type=LoadBalancer

我不确定我做错了什么.

I'm not sure what I'm doing wrong.

我希望看到的是为负载均衡器提供的 EXTERNAL-IP 地址.

What I expect to see is an EXTERNAL-IP address given for the load balancer.

请问有人遇到过并成功解决了吗?

Has anyone had this and successfully solved it, please?

谢谢.

推荐答案

您需要设置 k8s 和 AWS 之间的接口,即ws-cloud-provider-controller.

You need to setup the interface between k8s and AWS which is aws-cloud-provider-controller.

apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
nodeRegistration:
  kubeletExtraArgs:
    cloud-provider: aws

可以找到更多详细信息:

More details can be found:

完成此设置后,您不仅可以控制为 LoadBalancer 类型的每个 k8s 服务创建 AWS LB.. 而且,您还可以使用 注释 控制许多事情强>.

Once you finish this setup, you will have the luxury to control not only the creation of AWS LB for each k8s service with type LoadBalancer.. But also , you will be able to control many things using annotations.

apiVersion: v1
kind: Service
metadata:
  name: example
  namespace: kube-system
  labels:
    run: example
  annotations:
     service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:xx-xxxx-x:xxxxxxxxx:xxxxxxx/xxxxx-xxxx-xxxx-xxxx-xxxxxxxxx #replace this value
     service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
spec:
  type: LoadBalancer
  ports:
  - port: 443
    targetPort: 5556
    protocol: TCP
  selector:
    app: example

不同的设置可以应用于 AWS 中的负载均衡器服务,使用注释.

这篇关于LoadBalancer external-ip 卡在挂起状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆