如何在Barematel上运行的kubernetes中公开服务 [英] How to expose a service in kubernetes running on Barematel

查看:295
本文介绍了如何在Barematel上运行的kubernetes中公开服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Kubernetes版本:1.10在Barematel上运行

Kubernetes Version: 1.10 Running on Barematel

不.的大师:3

我们正在Kubernetes集群中运行我们的多个微服务.当前,我们正在使用NodePort在群集之外公开这些服务.每个微服务都有其自己的NodePort,因此我们必须维护一个包含相应微服务的列表.由于我们在Barematel上运行,因此在公开微服务时没有像LodeBalancer这样的功能.

We are running our multiple microservices inside a Kubernetes cluster. Currently, we are exposing these services outside of the cluster using NodePort. Each microservice has it's own NodePort so we have to maintain a list with the corresponding microservices. Since we are running on Barematel we don't have features like LodeBalancer while exposing a microservice.

问题:-由于集群中有多个主服务器和工作服务器,因此我们必须一次为任何主服务器使用静态IP或DNS.如果要从群集外部访问任何服务,则必须将其用作-IP_ADDRESS:NODEPORTDNS:NODEPORT.一次我可以使用任何一个主机的地址.如果那个主人穿礼服,那么我必须用其他主人的地址更改微服务地址.我不想使用任何主机的静态IP或DNS.

Problem: - Since we have multiple masters and workers inside the cluster we have to use a static IP or DNS for any master at a time. If I want to access any service from outside the cluster I have to use as - IP_ADDRESS:NODEPORT or DNS:NODEPORT. At a time I can use the address of any one master. If that master goes gown then I have to change microservices address with other master's address. I don't want to use a static IP or DNS of any master.

如果没有NodePort,我们有什么更好的方法来公开这些微服务?是否有类似Baremetal的LoadBalancer之类的功能? INGRESSNginx可以帮助我们吗?

What could we a better way to expose these microservices without NodePort? Is there any feature like LoadBalancer over Baremetal? Can INGRESS or Nginx help us?

推荐答案

有Baremetal的LoadBalancer,它称为 METALLB .该项目可在 GitHub 上使用,不幸的是,该解决方案处于alpha状态,而且更为复杂.

There is a LoadBalancer for Baremetal, it's called METALLB. Project is available on GitHub, unfortunately this solution is in alpha state and is more complex.

您也可以按照说明进行操作来自NGINX ,并为TCP或UDP设置轮询方法.

You can also follow the instructions from NGINX and setup round-robin method for TCP or UDP.

Ingress仅通过端口80、443支持http(s). 您当然可以设置自己的入口控制器,但这将需要很多额外的工作.

Ingress only supports http(s) over ports 80, 443 only. You can of course setup your own ingress controller but it will be a lot of extra work.

NodePort的不足之处是有限的可用端口,范围是30000至32767,并且如果计算机的IP发生更改,您的服务将无法访问.

NodePort downside is a limited number of usable ports which is from 30000 to 32767, and if IP of the machine changes your services will be inaccessible.

这篇关于如何在Barematel上运行的kubernetes中公开服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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