Skip to main content
Installation

Kubernetes

Deploy to Kubernetes with the Helm chart in the package, covering components, offline image import, installation and first sign-in, gateway integration, upgrade and uninstall, and limits.

helm/rstwaf in the package is the Helm chart for Kubernetes.

ComponentKindDefault
Control plane (console, API, node channel)Deployment, 1 replica, PVCon
Data plane and node agentDeployment or DaemonSet, optional HPA and PDBon, 2 replicas
Detect service (ext_authz gRPC 9090, HTTP check 8090) and node agentDeployment, optional HPA and PDBoff
CrowdSec LAPIDeployment, PVCon
Valkey (shared counters across replicas)Deploymentoff

Data plane and detect service pods join the control plane by themselves with a bootstrap token from the release Secret. They appear under Sites and nodes > Nodes within seconds, with no join token needed in the console. Auto-joined nodes that stay offline longer than controlplane.nodeGC (default 1 hour) are removed. Every component runs as non-root with a read-only root filesystem, except CrowdSec, whose upstream image needs root. Nothing makes outbound connections by default.

Requirements

  • Kubernetes 1.27 or later, Helm 3.
  • A default StorageClass, or an existing PVC given with controlplane.persistence.existingClaim.
  • An image registry the cluster can pull from.

Install

Import the images

tar -xf rstwaf-<version>-linux-amd64.tar && cd rstwaf-<version>-linux-amd64
docker load -i images.tar.gz
for n in controlplane caddy detect crowdsec valkey cpbackup; do
  docker tag rstwaf/$n:<version> registry.example.com/rstwaf/$n:<version>
  docker push registry.example.com/rstwaf/$n:<version>
done

On a single-node cluster without a registry (k3s, kind), import the images straight into the node's containerd, for example with k3s ctr images import, then set --set image.pullPolicy=Never.

Install the chart

helm install rstwaf ./helm/rstwaf -n rstwaf --create-namespace --set image.tag=<version> \
  --set image.registry=registry.example.com --set image.pullSecrets[0]=regcred

On first install the chart generates the administrator password, master key, bootstrap token and other secrets, and reuses them on every upgrade. To manage them yourself, create a Secret with the same keys and set secrets.existingSecret.

Sign in for the first time

kubectl -n rstwaf get secret rstwaf -o jsonpath='{.data.admin-password}' | base64 -d
kubectl -n rstwaf port-forward svc/rstwaf-console 9000:9000

Open http://127.0.0.1:9000, sign in as admin and change the password. When adding sites, use an in-cluster Service as the upstream, for example http://app.default.svc:80.

Send traffic to the data plane

Set dataplane.service.type=LoadBalancer (with externalTrafficPolicy: Local to keep client IPs), or put an ingress or gateway in front as described below.

Gateway integration

MethodRequest body inspectedBlocks
Ingress backend set to the rstwaf-dataplane Service (any ingress; the site upstream is the application Service)yesyes, with every data plane feature
Envoy Gateway SecurityPolicy ext_authz to detect service port 9090, with bodyToExtAuthyesyes
Traefik 3.4 or later forwardAuth to detect service port 8090, with forwardBody: trueyesyes
Istio CUSTOM authorisation policy with includeRequestBodyInCheckyesyes
ingress-nginx auth-urlno; nginx auth_request never sends the bodyURL, query and headers only
ingress-nginx mirror-targetyes (copy)no, detect only

Response-side detection, web page tamper protection, challenges and block pages with content need the data plane, because the detect service only sees the request. The detect service trusts X-Forwarded-* from its callers, so set networkPolicy.enabled=true and use networkPolicy.detectFrom to allow only the gateway pods. Keep the gateway's body limit equal to detect.maxBody (default 1 MiB). With detect.mode=mirror the detect service only receives copies and never blocks.

Main values

KeyDefaultDescription
image.registry, image.tag, image.pullSecretsempty, the chart's appVersion, emptyImage registry
secrets.existingSecretemptyYour own Secret
retainOnUninstalltrueKeep the Secret and control plane PVC on uninstall
engine.*single-host defaultsCRS level, allowed methods, semantic module modes
controlplane.persistence.size5GiControl plane volume
controlplane.nodeURL, nodeSANs, nodeService.typein-clusterJoin nodes from outside the cluster
controlplane.ingress.*, cookieSecureoffConsole ingress, on a management network with TLS
dataplane.kind, replicas, autoscaling.*, pdb.*Deployment, 2, off, minAvailable 1Data plane
dataplane.service.typeClusterIPData plane Service
detect.enabled, mode, maxBody, onErroroff, inline, 1MiB, denyDetect service
valkey.enabledoffShared counters across replicas
cpbackup.enabled, typeoffControl plane cold standby, file or s3
networkPolicy.enabledoffIngress network policies
apis.configMapemptyOpenAPI specifications for sites with API security

Licensing

Without a host machine-id in Kubernetes, the fingerprint is bound to the cluster through the uid of the kube-system namespace, so moving the pod to another node does not change it. The control plane pod needs a ServiceAccount that can only get that one namespace object. Do not mount the host machine-id. To pin cluster binding explicitly, set RSTWAF_LICENSE_ANCHOR=k8s.

Upgrade and uninstall

helm upgrade rstwaf ./helm/rstwaf -n rstwaf --reuse-values --set image.tag=<new version>

The control plane runs database migrations on start, so the console is unavailable for a few seconds while the data plane keeps serving its last configuration. Data plane and detect pods roll one at a time. Online updates in the console do not apply to Kubernetes; upgrade with Helm.

helm uninstall rstwaf -n rstwaf keeps the Secret and the control plane PVC by default, because the master key encrypts data in the database. A later install with the same release name picks them up again. Delete them by hand to start from scratch.

Limits

  • The control plane has one replica (SQLite). Protect it with the cpbackup cold standby, preferably to S3-compatible storage.
  • The identity gateway, host protection, online updates and the MCP server are not part of the chart.
  • Each data plane pod keeps its own ACME state. Terminate TLS at the load balancer or ingress, or upload certificates, which travel in configuration snapshots.
  • CrowdSec runs LAPI only. Scenario detection on node logs is not deployed.

On this page