All Tools View Categories About Contact Privacy

NetworkPolicy YAML Generator

Build a valid Kubernetes NetworkPolicy (networking.k8s.io/v1) from a pod selector, policy types and ingress/egress rules.

Runs entirely in your browser - nothing is uploaded and no cluster connection is made.
0
ingress peers
0
egress peers
Your generated NetworkPolicy YAML will appear here.

About NetworkPolicy YAML Generator

A NetworkPolicy describes how groups of pods are allowed to communicate with each other and with the network. The NetworkPolicy YAML Generator writes that manifest from a form so you do not have to recall the networking.k8s.io/v1 schema.

You set the policy name and namespace, then the pod selector (matchLabels) that picks the pods the policy governs. You choose policy types - Ingress, Egress or both - and then define rules. Each ingress or egress rule can list TCP ports and peers to allow: pods with a label, namespaces with a label, or CIDR ranges. If a direction has no rules it denies all traffic in that direction. The resulting YAML is valid networking.k8s.io/v1.

The name is validated as an RFC 1123 label, the pod selector needs at least one label, and at least one policy type must apply. Problems are reported in a clear panel. Everything runs locally and nothing is uploaded.

Features

  • podSelector - matchLabels (key=value, comma separated).
  • policyTypes - Ingress, Egress (comma separated).
  • Ingress rules - ports plus pod, namespace or CIDR peers.
  • Egress rules - ports plus pod, namespace or CIDR peers.
  • networking.k8s.io/v1 - correct schema.
  • Validation - RFC 1123 name, selector and policy types.
  • Copy / Download / Print - get networkpolicy.yaml wherever you need it.

How to Use

  1. Name the policy. Type a valid RFC 1123 name.
  2. Set the pod selector. e.g. app=web.
  3. Pick policy types. Ingress and/or Egress.
  4. Add ingress/egress rules. ports and peers to allow.
  5. Watch the preview and export.

Examples

Example 1 - allow web ingress. podSelector app=web, Ingress, ports 80, from app=frontend.

Example 2 - egress to CIDR. Egress, to 10.0.0.0/24 on 443.

Example 3 - deny all ingress. Ingress with no rules.

Example 4 - namespace peer. from namespace team=payments.

Example 5 - both directions. Ingress and Egress.

Benefits

  • Correct schema - valid networking.k8s.io/v1 NetworkPolicy.
  • Flexible peers - pod, namespace and CIDR sources.
  • Validated - names and required fields checked.
  • Clean output - empty fields omitted.
  • Private - everything runs in the browser.
  • Copy, download or print - get the manifest where you need it.

Frequently Asked Questions

What is a NetworkPolicy?
A NetworkPolicy controls which pods can talk to which other pods and external endpoints. By default pods are non-isolated; a policy that selects them isolates them to the rules you allow.
What does podSelector do?
It selects the pods the policy applies to via matchLabels. At least one label is required.
What are policyTypes?
Ingress, Egress or both. They declare which directions the policy governs. If you omit them we derive them from the rules you provide.
What peers can I allow?
For a rule you can allow from pods with a label (podSelector), namespaces with a label (namespaceSelector) or CIDR ranges (ipBlock).
What about ports?
You can list TCP ports the rule applies to, such as 80,443. Leaving ports empty allows all ports for that rule.
Is the name validated?
Yes. The policy name must be a valid RFC 1123 label (lowercase letters, numbers and hyphens).
Does this connect to a cluster?
No. Everything is assembled in your browser and nothing is uploaded.
Can I download it?
Yes. Copy the YAML, download networkpolicy.yaml, or print it.