Kubernetes NetworkPolicy Generator
Generate a Kubernetes NetworkPolicy in YAML (deny-by-default or allow by label) to control traffic between pods. Harden the network security of your cluster.
YAML
—
NetworkPolicy: closing traffic between pods
By default, in a Kubernetes cluster every pod talks to every pod. There is no isolation between namespaces or between applications — the database accepts connections from the reporting service, from the frontend and from anything compromised that happens to be running there. NetworkPolicy is the resource that closes that, and its model contains an inversion that catches people out.
Enter the name and the label of who may come in, and the page assembles the manifest. The inversion is this: while no policy selects a pod, it accepts everything; as soon as the first policy selects it, it starts refusing everything not explicitly allowed. In other words, creating a restrictive policy is not what closes the door — what closes it is a policy coming to exist that points at that pod.
Two things regularly surprise people. The first is that the policy only works if the cluster network plugin implements it: with some simpler plugins the manifest is accepted and ignored, which gives a false sense of isolation. The second is that rules are additive — several policies selecting the same pod add up their permissions and never restrict one another.
Frequently asked questions
How do I block all incoming traffic in a namespace?
Why did my policy have no effect?
Does the policy cover outgoing traffic too?
Related Tools
Kubernetes CronJob Generator
Generate a Kubernetes CronJob in YAML with the schedule expression and the container to run. Schedule recurring tasks in your cluster and apply with kubectl.
Kubernetes Secret Generator
Generate a Kubernetes Secret in YAML with values already base64-encoded. Store passwords and tokens safely and apply them to your cluster with kubectl.
Kubernetes HPA Generator
Generate a Kubernetes HorizontalPodAutoscaler (HPA) in YAML with min, max replicas and a CPU target. Scale your pods automatically as load changes.
Kubernetes Ingress Generator
Generates a Kubernetes Ingress with host, service and port, using the nginx ingressClassName and a root path. The TLS block is yours to add.
Kubernetes ConfigMap Generator
Generate a Kubernetes ConfigMap in YAML from key=value pairs, ready to apply with kubectl. Centralize your pod configuration in seconds.
Cron Expression Editor
Parse and build cron expressions with human-readable descriptions, next execution times and shortcuts for common schedules.