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.
| Component | Kind | Default |
|---|---|---|
| Control plane (console, API, node channel) | Deployment, 1 replica, PVC | on |
| Data plane and node agent | Deployment or DaemonSet, optional HPA and PDB | on, 2 replicas |
| Detect service (ext_authz gRPC 9090, HTTP check 8090) and node agent | Deployment, optional HPA and PDB | off |
| CrowdSec LAPI | Deployment, PVC | on |
| Valkey (shared counters across replicas) | Deployment | off |
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>
doneOn 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]=regcredOn 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:9000Open 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
| Method | Request body inspected | Blocks |
|---|---|---|
Ingress backend set to the rstwaf-dataplane Service (any ingress; the site upstream is the application Service) | yes | yes, with every data plane feature |
Envoy Gateway SecurityPolicy ext_authz to detect service port 9090, with bodyToExtAuth | yes | yes |
Traefik 3.4 or later forwardAuth to detect service port 8090, with forwardBody: true | yes | yes |
Istio CUSTOM authorisation policy with includeRequestBodyInCheck | yes | yes |
ingress-nginx auth-url | no; nginx auth_request never sends the body | URL, query and headers only |
ingress-nginx mirror-target | yes (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
| Key | Default | Description |
|---|---|---|
image.registry, image.tag, image.pullSecrets | empty, the chart's appVersion, empty | Image registry |
secrets.existingSecret | empty | Your own Secret |
retainOnUninstall | true | Keep the Secret and control plane PVC on uninstall |
engine.* | single-host defaults | CRS level, allowed methods, semantic module modes |
controlplane.persistence.size | 5Gi | Control plane volume |
controlplane.nodeURL, nodeSANs, nodeService.type | in-cluster | Join nodes from outside the cluster |
controlplane.ingress.*, cookieSecure | off | Console ingress, on a management network with TLS |
dataplane.kind, replicas, autoscaling.*, pdb.* | Deployment, 2, off, minAvailable 1 | Data plane |
dataplane.service.type | ClusterIP | Data plane Service |
detect.enabled, mode, maxBody, onError | off, inline, 1MiB, deny | Detect service |
valkey.enabled | off | Shared counters across replicas |
cpbackup.enabled, type | off | Control plane cold standby, file or s3 |
networkPolicy.enabled | off | Ingress network policies |
apis.configMap | empty | OpenAPI 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
cpbackupcold 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.
Multi-node and high availability
Manage several data plane nodes from one control plane. Enable node access, create credentials and join tokens, install nodes, run the data plane active/active behind health checks, share counters, and use mirror inspection nodes.
Sign-in and third-party sign-in
Console account sign-in, one-time codes and sign-in security settings, setting up Feishu or Lark QR sign-in, and the single exception for offline deployments.