<>现象



<>原因分析

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 <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
<https://stackoverflow.com/questions/44110876/kubernetes-service-external-ip-pending>

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
<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

<https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-controllers>
)

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信