
Deploying Docker containers to Kubernetes on DigitalOcean is a great way to learn about Kubernetes while keeping costs low
DigitalOcean offers a managed Kubernetes service (DOKS) that is beginner-friendly and cost-effective. Below is a step-by-step guide to help you deploy your three containers (SuiteCRM, n8n, and Supabase) on a DigitalOcean Kubernetes cluster.
Step 1: Set Up a DigitalOcean Kubernetes Cluster
- Create a DigitalOcean Account (if you don’t have one):
- Sign up at DigitalOcean.
- Use the free $200 credit for new users (if available) to keep costs low.
- Create a Kubernetes Cluster:
- Go to the Kubernetes section in the DigitalOcean dashboard.
- Click Create Cluster.
- Choose the cheapest node size (e.g., the $6/month node with 1 vCPU and 2GB RAM).
- Start with 1 node to keep costs low. You can scale up later if needed.
- Give your cluster a name and click Create Cluster.
- Download the kubeconfig File:
- Once the cluster is ready, download the kubeconfig file to your local machine.
- Set the
KUBECONFIG
environment variable to point to this file:export KUBECONFIG=~/path/to/kubeconfig.yaml
- Verify access to the cluster:
kubectl get nodes
Step 2: Containerize Your Applications
Since you’re already familiar with Docker, you likely have Docker images for SuiteCRM, n8n, and Supabase. If not:
- Create Docker Images:
- Write
Dockerfile
s for each application. - Build and push the images to a container registry (e.g., Docker Hub, GitHub Container Registry, or DigitalOcean Container Registry).
- Write
- Use Pre-Built Images (if available):
- SuiteCRM: Use the official Docker image (
bitnami/suitecrm
). - n8n: Use the official Docker image (
n8nio/n8n
). - Supabase: Use the official Docker image (
supabase/supabase
).
- SuiteCRM: Use the official Docker image (
Step 3: Deploy Applications to Kubernetes
- Create Kubernetes Manifests:
- Write Kubernetes YAML files for each application (Deployment, Service, ConfigMap, etc.).
- Example for n8n:
apiVersion: apps/v1 kind: Deployment metadata: name: n8n spec: replicas: 1 selector: matchLabels: app: n8n template: metadata: labels: app: n8n spec: containers: - name: n8n image: n8nio/n8n ports: - containerPort: 5678 env: - name: N8N_BASIC_AUTH_ACTIVE value: "true" - name: N8N_BASIC_AUTH_USER value: "admin" - name: N8N_BASIC_AUTH_PASSWORD value: "password" --- apiVersion: v1 kind: Service metadata: name: n8n spec: selector: app: n8n ports: - protocol: TCP port: 80 targetPort: 5678 type: LoadBalancer
- Repeat similar steps for SuiteCRM and Supabase.
- Apply the Manifests:
- Deploy the applications using
kubectl
:kubectl apply -f n8n-deployment.yaml kubectl apply -f suitecrm-deployment.yaml kubectl apply -f supabase-deployment.yaml
- Deploy the applications using
- Expose Applications:
- Use
LoadBalancer
Services to expose your applications to the internet. - DigitalOcean will automatically provision a load balancer for each Service, but this will incur additional costs (~$10/month per load balancer).
- To save costs, consider using
ClusterIP
Services and accessing your applications viakubectl port-forward
.
- Use
Step 4: Persist Data
- Use DigitalOcean Block Storage:
- Create PersistentVolumeClaims (PVCs) for each application to store data.
- Example PVC:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: n8n-data spec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi
- Mount Volumes in Your Deployments:
- Update your Deployment manifests to mount the PVCs.
Step 5: Monitor and Optimize Costs
- Monitor Resource Usage:
- Use
kubectl top
to monitor CPU and memory usage. - Adjust resource requests and limits in your manifests to avoid over-provisioning.
- Use
- Scale Down When Not in Use:
- Delete or scale down deployments when not in use to save costs.
- Use Spot Instances:
- DigitalOcean offers cheaper “Spot” nodes for non-critical workloads.
Step 6: Clean Up
- Delete the cluster when you’re done to avoid unnecessary charges.
Estimated Costs
- Kubernetes Node: $6/month (1 node).
- Load Balancers: $10/month each (optional, depending on how you expose your apps).
- Block Storage: $0.10/GB/month.
Total: ~$16–$36/month (depending on load balancers and storage usage).
This setup should give you a good hands-on experience with Kubernetes while keeping costs low.
Further reading: Let’s break down the relationship between Docker and Kubernetes, and how they can be used together on a platform like DigitalOcean. Read more
#Kubernetes #Docker #DigitalOcean #CloudComputing #DevOps #Containerization #SuiteCRM #n8n #Supabase #ManagedKubernetes #DOKS #CloudInfrastructure #CostOptimization #LoadBalancers #PersistentStorage #KubernetesTutorial #KubernetesForBeginners #CloudTips #TechTutorial #SpotInstances