How to expose a service in kubernetes running on Barematel

痞子三分冷 提交于 2019-12-11 17:15:42

问题


Kubernetes Version: 1.10 Running on Barematel

No. of masters: 3

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.

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.

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?


回答1:


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.

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

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



来源:https://stackoverflow.com/questions/53513318/how-to-expose-a-service-in-kubernetes-running-on-barematel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!