Skip to content

Deploy to Kubernetes

Deploy your Jac application to Kubernetes with a single command.

Prerequisites

  • Completed: Local API Server
  • Kubernetes cluster running (minikube, Docker Desktop, or cloud provider)
  • kubectl configured
  • jac-scale installed: pip install jac-scale
  • Time: ~10 minutes

jac start --scale handles everything automatically:

  • Deploys your application to Kubernetes
  • Auto-provisions Redis (caching) and MongoDB (persistence)
  • Creates all necessary Kubernetes resources
  • Exposes your application via NodePort
graph TD
subgraph cluster["Kubernetes Cluster (Auto-Created)"]
subgraph app["Application"]
P1["Pod: jac-app"]
end
subgraph data["Data Layer (Auto-Provisioned)"]
R["Redis<br/>Caching"]
M["MongoDB<br/>Persistence"]
end
P1 --> R
P1 --> M
end
LB["NodePort :30001"] --> P1

# app.jac
node Todo {
has title: str;
has done: bool = False;
}
walker:pub add_todo {
has title: str;
can create with Root entry {
todo = here ++> Todo(title=self.title);
report {"id": todo[0].id, "title": todo[0].title};
}
}
walker:pub list_todos {
can fetch with Root entry {
todos = [-->](?:Todo);
report [{"id": t.id, "title": t.title, "done": t.done} for t in todos];
}
}
walker:pub health {
can check with Root entry {
report {"status": "healthy"};
}
}
jac start app.jac --scale

That’s it. Your application is now running on Kubernetes.

Access your application:


Deploys without building a Docker image. Fastest for iteration.

jac start app.jac --scale

Builds a Docker image and pushes to DockerHub before deploying.

jac start app.jac --scale --build

Requirements for production mode:

Create a .env file with your Docker credentials:

DOCKER_USERNAME=your-dockerhub-username
DOCKER_PASSWORD=your-dockerhub-password-or-token

Configure deployment via environment variables in .env:

VariableDescriptionDefault
APP_NAMEName of your applicationjaseci
K8s_NAMESPACEKubernetes namespacedefault
K8s_NODE_PORTPort for accessing the app30001
VariableDescriptionDefault
K8s_CPU_REQUESTCPU request-
K8s_CPU_LIMITCPU limit-
K8s_MEMORY_REQUESTMemory request-
K8s_MEMORY_LIMITMemory limit-
VariableDescriptionDefault
K8s_READINESS_INITIAL_DELAYReadiness probe delay (seconds)10
K8s_READINESS_PERIODReadiness probe interval20
K8s_LIVENESS_INITIAL_DELAYLiveness probe delay (seconds)10
K8s_LIVENESS_PERIODLiveness probe interval20
VariableDescriptionDefault
K8s_MONGODBEnable MongoDBTrue
K8s_REDISEnable RedisTrue
MONGODB_URIExternal MongoDB URLAuto-provisioned
REDIS_URLExternal Redis URLAuto-provisioned
VariableDescriptionDefault
JWT_SECRETJWT signing keyAuto-generated
JWT_EXP_DELTA_DAYSToken expiration (days)7
SSO_GOOGLE_CLIENT_IDGoogle OAuth client ID-
SSO_GOOGLE_CLIENT_SECRETGoogle OAuth secret-

kubectl get pods
kubectl get services
kubectl logs -l app=jaseci -f

Remove all Kubernetes resources created by jac-scale:

jac destroy app.jac

This removes:

  • Application deployments and pods
  • Redis and MongoDB StatefulSets
  • Services and persistent volumes
  • ConfigMaps and secrets

When you run jac start --scale, the following happens automatically:

  1. Namespace Setup - Creates or uses the specified Kubernetes namespace
  2. Database Provisioning - Deploys Redis and MongoDB as StatefulSets with persistent storage (first run only)
  3. Application Deployment - Creates a deployment for your Jac application
  4. Service Exposure - Exposes the application via NodePort

Subsequent deployments only update the application - databases persist across deployments.


  1. Install Docker Desktop
  2. Open Settings > Kubernetes
  3. Check “Enable Kubernetes”
  4. Click “Apply & Restart”
# Install minikube
brew install minikube # macOS
# or see https://minikube.sigs.k8s.io/docs/start/
# Start cluster
minikube start
# For minikube, access via:
minikube service jaseci -n default
sudo snap install microk8s --classic
microk8s enable dns storage
alias kubectl='microk8s kubectl'

# Check pod status
kubectl get pods
# Check service
kubectl get svc
# For minikube, use tunnel
minikube service jaseci
# Check StatefulSets
kubectl get statefulsets
# Check persistent volumes
kubectl get pvc
# View database logs
kubectl logs -l app=mongodb
kubectl logs -l app=redis
  • Ensure Docker daemon is running
  • Verify .env has correct DOCKER_USERNAME and DOCKER_PASSWORD
  • Check disk space for image building
# Describe a pod for events
kubectl describe pod <pod-name>
# Get all resources
kubectl get all
# Check events
kubectl get events --sort-by='.lastTimestamp'

# Create a new full-stack project
jac create todo --use client
cd todo
# Deploy to Kubernetes
jac start app.jac --scale

Access: