Skip to main content

What are Network Policies?

Kubernetes Network Policies are firewall rules for your pods. They control:
  • Ingress: What can connect TO your pod
  • Egress: What your pod can connect TO
Without Network Policies, all pods can communicate with all other pods (flat network).

Structure of a Network Policy

How kguardian Generates Policies

  1. Observes traffic continuously via eBPF (let several minutes of representative traffic accumulate before generating)
  2. Identifies peers by resolving IPs to pods/services
  3. Groups rules by protocol and port
  4. Deduplicates to create minimal policies
  5. Generates YAML ready to apply

Default-Deny Strategy

Best practice: Start with default-deny, then allowlist:

Next steps: