我应该使用哪个入口控制器来支持 kops 部署的 AWS k8s 集群中的 WebSocket?

Which ingress controller should I use to support WebSocket in a AWS k8s cluster deployed by kops?

我在 AWS 上通过 kops 安装了一个集群。现在我需要向外界公开一个 WebSocket 服务(启用了安全性,wss://)。有不同的入口控制器、nginx、traefik、ELB、ALB。建议选择哪一个:

在我看来,这个问题是基于个人观点的,过于宽泛。请尽量避免这样的问题,因为没有一种解决方案是最好的。

我找到了大量关于 nginx 和 websockets 的资源。我没有配置这个的生产经验,但我想你可能会发现这很有用。

NGINX is a popular choice for an Ingress Controller for a variety of features:

  • Websocket, which allows you to load balance Websocket applications.

  • SSL Services, which allows you to load balance HTTPS applications.

  • Rewrites, which allows you to rewrite the URI of a request before sending it to the application.

  • Session Persistence (NGINX Plus only), which guarantees that all the requests from the same client are always passed to the same backend container.

  • Support for JWTs (NGINX Plus only), which allows NGINX Plus to authenticate requests by validating JSON Web Tokens (JWTs).

nginx 最重要的部分是 annotation - which specifies which services are Websocket services. Some more information about usage and configuration. Also useful tutorial 关于 nginx ingress 的配置,尽管它是关于 GKE 的,但它可能会有用。