kubernetes节点中没有显示ExternalIP吗? [英] No ExternalIP showing in kubernetes nodes?

查看:224
本文介绍了kubernetes节点中没有显示ExternalIP吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在跑步

kubectl get nodes -o yaml | grep ExternalIP -C 1

但是没有找到任何ExternalIP.关于非云设置的问题,有各种各样的评论出现.

But am not finding any ExternalIP. There are various comments showing up about problems with non-cloud setups.

我正在关注此文档 https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/

在台式机上使用microk8.

with microk8s on a desktop.

推荐答案

简而言之:从我的回答 Minikube上的Kubernetes入口nginx失败.

In short: From my answer Kubernetes Ingress nginx on Minikube fails.

默认情况下,minikube之类的所有解决方案都无法为您提供负载均衡器.诸如EKS,Google Cloud,Azure之类的云解决方案可用于您可以通过在后台单独的LB中旋转来自动操作.这就是为什么您会看到待处理状态.

By default all solutions like minikube does not provide you LoadBalancer. Cloud solutions like EKS, Google Cloud, Azure do it for you automatically by spinning in the background separate LB. Thats why you see Pending status.

在您看来,最合适的决定是查看 MicroK8s插件.有一个添加:MetalLB :

In your case most probably right decision to look into MicroK8s Add ons. There is a Add on: MetalLB:

感谢@Matt使用他的在Windows 10单节点Kubernetes基础架构上的docker-desktop社区版上的MetalLB外部负载平衡器回答研究过的信息.

Thanks @Matt with his MetalLB external load balancer on docker-desktop community edition on Windows 10 single-node Kubernetes Infrastructure answer ans researched info.

MetalLB Loadbalancer是一个网络LB实施,它试图在裸机集群上正常工作".

MetalLB Loadbalancer is a network LB implementation that tries to "just work" on bare metal clusters.

启用此附加组件后,系统将要求您提供IP地址池MetalLB将从以下位置分发IP:

When you enable this add on you will be asked for an IP address pool that MetalLB will hand out IPs from:

microk8s enable metallb

对于MicroK8s集群中的负载平衡,MetalLB可以利用可以在整个群集之间实现适当平衡的入口(请确保您拥有也首先在MicroK8中启用了入口,而在microk8s中启用了入口).为此,它需要服务.合适的入口服务是在这里定义:

For load balancing in a MicroK8s cluster, MetalLB can make use of Ingress to properly balance across the cluster ( make sure you have also enabled ingress in MicroK8s first, with microk8s enable ingress). To do this, it requires a service. A suitable ingress service is defined here:

apiVersion: v1
kind: Service
metadata:
  name: ingress
  namespace: ingress
spec:
  selector:
    name: nginx-ingress-microk8s
  type: LoadBalancer
  # loadBalancerIP is optional. MetalLB will automatically allocate an IP 
  # from its pool if not specified. You can also specify one manually.
  # loadBalancerIP: x.y.z.a
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 80
    - name: https
      protocol: TCP
      port: 443
      targetPort: 443

您可以将此文件另存为 ingress-service.yaml ,然后通过以下方式应用:

You can save this file as ingress-service.yaml and then apply it with:

microk8s kubectl apply -f ingress-service.yaml

现在有一个负载均衡器,它可以监听任意IP,并且将流量引向其中一个侦听入口控制器.

Now there is a load-balancer which listens on an arbitrary IP and directs traffic towards one of the listening ingress controllers.

这篇关于kubernetes节点中没有显示ExternalIP吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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