#How to deploy NestJS app to Kubernetes from CI?

6 messages · Page 1 of 1 (latest)

tiny hinge
#

Hello. I am very new to containerizing apps and deploying them to kubernetes and I don't quite understand the concept of it. Are there any guides and best-practices for deploying NestJS/NodeJS apps I could reuse in my project? Do I understand it correctly that:

  1. I need to build NestJS on CI
  2. Copy build artifacts to docker image
  3. Upload docker image to remote host with kubernetes

Or should this flow be different? Thanks.

austere orbit
#

You upload the container image (isn't necessary to be Docker) to a registry and k8s will download it from there.

So, you need to have a process that gets

  1. The container built and into the registry
  2. Update k8s app config, so that the new container is loaded.

Check out Argo-CD for the second point. https://argo-cd.readthedocs.io/en/stable/

You can use all sorts of workflow tools for the first one, like Github Actions or if your are inclined, Argo-Workfllows. Argo-Workflows are more about internal activity in the cluster though, so if you aren't developing inside the cluster, it might not fit. Jenkins is also often used. Like I said, lots of tools for the build process available.

midnight jolt
#

If you are a beginner I would keep it simple:

  • build and push the container image
  • Run the kubectl/Helm command from your CD to deploy the new tag

Argo/Flux are amazing but require a good understanding of K8s

austere orbit
#

haha... using k8s itself requires a good understanding of k8s.

midnight jolt
#

Agree
(Just use Cloud run, ECS, or whatever if there is no K8s need 😅 )

austere orbit
#

Those still need an understanding of k8s. But, I must say, once k8s is understood, it opens up all kinds of possibilities. I always feel like a kid in a candy shop. 😄