Development - Kubernetes
This guide covers deploying Watcher to Kubernetes using Helm charts for local development.
Prerequisites
Before deploying Watcher to Kubernetes for local development, ensure you have the following installed:
Docker Desktop with Kubernetes enabled
kubectl - Kubernetes command-line tool
Helm - Kubernetes package manager
Note
Kubernetes Cluster Required: Make sure Docker Desktop’s Kubernetes cluster is running. You can enable it in Docker Desktop settings under “Kubernetes” and ensure the cluster is started.
Installation Steps
Install kubectl
brew install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
choco install kubernetes-cli
Install Helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
choco install kubernetes-helm
Verify Installation
kubectl version --client
helm version
Deploy to Kubernetes
Quick Start with Make Commands (Recommended)
The easiest way to deploy is using the provided Make commands:
# Complete development deployment with one command
make dev-kube
This single command will:
Build the Docker image
Start PostgreSQL and Redis dependencies from Docker Compose
Deploy to Kubernetes with Helm using NodePort service
Expose the service on port 8000
Access Your Application
After running make dev-kube, you can access:
Main Application: http://localhost:8000
API Documentation: http://localhost:8000/scalar
Note
NodePort Service: The service is exposed directly on port 8000, so no port forwarding or external IP needed!
Stop the Development Environment
To stop the development environment:
# In a new terminal window
make dev-kube-stop
This will:
Remove the Helm deployment
Stop all dependencies
Clean up resources
Manual Development Setup - Alternative
If you prefer to run commands manually for development:
Start Dependencies
Start PostgreSQL and Redis using docker-compose:
docker-compose up -d postgres redis
Verify services are running:
docker-compose ps
Build Docker Image
Build the Watcher Docker image:
docker build -t watcher:latest .
Deploy with Helm
Deploy using Helm:
helm install watcher ./watcher
Check deployment status:
kubectl get pods
kubectl get services
Access the Application
With NodePort service configured, access the application via:
Health Check: http://localhost:8000
API Documentation: http://localhost:8000/scalar
Note
NodePort Service: The service is exposed directly on port 8000, making it simple to access for development.
Cleanup
Remove the Deployment
helm uninstall watcher
docker-compose down
Note
Don’t forget to stop the Kubernetes cluster in Docker Desktop!