简体   繁体   中英

How to run Express with NGINX in Kubernetes

I am having a hard time understanding how to run a Node.js Express server with NGINX as a reverse proxy with a Dockerfile and how to deploy this on a platform like Kube.netes.

After reading many posts and tutorials, it seems that many people recommend having two Dockerfiles; one for the Node.js server and one for the NGINX reverse proxy. Is there a way to somehow combine both into one Dockerfile and if so, is this a recommended approach?

Suppose there are two Dockerfiles, how would this work with deploying on Kube.netes? Would I have two deployments (one for the Node server and one for NGINX)?

Thank you all, any help is appreciated!

To start, I'd say that you need to spend some more time first understanding how Kube.netes works because there is definitely some knowledge you need to fill in. This makes it easier to answer the next question - why are you using Kube.netes?

You are deploying a simple web server behind a reverse proxy? You can do this by running a containerized version of your app as a K8s pod , expose that pod's port and use a K8s service to expose that pod as an endpoint. If you have something that manages DNS, use an K8s ingress which supports nginx.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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