如何从外部访问K8s的法兰绒网络 [英] How to access K8s's flannel network from outside

查看:113
本文介绍了如何从外部访问K8s的法兰绒网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个K8s设置1个主人和1个小兵.我想使用Pod上的外部负载均衡器(HaProxy)手动负载均衡流量.为此,我决定使用"无头服务"来获取直接的POD IP.

I have a K8s setup 1 master and 1 minion. I want to load balance the traffic with external load balancer(HaProxy) manually on pods. For that I decided to use "Headless Service" to get direct POD IPs.

现在有第三个节点(负载均衡器)需要通过依赖网络访问POD或法兰绒.有什么方法可以加入K8s绒布网络中的第3个节点.或者我可以添加任何路由以将流量重定向到法兰绒网络.

Now there is a 3rd node(Load Balancer) needs to access the POD or flannel over rely network. Is there any way to join the 3rd node in flannel network of K8s setup. Or can I add any routes to redirect the traffic to flannel network.

P.S K8s设置(1个主控+ 1个Minion)和第3个节点(负载均衡器)在同一子网中.

P.S K8s setup(1 Master + 1 Minion) and 3rd Node(load balancer) are in same subnet.

推荐答案

您可以签出 HAProxy入口控制器:

HAProxy非常快速且资源高效,可让您获得 充分利用基础架构,并最大程度地减少延迟 高流量场景.它还带来了几乎无穷无尽的 调整和自定义选项. HAProxy的功能,例如动态 在不重新加载的情况下进行缩放和重新配置也非常有价值 在这种用例中,Kubernetes Pod通常是生成,终止和 大量快速迁移,特别是在 部署.

HAProxy is extremely fast and resource-efficient allowing you to get the most out of your infrastructure and minimize latencies in high-traffic scenarios. It also brings an almost endless list of options for tuning and customization. HAProxy’s features like dynamic scaling and reconfiguration without reloading are also very valuable in this use case as Kubernetes pods are often spawned, terminated, and migrated in quick bursts and in high amounts, especially during deployments.

我们将使用以下位置提供的HAProxy Ingress Controller实现 jcmoraisjr/haproxy-ingress .这是HAProxy的一个项目 技术部门贡献了使Ingress Controller成为可能的代码 以利用HAProxy Runtime API. (另一个有用的HAProxy 您可能要研究的Ingress Controller实现是 appscode/voyager .)

We will use the HAProxy Ingress Controller implementation available at jcmoraisjr/haproxy-ingress. It is a project to which HAProxy Technologies has contributed code that enables the Ingress Controller to take advantage of the HAProxy Runtime API. (Another useful HAProxy Ingress Controller implementation that you could look into would be appscode/voyager.)

此解决方案的主要优点是 HAProxy入口控制器在Kubernetes集群内部本地运行,并且可以使用ConfigMap轻松配置.这意味着HAProxy入口控制器将使用Flannel覆盖网络,而无需任何其他配置.

The main advantage of this solution is that the HAProxy ingress controller runs natively inside the Kubernetes cluster, and can be easily configured using ConfigMap. It means that HAProxy ingress controller will use the Flannel overlay network without any additional configuration.

如果您决定尝试一下,本手册可能会有所帮助:

This manual could be helpful if you decide to give it a try:

更新:
如果要在群集外部的实例上使用Flannel,请阅读此手册:

Update:
If you want to use Flannel on the instances outside of the cluster consider reading this manual:

这篇关于如何从外部访问K8s的法兰绒网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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