简体   繁体   English

通过外部网络架构在裸机集群上公开 Kubernetes 服务

[英]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:故障排除:

  1. I am thinking about using an ingress-controller or a NodePort Service as a solution to access the pods-network.我正在考虑使用入口控制器或 NodePort 服务作为访问 pods-network 的解决方案。
  2. I tried to expose a NodePort service, but I didn't get an external ip.我试图公开一个 NodePort 服务,但我没有得到一个外部 ip。

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.

相关问题 Kubernetes - 使用 cloudflare 代理将集群暴露给外部访问 - Kubernetes - exposing cluster to external access with cloudflare proxy 如何在多个子网的裸机上为Kubernetes服务提供静态地址? - How to give a Kubernetes service a static address on bare metal across multiple subnets? 在裸机上从外部访问 kubernetes 中的服务的问题 - Issue with accessing services in kubernetes externally on bare metal 将其公开为NodePort后无法连接到Kubernetes服务 - Unable to connect to Kubernetes Service after exposing it as a NodePort 将 Kubernetes 集群与 Docker 网络互连 - Interconnect a Kubernetes cluster with a Docker network kubernetes ingress - 将 neo4j 端点暴露给内部网络 - kubernetes ingress - exposing neo4j endpoint to internal network 裸机k8s群集是否应具有物理网络隔离? - Should bare metal k8s clusters have physical network segregation? 无法从一个集群访问 Kubernetes 服务到另一个集群(通过 VPC peerng) - Unable to access Kubernetes service from one cluster to another (over VPC peerng) 连接到 AWS 内部网络上的 Kubernetes 集群 - Connecting to Kubernetes cluster on AWS internal network Azure(kubernetes 集群)中的监控网络节流限制? - Monior network throttling limits in Azure (kubernetes cluster)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM