[英]Exposing a Kubernetes service on a bare-metal cluster over the external network architecture
I've build a bare-metal multi-node, multi-server Kubernetes cluster and this is my first experience.我已经构建了一个裸机多节点、多服务器 Kubernetes 集群,这是我的第一次体验。
The cluster is built across many servers;集群是跨多台服务器构建的; each server contains a set of nodes.
每个服务器包含一组节点。
The connection is done over public ip addresses on the LAN.连接是通过 LAN 上的公共 ip 地址完成的。
I run deployments on the cluster and it’s working .我在集群上运行部署并且它正在工作。
But I want to expose a service over the external network.但我想通过外部网络公开服务。
If I were using Minikube, I would use a LoadBalancer to expose the service externally.如果我使用 Minikube,我会使用 LoadBalancer 将服务公开到外部。
Troubleshooting:故障排除:
I am asking if someone could help me set a running hello-world, but choosing the right architecture for this bare-metal cluster.我在问是否有人可以帮助我设置一个运行中的 hello-world,但为这个裸机集群选择正确的架构。
Thank you.谢谢你。
I suggest using MetalLB which is a LoadBalancer for bare metal clusters.我建议使用MetalLB ,它是裸机集群的 LoadBalancer。
Also you could combine this with a bare metal Ingress controller like Nginx .您也可以将其与裸机 Ingress controller 结合使用,例如Nginx 。
Regarding Nginx you can find more details here .关于 Nginx,您可以 在此处找到更多详细信息。
I have successfully used this combination as well as with a wildcard domain (eg *.mydomain) pointing to one of the cluster IPs.我已经成功地使用了这种组合以及指向集群 IP 之一的通配符域(例如 *.mydomain)。 This allows to define as many combinations as you like to point to different services deployed on the cluster (eg service1.mydomain, service2.mydomain, etc.).
这允许定义尽可能多的组合,以指向部署在集群上的不同服务(例如 service1.mydomain、service2.mydomain 等)。
What I would also suggest is installing Helm as this would greatly help you with deployments.我还建议安装Helm ,因为这将极大地帮助您进行部署。 You can find a lot of charts for most of the widely spread services and it gives you the ability to configure them easily.
您可以为大多数广泛传播的服务找到很多图表,并且它使您能够轻松配置它们。 Also it is quite a good practice to create charts for your future services as well for good maintenance and customization.
此外,为您的未来服务以及良好的维护和定制创建图表也是一个很好的做法。
Nodeport service helps here In bare metal lets you have host1,master as cluster members. Nodeport 服务在这里提供帮助 在裸机中,您可以将 host1、master 作为集群成员。 If you create node port service on node port ex: 31000 you can use http://host1IP:31000/ for QA
如果您在节点端口 ex: 31000 上创建节点端口服务,您可以使用 http://host1IP:31000/ 进行 QA
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.