Kubernetes
Deploy AgentShield on Kubernetes with the Kustomize base and overlays. Local clusters, production configuration, secrets, network policy, and image verification.
infrastructure/kubernetes contains Kustomize manifests for the five services. kubectl has Kustomize built in; nothing else is needed.
What the base enforces
- Pod Security. The
agentshieldnamespace enforces therestrictedstandard. Every pod runs non-root with seccompRuntimeDefault, no privilege escalation, all capabilities dropped, a read-only root filesystem, and no service account token. - Network. Default deny in both directions, then:
| Service | May accept | May open |
|---|---|---|
| Gateway | Agents on 8081 | Database, Redis, the analyzer, public HTTPS (private and link-local ranges excluded) |
| Analyzer | The gateway only | Nothing |
| Control plane | The dashboard only | Database, object storage, SMTP |
| Dashboard | Users on 3000 | The control plane |
| Event relay | Nothing except scrapes | Database, NATS, object storage |
Metrics ports accept only pods labelled agentshield.io/metrics-scraper: "true".
- Database role. Every service connects as
agentshield_app. Only the dev overlay's bootstrap Job uses the schema owner. - Probes.
/health/liveand/health/readyare wired to liveness and readiness probes.
NetworkPolicy needs an enforcing plugin
Calico, Cilium, and most managed plugins enforce NetworkPolicy. The default networking in kind and minikube does not.
Local cluster
minikube start --driver=docker --cni=calico
docker compose --profile app build
for s in gateway event-relay control-plane dashboard intelligence; do
minikube image load "agentshield/${s}:local"
done
kubectl apply -k infrastructure/kubernetes/overlays/dev
kubectl -n agentshield wait --for=condition=Available deployment --all --timeout=300s
kubectl -n agentshield port-forward svc/dashboard 3000:3000The dev overlay runs PostgreSQL, Redis, NATS, and MinIO in the cluster with the development credentials from .env.example, sets AGENTSHIELD_ENV=development, and pulls no AgentShield image from a registry. Sign in with the bootstrap owner. To reach the gateway: kubectl -n agentshield port-forward svc/gateway 8081:8081.
Production
Verify and pin images
Images are published to ghcr.io/johannes7549/agentshield-<service> on version tags, for amd64 and arm64, with an SBOM, provenance, and a keyless cosign signature.
cosign verify ghcr.io/johannes7549/agentshield-gateway@sha256:<digest> \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp '^https://github.com/Johannes7549/AgentShield/\.github/workflows/release\.yml@refs/tags/v'Replace each newTag in overlays/production/kustomization.yaml with the verified digest.
Create the Secrets
The base references Secrets it does not create:
| Secret | Keys |
|---|---|
agentshield-database | DATABASE_URL as the agentshield_app role |
agentshield-intelligence | INTELLIGENCE_TOKEN, shared by gateway and analyzer, at least 32 characters |
agentshield-minio | MINIO_ACCESS_KEY, MINIO_SECRET_KEY |
kubectl -n agentshield create secret generic agentshield-database \
--from-literal=DATABASE_URL='postgres://agentshield_app:<password>@db.internal:5432/agentshield?sslmode=require'Add Secrets for any tool credentials your GATEWAY_TOOLS_CONFIG references, and mount the tools file from a ConfigMap.
Point at managed services
Patch agentshield-config with your endpoints: REDIS_URL, NATS_URL (tls://), MINIO_ENDPOINT with MINIO_USE_SSL: "true", and DASHBOARD_URL (HTTPS).
Leave INTELLIGENCE_URL at http://127.0.0.1:8082. The production overlay runs the analyzer as a sidecar in each gateway pod, listening on loopback only, so analyzer traffic never leaves the pod and production mode's rule against plain HTTP to a remote analyzer is satisfied without TLS. If you prefer a separate analyzer tier, put TLS in front of it and use an https:// origin; the gateway refuses a plain-HTTP, non-loopback analyzer in production.
Set hosts and TLS
overlays/production/ingress.yaml routes the dashboard host to dashboard and /api/v1/runtime/ on the gateway host to gateway, with a TLS Secret named agentshield-tls. Replace the example hosts and ingress class. The overlay narrows the dashboard's NetworkPolicy to the ingress-nginx namespace; adjust the label for your controller.
Apply
kubectl kustomize infrastructure/kubernetes/overlays/production > rendered.yaml # review
kubectl apply -k infrastructure/kubernetes/overlays/productionThe production overlay runs two replicas of the gateway (each with its analyzer sidecar), control plane, and dashboard, with a PodDisruptionBudget of minAvailable: 1 each and topology spread across nodes. The event relay stays at one replica.
Analyzer placement
The base and dev overlay run the analyzer as its own Service that accepts only the gateway. The production overlay moves it into the gateway pod on 127.0.0.1:8082, removes the standalone analyzer objects, and probes it with the image's own loopback health command. Analyzer metrics stay on port 9082. See ADR 0019 in the repository.
Admission control
To require signed images at admission, add a policy controller such as Sigstore's policy-controller or Kyverno with the identity shown above. This is the operator's choice and is not installed by the manifests.
Not included
- A Helm chart.
- Operators or managed setups for PostgreSQL, Redis, NATS, or object storage.
- Autoscalers. The gateway (with its analyzer sidecar) is stateless and can scale on CPU; the relay must stay at one replica.
- Prometheus and Grafana. Point your own at pods labelled
agentshield.io/metrics: "true"and label the scraperagentshield.io/metrics-scraper: "true".
Implementation references
Was this page helpful?
MinIO and Object Storage
Configure S3-compatible object storage for AgentShield evidence bundles. Bucket setup, credentials, TLS, and tamper resistance.
Configuration
How AgentShield services are configured, how production mode tightens validation, and the configuration files that sit beside environment variables.