【转载】K8s-LoadBalancer一直处于pending状态原因分析

原文链接:https://blog.csdn.net/wxb880114/article/details/86535887
————————————————

问题如图:
在这里插入图片描述

原因分析、解决方案
service type 目前有两种,如果使用 gce 的 kubernetes,可以直接使用LoadBalancer类型,gce 会自动帮忙生成一个对外的 ip,并帮你做负载均衡

如果不是在 gce 平台,可以选择使用NodePort的类型,这样会在 node 里面添加一个对外的端口号,可以通过 nodeIP:nodePORT 来访问。可以自己搭建nginx 或者使用云服务商的负载均衡器来做处理。

The yaml you specified for the Service has type: LoadBalancer. That will only work with a cloud provider - so not on your bare metal Ubuntu installation.

Modify the Service definition and specify a different type, for example clusterIP

Try this one if you are using LoadBalancer on an on-premise / bare-metal kubernetes cluster.

https://github.com/google/metallb

From the project description:

Kubernetes does not offer an implementation of network load-balancers (Services of type LoadBalancer) for bare metal clusters. … If you’re not running on a supported IaaS platform (GCP, AWS, Azure…), LoadBalancers will remain in the “pending” state indefinitely when created.

kubernetes-service-external-ip-pengding

It looks like you are using a custom Kubernetes Cluster (using minikube, kubeadm or the like). In this case, there is no LoadBalancer integrated (unlike AWS or Google Cloud). With this default setup, you can only use NodePort (more info here: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport) or an Ingress Controller. With the Ingress Controller you can setup a domain name which maps to your pod (more information here: https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-controllers)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值