k8s-loadbalancer一直处于pending状态原因分析

当在非云环境中,如bare metal安装的kubernetes集群中,Service类型为LoadBalancer时,会一直保持pending状态。这是因为k8s在非云平台缺少内置的负载均衡器支持。解决方案包括改用clusterIP类型或采用MetalLB等第三方解决方案来实现负载均衡。
摘要由CSDN通过智能技术生成

现象

在这里插入图片描述

原因分析

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.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

未来AI编程

共鸣===鼓励 打赏您随意

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值