简体   繁体   English

我应该在每个Kubernetes容器中运行Nginx吗?

[英]Should I run nginx in every Kubernetes pod?

I have a kubernetes cluster with 20 worker nodes. 我有一个带有20个工作节点的kubernetes集群。 My main application is a Flask API that serves thousands of android/ios requests per minute. 我的主要应用程序是Flask API,每分钟可处理数千个android / ios请求。 The way my Kubernetes deployment is configured is that each pod has 2 containers - flask/python server and nginx. 我的Kubernetes部署的配置方式是每个pod都有2个容器-flask / python服务器和nginx。 The flask app runs on-top of gunicorn with meinheld workers (20 workers per pod). 长颈瓶应用程序由持执事的工人(每个吊舱20个工人)在Gunicorn顶部运行。

My question is: do I need to be running nginx in each of the pods alongside the flask app or can I just use a main nginx ingress controller as a proxy buffering layer? 我的问题是:我是否需要在flask应用程序旁边的每个Pod中运行Nginx,还是可以仅使用主要的Nginx入口控制器作为代理缓冲层?

NOTE: I am using ELB to route external traffic to my internal k8s cluster. 注意:我正在使用ELB将外部流量路由到我的内部k8s集群。

Is not too strange to have a proxy on every pod, in fact, istio injects one envoy container per pod as a proxy to control de ingress and egress traffic and also to having more accurate metrics. 在每个吊舱上都没有代理并不奇怪,事实上,istio为每个吊舱注入一个特使容器作为代理来控制进出流量,并具有更准确的度量标准。

Check de documentation https://istio.io/ 检查文档https://istio.io/

But if you don't want to manage a service mesh by the moment you can avoid the nginx and use directly the port mapping on the services an ingress definition. 但是,如果您暂时不想管理服务网格,则可以避免使用nginx并直接在入口定义上使用服务上的端口映射。

I don't see any reason to have a nginx container for every other flask container. 我看不到任何其他烧瓶容器都装有Nginx容器的理由。 You can have one nginx container as API gateway to your entire set of apis 您可以使用一个Nginx容器作为通往整个API集的API网关

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM