This guide will help you install kguardian and generate your first security policy.Documentation Index
Fetch the complete documentation index at: https://docs.kguardian.dev/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, ensure you have:Kubernetes Cluster
Kubernetes Cluster
- Kubernetes v1.19 or later
- Linux nodes with kernel 6.2+ (for eBPF support)
kubectlconfigured and connected to your cluster
Helm (Recommended)
Helm (Recommended)
- Helm v3.0 or later
- Or use raw manifests if you prefer
Cluster Permissions
Cluster Permissions
- Admin access to install the controller (DaemonSet, RBAC, etc.)
- Permission to create resources in your target namespaces
Pod Security Admission (if enforced)
Pod Security Admission (if enforced)
The kguardian controller needs the If you skip this on a PSA-enforced cluster, the controller pods will fail to admit with a
privileged Pod Security Admission level because it loads eBPF programs. If your cluster enforces Pod Security Admission, label the install namespace before running helm install:violates PodSecurity "restricted:..." error.Step 1: Install the Controller
The Controller runs as a DaemonSet and uses eBPF to observe your workloads.Verify Installation
Check that all components are running:All pods should show
Running status. If not, see Troubleshooting.Step 2: Install the CLI Plugin
The kguardian CLI is a kubectl plugin for generating policies.- Quick Install Script (Recommended)
- Manual Download
Step 3: Let Your Workloads Run
kguardian learns from actual runtime behavior, so let your applications run normally for 5-15 minutes to collect meaningful data.Step 4: Generate Your First Network Policy
Now generate a network policy based on observed traffic.--dry-run=true is the default — the CLI writes YAML to --output-dir and does not apply anything to the cluster:
--dry-run=false. See gen networkpolicy for the full flag reference.
Success! kguardian automatically discovered that your nginx pod receives traffic from the curl-pod on port 80 and makes DNS queries.
Apply the Policy
The default--dry-run=true only writes the YAML file. To put the policy on the cluster, either re-run the CLI with --dry-run=false, or kubectl apply the saved file:
Step 5: Generate a Seccomp Profile
Generate a seccomp profile to restrict syscalls:Apply the Seccomp Profile
kguardian generates the profile JSON. Distributing the profile to each node’s/var/lib/kubelet/seccomp/ directory is the user’s responsibility — kguardian does not push profiles to nodes today.
Recommended distribution options:
- Security Profiles Operator (SPO) — Wrap the generated JSON in a
SeccompProfileCRD; SPO’s DaemonSet writes it to the kubelet seccomp directory on every node. See the SPO docs for the CRD schema and DaemonSet behavior. - A custom hostPath DaemonSet — Mount
/var/lib/kubelet/seccomp/and copy the profile in. Suitable if you do not want a separate operator. - Image-baked profiles — Bake the profile into a config map or container image and ship it with your existing deployment pipeline.
/var/lib/kubelet/seccomp/nginx-profile.json on every node that may run the pod, reference it from your workload:
Automated seccomp profile distribution from kguardian is on the roadmap. Until then, pair kguardian with SPO or a DaemonSet of your own.
Next Steps
Architecture
See how the Controller, Broker, and UI fit together
Generate Cilium Policies
Create enhanced L7-aware policies
Batch Generation
Generate policies for all pods at once
Policy Gallery
Worked examples for nginx, Postgres, kube-dns, Prometheus, Istio, Go
Common Issues
No traffic data found
No traffic data found
Solution: Ensure your pods have been running and generating traffic for at least 5 minutes. Check broker logs:
Controller pods not starting
Controller pods not starting
Solution: Verify kernel version (6.2+) and that nodes support eBPF:
CLI can't connect to broker
CLI can't connect to broker
Solution: The CLI auto-discovers the broker via port-forwarding. Ensure you have permissions:
Learn more about kguardian's architecture
Understand how the components work together →