Question

Deploy Containers using API or any other best practice

Hello DigitalOcean,

We are A SaaS company ( CRM ) we would like to create a container per customer. and we would like to know the best way to do that. is there any Rest API or an ideas to start with

Thank you

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

If you really want to deploy individual containers per customer, I would recommend AWS ECR to store the images because it’s the best in price. You can fetch images from ECR into DigitalOcean K8s using my tool: https://hub.docker.com/r/nabsul/k8s-ecr-login-renew

However, from a higher level, my guess is that building separate containers per customer might not be the most scalable way to run your SaaS service. You would be better off having a single service (container) that can server all your customers, each with their own separate data.

Hello,

This would depend on the CI/CD tool that you are using, but with GitLab, this is quite straightforward to do as described here:

https://www.digitalocean.com/community/questions/how-to-connect-gitlab-project-to-kubernetes-cluster

Prerequisites:

  • ItemDeploy a K8s cluster on DigitalOcean. If you do not have that already, here’s how to do it:

https://www.digitalocean.com/docs/kubernetes/how-to/create-clusters/

  • Follow the instructions on how to install kubectl and connect to the cluster. You can follow the steps here:

https://www.digitalocean.com/docs/kubernetes/how-to/connect-to-cluster/

  • Create an account with Gitlab.com

  • Create your GitLab project

Once you have all that ready, you could follow the steps on the official GitLab website, they have really good documentation on how to add an existing Kubernetes cluster to your project:

https://docs.gitlab.com/ee/user/project/clusters/#add-existing-kubernetes-cluster

The best thing is that once you’ve added the cluster, you can just install applications like Helm Tiller and Prometheus, directly via your GitLab interface with just one click.

Alternatively, this can also be done with GitHub Actions as described in this blog post here:

https://www.digitalocean.com/blog/how-to-deploy-to-digitalocean-kubernetes-with-github-actions/

Regarding the DigitalOcean API, there is very good documentation which you could find here:

https://docs.digitalocean.com/reference/api/api-reference/

Hope that this helps! Regards, Bobby