swadhinbiswas infra: add Dockerfile, Helm chart, and multi-cloud deployment guides · 7/10/2026
f04bfef
89 lines · 2.0 KB
Raw Download

Deploy JustAPI to Google Kubernetes Engine (GKE)

Prerequisites

  • gcloud CLI installed and authenticated
  • kubectl installed
  • helm installed (v3+)
  • A GCP project with billing enabled

1. Create a GKE cluster

PROJECT_ID="your-project-id"
gcloud config set project $PROJECT_ID

gcloud container clusters create justapi-cluster \
  --region us-central1 \
  --num-nodes 3 \
  --machine-type e2-standard-2 \
  --enable-autoscaling --min-nodes 3 --max-nodes 10

2. Get cluster credentials

gcloud container clusters get-credentials justapi-cluster --region us-central1

3. Install NGINX Ingress Controller

helm upgrade --install ingress-nginx ingress-nginx \
  --repo https://kubernetes.github.io/ingress-nginx \
  --namespace ingress-nginx --create-namespace

4. Install cert-manager for TLS

helm repo add jetstack https://charts.jetstack.io
helm repo update
helm upgrade --install cert-manager jetstack/cert-manager \
  --namespace cert-manager --create-namespace \
  --set installCRDs=true

5. Build and push Docker image

# Build for linux/amd64
docker build -t gcr.io/$PROJECT_ID/justapi:latest .
docker push gcr.io/$PROJECT_ID/justapi:latest

6. Deploy with Helm

helm upgrade --install justapi ./helm/justapi \
  --set image.repository=gcr.io/$PROJECT_ID/justapi \
  --set image.tag=latest \
  --set ingress.hosts[0].host=api.yourdomain.com \
  --set secrets.db.url="postgres://..." \
  --set secrets.redis.url="redis://..."

7. Expose via Cloud Load Balancer

The NGINX ingress will provision a GCP HTTP(S) Load Balancer automatically.

kubectl get ingress
# Wait for the ADDRESS field to populate

8. Configure DNS

Point your domain's A record to the load balancer IP (or use external-dns for automatic DNS).

Verification

curl https://api.yourdomain.com/health
# {"status":"healthy","components":[]}
curl https://api.yourdomain.com/ready
# {"ready":true}
curl https://api.yourdomain.com/live
# {"alive":true}