What is the point of nginx when I have Kubernetes? What is the point of nginx when I have Kubernetes? kubernetes kubernetes

What is the point of nginx when I have Kubernetes?


Kubernetes is load balancing the requests to your app. Now it is up to you whether you want to expose your app directly or you want to use a WebServer in front of it.

Putting Nginx in front of it would allow you to have things like access logs, error logs, caching, serving static files etc... There are cases where you may want to have your app exposed directly (this is usually the case when you build applications in GoLang)

So Nginx is not a must inside a pod, but it depends on your architecture design whether you want it or not


There can be several reasons why people run an instance of Nginx in a Pod. The most common use case is to serve static assets. For this purpose, Apache or lighttpd will play the same role as well. Without seeing the tutorials, I can't shed light on what role Nginx plays .

Since you mentioned "tutorials", I suspect it's just to serve a static page to say "Hey I'm here! You've successfully deployed something that works.".

To answer your question on k8s handling load-balancing - it does. The Service object does Layer-3 (ie. IP layer) load-balancing between associated pods, and the Ingress object does the same but on Layer-7 (eg. HTTP). Such load-balancing is on a cluster-wide basis.

To summarise, the Nginx in tutorials are likely there just to serve static assets, and k8s load-balances cluster-wide.


nginx is webserver like apache http server or tomcat web server. nginx docker image small in size compared to other webservers. It will take less time to download and start the webserver. That’s why everyone uses it during learning phase of container.

Kubernetes is used to manage the containerized applications like (nginx, mysql, and tomcat etc.).