Should I run nginx in every Kubernetes pod?

6/12/2019

I have a kubernetes cluster with 20 worker nodes. My main application is a Flask API that serves thousands of android/ios requests per minute. The way my Kubernetes deployment is configured is that each pod has 2 containers - flask/python server and nginx. The flask app runs on-top of gunicorn with meinheld workers (20 workers per pod).

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?

NOTE: I am using ELB to route external traffic to my internal k8s cluster.

-- odannyc
gunicorn
kubernetes
nginx

2 Answers

6/12/2019

I don't see any reason to have a nginx container for every other flask container. You can have one nginx container as API gateway to your entire set of apis

-- arjun sahasranam
Source: StackOverflow

6/12/2019

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.

Check de documentation 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.

-- wolmi
Source: StackOverflow