Hosting
Kubernetes
OpenClaw को Kubernetes पर चलाने के लिए एक न्यूनतम शुरुआती बिंदु — production-ready deployment नहीं। यह core resources को कवर करता है और इसे आपके environment के अनुसार अनुकूलित करने के लिए बनाया गया है।
Helm क्यों नहीं?
OpenClaw कुछ config files वाला एक single container है। मुख्य customization agent content (markdown files, skills, config overrides) में है, infrastructure templating में नहीं। Kustomize Helm chart के overhead के बिना overlays संभालता है। अगर आपका deployment अधिक जटिल हो जाता है, तो इन manifests के ऊपर Helm chart की layer जोड़ी जा सकती है।
आपको क्या चाहिए
- चल रहा Kubernetes cluster (AKS, EKS, GKE, k3s, kind, OpenShift, आदि)
- आपके cluster से जुड़ा
kubectl - कम से कम एक model provider के लिए API key
Quick start
# Replace with your provider: ANTHROPIC, GEMINI, OPENAI, or OPENROUTERexport <PROVIDER>_API_KEY="..."./scripts/k8s/deploy.sh kubectl port-forward svc/openclaw 18789:18789 -n openclawopen http://localhost:18789Control UI के लिए configured shared secret प्राप्त करें। यह deploy script default रूप से token auth बनाती है:
kubectl get secret openclaw-secrets -n openclaw -o jsonpath='{.data.OPENCLAW_GATEWAY_TOKEN}' | base64 -dLocal debugging के लिए, ./scripts/k8s/deploy.sh --show-token deploy के बाद token print करता है।
Kind के साथ local testing
अगर आपके पास cluster नहीं है, तो Kind के साथ locally एक बनाएं:
./scripts/k8s/create-kind.sh # auto-detects docker or podman./scripts/k8s/create-kind.sh --delete # tear downफिर हमेशा की तरह ./scripts/k8s/deploy.sh के साथ deploy करें।
Step by step
1) Deploy
Option A — environment में API key (एक step):
# Replace with your provider: ANTHROPIC, GEMINI, OPENAI, or OPENROUTERexport <PROVIDER>_API_KEY="..."./scripts/k8s/deploy.shScript API key और auto-generated gateway token के साथ Kubernetes Secret बनाती है, फिर deploy करती है। अगर Secret पहले से मौजूद है, तो यह current gateway token और नहीं बदली जा रही provider keys को preserve करती है।
Option B — secret अलग से बनाएं:
export <PROVIDER>_API_KEY="..."./scripts/k8s/deploy.sh --create-secret./scripts/k8s/deploy.shअगर आप local testing के लिए token को stdout पर print करना चाहते हैं, तो किसी भी command के साथ --show-token का उपयोग करें।
2) Gateway access करें
kubectl port-forward svc/openclaw 18789:18789 -n openclawopen http://localhost:18789क्या deploy होता है
Namespace: openclaw (configurable via OPENCLAW_NAMESPACE)├── Deployment/openclaw # Single pod, init container + gateway├── Service/openclaw # ClusterIP on port 18789├── PersistentVolumeClaim # 10Gi for agent state and config├── ConfigMap/openclaw-config # openclaw.json + AGENTS.md└── Secret/openclaw-secrets # Gateway token + API keysCustomization
Agent instructions
scripts/k8s/manifests/configmap.yaml में AGENTS.md edit करें और redeploy करें:
./scripts/k8s/deploy.shGateway config
scripts/k8s/manifests/configmap.yaml में openclaw.json edit करें। पूरी reference के लिए Gateway configuration देखें।
Providers जोड़ें
Additional keys export करके फिर से चलाएं:
export ANTHROPIC_API_KEY="..."export OPENAI_API_KEY="..."./scripts/k8s/deploy.sh --create-secret./scripts/k8s/deploy.shExisting provider keys Secret में रहती हैं जब तक आप उन्हें overwrite नहीं करते।
या Secret को directly patch करें:
kubectl patch secret openclaw-secrets -n openclaw \ -p '{"stringData":{"<PROVIDER>_API_KEY":"..."}}'kubectl rollout restart deployment/openclaw -n openclawCustom namespace
OPENCLAW_NAMESPACE=my-namespace ./scripts/k8s/deploy.shCustom image
scripts/k8s/manifests/deployment.yaml में image field edit करें:
image: ghcr.io/openclaw/openclaw:latest # primary; official Docker Hub mirror: openclaw/openclaw:latestPort-forward से आगे expose करें
Default manifests gateway को pod के अंदर loopback से bind करते हैं। यह kubectl port-forward के साथ काम करता है, लेकिन ऐसे Kubernetes Service या Ingress path के साथ काम नहीं करता जिसे pod IP तक पहुंचना होता है।
अगर आप gateway को Ingress या load balancer के through expose करना चाहते हैं:
scripts/k8s/manifests/configmap.yamlमें gateway bind कोloopbackसे बदलकर अपने deployment model से matching non-loopback bind करें- Gateway auth enabled रखें और proper TLS-terminated entrypoint का उपयोग करें
- Supported web security model का उपयोग करके remote access के लिए Control UI configure करें (उदाहरण के लिए HTTPS/Tailscale Serve और जरूरत होने पर explicit allowed origins)
Re-deploy
./scripts/k8s/deploy.shयह सभी manifests apply करता है और किसी भी config या secret changes को pick up करने के लिए pod restart करता है।
Teardown
./scripts/k8s/deploy.sh --deleteयह namespace और उसमें मौजूद सभी resources delete करता है, जिसमें PVC भी शामिल है।
Architecture notes
- Gateway default रूप से pod के अंदर loopback से bind होता है, इसलिए included setup
kubectl port-forwardके लिए है - कोई cluster-scoped resources नहीं — सब कुछ एक single namespace में रहता है
- Security:
readOnlyRootFilesystem,drop: ALLcapabilities, non-root user (UID 1000) - Default config Control UI को safer local-access path पर रखता है: loopback bind plus
kubectl port-forwardtohttp://127.0.0.1:18789 - अगर आप localhost access से आगे बढ़ते हैं, तो supported remote model का उपयोग करें: HTTPS/Tailscale plus appropriate gateway bind and Control UI origin settings
- Secrets temp directory में generate होते हैं और directly cluster पर apply किए जाते हैं — repo checkout में कोई secret material नहीं लिखा जाता
File structure
scripts/k8s/├── deploy.sh # Creates namespace + secret, deploys via kustomize├── create-kind.sh # Local Kind cluster (auto-detects docker/podman)└── manifests/ ├── kustomization.yaml # Kustomize base ├── configmap.yaml # openclaw.json + AGENTS.md ├── deployment.yaml # Pod spec with security hardening ├── pvc.yaml # 10Gi persistent storage └── service.yaml # ClusterIP on 18789