Kubernetes 和 Service Mesh 负载均衡不一致

发布于 2025-01-09 05:48:01 字数 542 浏览 0 评论 0原文

Kubernetes 通过其 kube-proxy 支持 Pod 负载平衡和会话关联。 Kubernetes 的 kube-proxy 本质上是一个 L4 负载均衡器,因此我们不能依赖它来负载均衡 L7 传输,例如多个 gRPC 实时连接或基于 http-headers、cookie 等的负载均衡。

Service Mesh 实现如 istio 可以在 L7 级别处理这些模式,包括 gRPC。但我一直认为 Service Mesh 只是 Kubernetes 之上的另一层,具有附加功能(加密流量、蓝/绿部署等)。例如,我的假设始终是 Kubernetes 应用程序应该能够在没有 Mesh(例如用于开发/测试)或启用 Mesh 的普通 Kubernetes 上工作。在 L7 上添加这种高级流量管理打破了这一假设。我将无法再在普通 Kubernetes 上工作,我将依赖于 Istio dataplane(Envoy)的特定实现。

请告诉我我的假设是否正确或为什么不正确?互联网上关于这种类型的关注点分离的信息并不多。

Kubernetes has a support of Pod load-balancing, session affinity through its kube-proxy. Kubernetes’ kube-proxy is essentially an L4 load balancer so we cannot rely on it to load balance L7-transport, e.g. muliple gRPC live connections or load-balancing based on http-headers, cookies, etc.

Service Mesh implementation like e.g. istio can handle these patterns on L7-level including gRPC. But I always thought that Service Mesh is just another layer on top of Kubernetes with additional capabilities(encrypted traffic, blue/green deployments/etc). E.g. My assumption always was that Kubernetes applications should be able to work on both vanilla Kubernetes without Mesh (e.g. for development/testing) or with a Mesh on. Adding this advanced traffic management on L7 breaks this assumption. I won't be able to work on a vanilla Kubernetes anymore, I will be tied to a specific implementation of Istio dataplane(Envoy).

Please let know if my assumption is correct or why not? There's not much information about this type of separation of concerns on this internet.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墟烟 2025-01-16 05:48:02

首先请允许我参考一下你的以下发言:

我的假设始终是 Kubernetes 应用程序应该能够
可以在没有 Mesh 的情况下在普通 Kubernetes 上工作(例如
开发/测试)或打开网格。添加此高级流量
L7 的管理打破了这一假设。

我对此有不同的看法,服务网格对应用程序是透明的,因此它们不会破坏其中的任何内容,而只是免费添加额外的(网络、安全、监控)功能(好吧,配置相当复杂)从网格操作员的角度来看)。像 Istio 这样的服务网格不需要占用所有 K8S 命名空间,因此您仍然可以在集群中拥有混合类型的工作负载(带或不带代理)。如果我们谈论 Istio,为了实现它们之间的完全互操作性(混合工作负载),您可以将其两个功能组合在一起:

  • 对等身份验证设置为 PERMISSIVE,以便没有 sidecar(代理)的工作负载可以接受相互 TLS 和纯文本流量。
  • 手动协议选择,例如,如果您更喜欢应用程序使用原始 TCP,而不是由 Envoy 本身确定的应用程序协议(例如 http),以避免代理注入额外的修饰来拦截请求。

或者,您可以编写自己的自定义 tcp_proxy EnvoyFilter 以使用 Envoy 作为 L4 网络代理。

参考文献:

https://istio.io/latest/docs/reference /config/networking/envoy-filter/
https://istio.io/latest/docs/concepts/security/#对等身份验证
https://istio.io/latest/docs/ops /配置/流量管理/协议选择/

Let me refer first to the following statement of yours:

My assumption always was that Kubernetes applications should be able
to work on both vanilla Kubernetes without Mesh (e.g. for
development/testing) or with a Mesh on. Adding this advanced traffic
management on L7 breaks this assumption.

I have different view at that, Service Meshes are transparent to the application, so they don't break anything in them, but just add an extra (network, security, monitoring) functions at no cost (ok, the cost it quite complex configuration from Mesh operator perspective). The Service Mesh like Istio doesn't need to occupy all K8S namespaces, so you can still have mixed type of workloads in your cluster (with and w/o proxies). If we speak about Istio, to enable full interoperatbility between them (mixed workloads) you may combine two its features together:

  • Peer authentication set to PERMISSIVE, so that workloads without sidecars (proxy) can accept both mutual TLS and plain text traffic.
  • Manual protocol selection, e.g. if you prefer your app speak raw TCP instead of app protocol determined by Envoy itself (e.g. http) - to avoid extra decorations injected by proxy to intercepted requests.

Alternatively you can write your own custom tcp_proxy EnvoyFilter to use Envoy as a L4 network proxy.

References:

https://istio.io/latest/docs/reference/config/networking/envoy-filter/
https://istio.io/latest/docs/concepts/security/#peer-authentication
https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文