Production readiness outcome
A protected, recoverable deployment with known limits
Complete this guide before admitting production users or running business-critical Agents.
- Production and staging state are isolated.
- Deployment, runtime access, and stable keys have explicit owners.
- Data can be restored from an externally managed recovery set.
- Releases pass through staging, backup, and post-deploy verification.
- Operators understand the default single-replica availability boundary.
Overview
A running Kubernetes installation is the starting point. Production readiness adds controls that the default Helm charts do not create automatically.
This guide assumes you have completed the self-hosted configuration, deployed Agent Barn to Kubernetes, and verified the API, UI, databases, ingress, and Agent lifecycle.
Production baseline
The repository supplies a functional single-cluster platform. The matrix makes the remaining operator responsibilities explicit.
| Requirement | Default support | Operator action |
|---|---|---|
| Environment separation | Production and staging namespaces | Supply distinct keys, databases, hosts, and kubeconfigs |
| TLS ingress | Traefik and cert-manager integration | Configure DNS, issuer, and certificate monitoring |
| Persistent databases | Single-replica PostgreSQL StatefulSets | Select durable storage and external backups |
| Agent workspaces | One PVC per Agent | Back up PVCs when continuity is required |
| Background processing | Redis, worker, and reconciliation CronJob | Monitor worker, Redis, and Event Delivery health |
| Monitoring | Prometheus, Grafana, and Alertmanager | Route alerts and add cluster-capacity monitoring |
| Stable secrets | Kubernetes Secrets | Keep authoritative copies in a protected secret manager |
| High availability | Not provided | Design and validate a custom HA architecture if required |
| Autoscaling | Not provided | Capacity-plan and add tested controls if required |
| Network isolation | Internal ClusterIP Services | Add cluster-compatible NetworkPolicies or equivalent controls |
| Database recovery | Not provided | Configure retention, encryption, backups, and restore tests |
| Deployment approval | Branch-triggered workflow | Protect main and require review before merge |
Before you begin
Assign a production owner, security contact, and on-call operator. Document availability, recovery point, recovery time, retention, maintenance-window, and provider-budget requirements.
Estimate concurrent Agents, message and Tool Call volume, storage growth, and provider rate limits. Prepare:
- A staging namespace and environment-specific kubeconfigs
- A protected secret manager
- A backup system compatible with PostgreSQL and the selected StorageClass
- Production DNS control and an operator-monitored alert destination
- A tested release artifact or protected deployment workflow
Isolate production and staging
The standard layout deploys two namespace-isolated stacks into the same cluster.
agent-farmProduction keys, data, DNS, kubeconfigs, and senderagent-farm-stagingStaging-only keys, data, DNS, kubeconfigs, and senderNAMESPACE=agent-farm
ENVIRONMENT=productionNAMESPACE=agent-farm-staging
ENVIRONMENT=stagingOnly the Kubernetes namespaces retain the agent-farm name after the Agent Barn rebrand, preserving existing workloads and PVC continuity.
Namespace isolation is not a separate cluster or provider security boundary. Use distinct application and LiteLLM database passwords, signing and encryption keys, bootstrap administrators, kubeconfigs, hosts, and sender subdomains.
The current workflow shares the registry, OpenRouter, Google OAuth, Cloudflare account and token, Slack alert webhook, Firecrawl password, and Firecrawl key unless operators change it. Shared inputs also share quota, revocation, and failure impact.
Verify that the staging API receives its release namespace as K8S_NAMESPACE; otherwise it can fall back to production when creating Agent workloads.
kubectl get deployment agentbarn-api \
--namespace agent-farm-staging \
-o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="K8S_NAMESPACE")].value}{"\n"}'Expected: agent-farm-staging.
Protect the deployment path
The GitHub workflow runs on pushes to main and staging, and on manual dispatch. Manual dispatch is accepted only from those branches. Production deploys from main into agent-farm; staging deploys from staging into agent-farm-staging.
Understand change detection and concurrency
- Change detection compares with the latest successful deployment on the same branch.
- A failed deployment does not advance that baseline.
- Manual dispatch or an unavailable baseline builds all four Agent Barn images.
- Branch-group concurrency does not cancel an in-progress deployment when a newer run starts.
Understand image behavior
| Image | Production | Staging |
|---|---|---|
| API | latest | latest-staging |
| UI | latest | latest-staging |
| Hermes | Version-file tag | Version-file tag with -staging |
| OpenClaw | Version-file tag | Version-file tag with -staging |
The workflow stamps the git SHA into pod templates, forcing API and UI rollouts even though their branch tag moves. Use explicit, mutually compatible tags for a manual release bundle.
Protect stable keys and credentials
Keep authoritative production values in a protected secret manager. Store signing and encryption keys, database passwords, provider tokens, registry credentials, API-facing Kubernetes access, Grafana credentials, and alert webhooks outside populated repository files.
| Stable secret | Restore with |
|---|---|
SECRET_SIGNING_KEY | Active Agent Barn authentication sessions |
AGENT_TOKEN_ENCRYPTION_KEY | The application database containing encrypted credentials and Agent keys |
LITELLM_MASTER_KEY | The LiteLLM database and virtual-key state |
| PostgreSQL credentials | Existing initialized PostgreSQL volumes |
Registry, OpenRouter, Cloudflare, Google OAuth, Slack webhook, and Grafana credentials are usually independently rotatable. Test emergency rotation without changing the stable recovery set.
Bootstrap administrator
PLATFORM_ADMIN_CREDENTIALS creates an administrator only when none exists. Updating the Secret later does not reset an existing account password. Create at least two independently controlled, named Platform Administrators and avoid routine use of the bootstrap account.
Restrict Kubernetes access
Use different identities for deployment and API runtime orchestration.
- Installs and upgrades releases
- Manages chart-owned resources
- Runs migrations and hooks
- Manages namespaced Agent workloads
- Reads Pods, health, and logs
- Supports approved exec and port-forward operations
The API identity needs namespaced access to create Agent Deployments, Services, Secrets, ConfigMaps, and PVCs, and to inspect Pods, health, logs, exec, and port-forward operations. It should not access staging, unrelated namespaces, cluster Secrets, or nodes.
Verify the LiteLLM bootstrap identity
The LiteLLM key bootstrap Job runs as LITELLM_KEY_SERVICE_ACCOUNT. Verify that the configured account exists.
kubectl get serviceaccount \
--namespace agent-farm \
agent-farm-userAudit effective permissions
kubectl auth can-i create deployments --namespace agent-farm
kubectl auth can-i create services --namespace agent-farm
kubectl auth can-i create secrets --namespace agent-farm
kubectl auth can-i create persistentvolumeclaims --namespace agent-farm
kubectl auth can-i get pods --namespace agent-farm
kubectl auth can-i get pods/log --namespace agent-farmRepeat the checks with impersonation or the intended kubeconfig, then confirm that the same identity cannot read another namespace.
Plan storage and backups
The default deployment requests at least 19 GiB before any Agents: 5 GiB for application PostgreSQL, 2 GiB each for LiteLLM and Firecrawl PostgreSQL, and 10 GiB for Prometheus. Every Agent PVC requests another 1 GiB.
The default k3s local-path StorageClass is node-local. Choose storage that meets the production durability target. Changing STORAGE_CLASS on an existing PostgreSQL StatefulSet is not an in-place migration because its volume claim template is immutable.
Back up the complete recovery set
Agent Barn does not install a database or Agent PVC backup controller. Integrate an external backup system, define frequency, retention, off-cluster storage, encryption, access, RPO/RTO, restore order, verification, and failure ownership.
Redis has no persistent volume in the current chart. Durable Domain Event intent remains in PostgreSQL, and reconciliation can republish eligible Event Deliveries when Redis returns.
Secure networking and TLS
| Surface | Exposure | Route |
|---|---|---|
| Web application | Public | / |
| Product API | Public | /api |
| Grafana | Operator-only when needed | Dedicated host |
| Metrics and Ingest | Internal | No public ingress |
| PostgreSQL, Redis, LiteLLM, Firecrawl | Internal | ClusterIP Services |
UI_HOST=agentbarn.example.com
API_HOST=api.agentbarn.example.com
GRAFANA_HOST=grafana.agentbarn.example.com
WEB_APP_URL=https://agentbarn.example.comConfirm DNS resolution, ports 80 and 443, certificate issuance and renewal monitoring, API-to-Service routing, and restricted Grafana authentication.
Introduce network isolation in staging
The charts do not create NetworkPolicies. If the cluster enforces them, allow only required UI-to-API, service-to-database, worker-to-Redis, LiteLLM-to-provider, Firecrawl, Agent, and Prometheus flows. Test egress carefully: a bad policy can leave Agents running but unable to reach model or messaging providers.
Configure production providers
OpenRouter and LiteLLM
Use a production-dedicated OpenRouter key when isolation is required. Assign its budget, credit limit, rate limits, billing alerts, owner, rotation path, and emergency replacement procedure. The OpenRouterCreditsLow alert is useful only when the provider key has a credit limit; an unlimited key reports infinite remaining credit.
Keep LITELLM_MASTER_KEY stable and separate from the OpenRouter provider key.
Transactional email
SENDER_EMAIL=[email protected]Transactional email requires the Cloudflare account ID, API token, and sender address, plus a verified sending domain. Verify invitations, password recovery, lifecycle notifications, reputation, and quota. Use a different sender subdomain for staging.
Production and staging share the Cloudflare account, token, and account quota in the current workflow, so rotation and quota exhaustion can affect both.
Google Workspace
https://agentbarn.example.com/api/v1/integrations/google/callbackRegister the exact production callback. If an OAuth client is shared with staging, register that callback too; separate clients provide stronger failure and consent-screen isolation.
Firecrawl
Treat the platform Firecrawl key as a production credential. Its Services remain internal, but Firecrawl makes outbound requests, so enforce appropriate egress, destination, abuse-prevention, and capacity policies.
Plan capacity and availability
API, UI, worker, LiteLLM, Redis, all PostgreSQL databases, each Firecrawl component, Prometheus, Grafana, and Alertmanager run as single replicas by default.
Each Agent adds a Deployment, pod, Service, 1 GiB PVC, CPU and memory demand, model usage, platform API traffic, and monitoring traffic. Agent resource profiles are not configurable through .env.deploy.
Load-test representative Hermes and OpenClaw workloads in staging, including concurrent Agents, peak tools, large model responses, browser or Firecrawl work, Template and Skill loading, and restart behavior.
If the availability target requires multiple replicas, replication, or failover, treat that as custom architecture and validation work—not an environment-variable toggle.
Configure monitoring and alerts
SLACK_ALERTS_WEBHOOK_URL=REPLACE_WITH_PRODUCTION_WEBHOOK
GRAFANA_ADMIN_PASSWORD=REPLACE_WITH_STRONG_PASSWORD
GRAFANA_HOST=grafana.agentbarn.example.comFor every alert, document severity, on-call owner, response target, diagnostic link, escalation, recovery action, and user-notification threshold. Trigger a controlled staging alert before go-live.
Understand monitoring scope
Prometheus requests a 10 GiB PVC and retains 15 days by default. The namespace-scoped configuration does not collect cluster-wide node, kubelet, or cAdvisor metrics.
Add cluster monitoring for nodes, filesystems, volumes, container CPU and memory, the control plane, ingress, and cert-manager. Grafana dashboards are operational views, not audit logs or business records.
Prepare disaster recovery
Write and schedule a recovery exercise using this minimum sequence:
- Provision an isolated recovery namespace or cluster.
- Restore stable keys and the three PostgreSQL databases.
- Restore required Agent PVCs and compatible deployment artifacts.
- Deploy without changing the restored keys and verify the expected schema.
- Verify authentication, LiteLLM virtual keys, and a model request.
- Verify Shared Credentials and Agent credentials can decrypt.
- Start a test Agent and verify messages, Tool Calls, and costs.
- Verify Event Delivery reconciliation, monitoring, and alerts.
Preserve version compatibility
Record the git commit, API/UI and runtime image tags, chart versions, Alembic revision, PostgreSQL and LiteLLM versions, backup time, and secret-manager references with every recovery set. Do not restore into an arbitrary application version.
Plan migration rollback
Database migrations run as a Helm pre-install/pre-upgrade hook. Helm rollback changes manifests and images; it does not reverse Alembic migrations. Before schema changes, review compatibility, back up the application database, test upgrade and recovery in staging, and decide whether rollback uses an older compatible image or a database restore.
Stage and verify releases
In staging, verify API and UI health, administrator login, Organization isolation, invitations and email, OAuth, Agent creation, Hermes and OpenClaw startup, messaging platforms, LiteLLM requests, Activity, Tool Calls, logs, costs, Shared Credentials, Event Delivery processing, dashboards, alerts, migrations, and restart recovery.
Use dedicated staging chat applications, credentials, and data. Do not test with production workspaces or customer conversations.
Immediately before production
kubectl config current-context
kubectl get pods --namespace agent-farm
kubectl get pvc --namespace agent-farm
kubectl get certificate --namespace agent-farmConfirm the production backup completed, is readable, and is associated with the matching stable-key set.
Complete production go-live
Verify releases, workloads, storage, ingress, certificates, and the public API.
helm list --namespace agent-farmkubectl get deployments,statefulsets,pods,jobs,cronjobs \
--namespace agent-farmkubectl get pvc,ingress,certificate \
--namespace agent-farmcurl --fail https://api.agentbarn.example.com/api/v1/healthThen sign in with a named Platform Administrator, select the production Organization, invite a controlled test user, verify email enrollment, and start a non-sensitive test Agent. Send a message and verify the response, Activity, Tool Calls, cost attribution, Agent metrics, and alert state. Retire the test Agent according to policy and record the deployed commit and verification result.
Current availability constraints
| Area | Current default |
|---|---|
| API, UI, worker, LiteLLM | One replica each; replacements are non-overlapping |
| PostgreSQL | Three independent, single-replica StatefulSets |
| Redis | One replica without persistent Kubernetes storage |
| Firecrawl | One replica per component |
| Prometheus | One replica with 15-day retention |
| Grafana and Alertmanager | One replica each |
| Agent storage | One ReadWriteOnce PVC per Agent |
| Autoscaling and disruption budgets | Not configured |
| NetworkPolicies | Not configured |
| Backups and database replication | Not configured |
| Cross-cluster failover | Not configured |
These defaults fit a lean self-hosted platform whose operators accept single-node and maintenance risk. Stricter availability objectives require explicit architecture work.
Production checklist
Use these cards during the change review and final go-live call.
-
Identity and access
-
Secrets
-
Data and recovery
-
Networking
-
Providers
-
Operations
Security considerations
- Treat deployment credentials, workflow changes, stable keys, and backups as production security surfaces.
- Never mount cluster-admin access into the API or expose metrics, Ingest, databases, Redis, LiteLLM, or Firecrawl publicly.
- Use separate environment credentials when shared provider quota, revocation, or access is unacceptable.
- Restrict Grafana, encrypt backups, and test recovery access.
- Do not place credentials in Templates, Skill files, logs, alert annotations, or privilege reasons.
- Review chat-platform access, model allowlists, and provider budgets before connecting production channels.
- Restart Agents deliberately when generated runtime configuration changes; platform deploys do not rebuild every running Agent.
- Treat stable-key rotation and StorageClass changes as migrations.
Planned Organization suspension and platform-audit capabilities are not substitutes for these production controls.
Troubleshooting
| Symptom | Likely cause | Resolution |
|---|---|---|
| A merge to main deployed unexpectedly | Production deploys on pushes to main | Add or correct branch protection and required review. |
| Two production deployments overlap | A deployment path bypassed branch-group concurrency | Inspect active runs and standardize on the supported workflow. |
| Staging cannot create litellm-api-key | The configured ServiceAccount does not match the provisioned identity | Reconcile the workflow value and staging bootstrap manifest. |
| Staging creates Agent resources in production | K8S_NAMESPACE or the API kubeconfig points to production | Stop staging Agents and correct namespace and kubeconfig wiring. |
| The production API can access unrelated namespaces | The mounted kubeconfig is too privileged | Replace it with a dedicated namespace-scoped API identity. |
| Database authentication fails after deployment | The configured password differs from the initialized volume password | Restore the prior value or perform a coordinated database rotation. |
| Restored credentials cannot decrypt | The wrong Agent encryption key was restored | Restore the key belonging to that application database backup. |
| Restored LiteLLM Agent keys fail | The wrong master key or LiteLLM database was restored | Restore the matching LiteLLM master key and database. |
| PVCs remain Pending | The StorageClass is unavailable or incompatible | Select a supported ReadWriteOnce StorageClass. |
| Data is lost after node failure | Node-local storage was used without backup or replication | Restore from backup and adopt an appropriate durable storage design. |
| Model requests fail during deployment | LiteLLM is being replaced without an overlapping replica | Wait for readiness and schedule future changes in a maintenance window. |
| An Agent still uses old runtime configuration | Existing Agent workloads were not rebuilt | Stop and start the affected Agent deliberately. |
| Event Deliveries remain Pending | Redis, the worker, or reconciliation is unavailable | Inspect Redis, worker readiness, and the reconciliation CronJob. |
| Prometheus lacks CPU or memory metrics | Namespace monitoring does not discover node or cAdvisor metrics | Add cluster-level infrastructure monitoring. |
| OpenRouter credit alerts are not useful | The provider key has no credit limit | Configure a provider limit and validate the metric. |
| Staging exhausts the email quota | Both environments share the Cloudflare account quota | Limit staging sends or separate provider accounts. |
| Helm rollback does not restore old behavior | The database schema remained migrated | Use the documented compatibility or database-restore procedure. |
| TLS remains unready | DNS, ingress, or the fixed ClusterIssuer is incorrect | Inspect Certificate, Challenge, Ingress, and ClusterIssuer resources. |
Next steps
- Manage database migrations before the next schema-changing release.
- Monitor the platform and assign alert ownership.
- Upgrade Agent Barn with staged verification and tested backups.
- Troubleshoot self-hosting when a production check fails.
- Review Agent health and logs after starting production Agents.