Kubernetes Deployment
The following instructions use Minikube for local testing.
See kubernetes/ in the repository for the manifest files.
Quick Start (Minikube)
# Build the job-orchestrator image (server, and base for clients)
docker build -t job-orchestrator-server .
# Build the example client image (adds gdock on top of the local image)
docker build --build-arg BASE_IMAGE=job-orchestrator-server -t job-orchestrator-client example/
# Load into Minikube
minikube image load job-orchestrator-server
minikube image load job-orchestrator-client
# Apply manifests
minikube kubectl -- apply -f kubernetes/
# Get the external IP
minikube service job-orchestrator-server --url
Usage
# Set the base URL
export URL=$(minikube service job-orchestrator-server --url)
# Submit a job
curl -X POST $URL/upload \
-F "file=@run.sh" \
-F "user_id=1" \
-F "service=example"
# Check status
curl $URL/download/1
Security Hardening
The manifests in kubernetes/ already apply the following hardening measures:
| Measure | Implemented |
|---|---|
Run as non-root (runAsUser: 1000, runAsNonRoot: true) | Both server and client |
| Read-only root filesystem | Both server and client |
| Drop all capabilities | Both server and client |
Seccomp profile (RuntimeDefault) | Both server and client |
| CPU and memory resource limits | Both server and client |
| NetworkPolicy restricting client ingress to the server and egress to the server and DNS | Client |
NetworkPolicy enforcement: NetworkPolicies only take effect if the cluster’s network plugin enforces them. Minikube’s default setup does not; start it with a plugin that does, for example minikube start --cni=calico.
PID limits: Kubernetes has no per-container PID limit in resources.limits, and LimitRange cannot set one either. Configure it on the node with the kubelet’s podPidsLimit setting (--pod-max-pids), which applies to every pod on that node.
Scaling: keep replicas: 1 for both deployments. The server uses SQLite on a ReadWriteOnce volume, and a second client replica behind the same Service would break result retrieval (payload IDs are local to each client).