通过TCP/UDP而不是Loadbalancer在外部公开服务 [英] Expose a service externally in TCP/UDP other than Loadbalancer

查看:84
本文介绍了通过TCP/UDP而不是Loadbalancer在外部公开服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要

  • 将一些Pod直接暴露在节点上,用于TCP& UDP
  • 能够分别从外部访问它们

我想避免为每个Pod创建一个loadbancer服务,因为它不需要负载平衡,而只需要暴露在外界即可.

I would like to avoid creating a loadbancer service for each pod as there is no need of loadbalancing, just the exposure to outside world.

我看不到Service或Ingress的任何解决方案.

I don see any solution with Service or Ingress.

这一切都发生在GKE中.

All this happens in GKE.

有人会有想法吗?

谢谢!

推荐答案

如果可以从外部访问您的节点,则只需hostNetwork: true就可以摆脱,但是它存在一些潜在的问题(即,只有一个吊舱)每个主机或潜在端口与节点上的其他内容冲突).您不需要为此定义任何服务,因为它只会侦听您的节点端口(需要在防火墙,安全策略或任何保护您的节点免受外部环境影响的端口上打开它们).

If your nodes are accessible from the outside world you can get away with just hostNetwork: true, there are some potential issues with it though (ie. just one pod per host or potential port conflicts with other stuff on node). You don't need any service defined for it, as it will just listen on your nodes ports (need to have them open on firewall, security policies or whatever guards your nodes from external world).

任何使用服务(可能无头的服务除外)都将导致所有后备Pod(群集IP,NodePort或LB)之间的负载平衡,但是只有LB服务会为您提供专用的外部IP.

Any use of service (except for maybe headless one) will result in a loadbalancing between all backing pods (be it ClusterIP, NodePort or LB), but only LB service will give you a dedicated external IP.

这篇关于通过TCP/UDP而不是Loadbalancer在外部公开服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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