---
id: "k8s-network-policy"
type: "component"
kind: "firewall"
provider: "k8s"
category: "security"
aliases: "netpol"
docs: "https://kubernetes.io/docs/concepts/services-networking/network-policies/"
url: "https://localhost:3000/catalogue/components/k8s-network-policy"
---

# NetworkPolicy

Allow list for pod traffic at layer 3 and 4, isolating the pods it selects and enforced by the network plugin.

| | |
|---|---|
| Provider | [k8s](https://localhost:3000/catalogue?provider=k8s) |
| Kind | [Firewall](https://localhost:3000/catalogue/kinds/firewall) |
| Category | Security |
| Official docs | [https://kubernetes.io/docs/concepts/services-networking/network-policies/](https://kubernetes.io/docs/concepts/services-networking/network-policies/) |
| Also known as | netpol |

## Properties

| property | type | values | required | kind default | this component |
|---|---|---|---|---|---|
| `additiveRules` | boolean | — | no | true | inherited |
| `defaultAction` | enum | `allow`, `deny` | no | — | **"deny"** |
| `intrusionPrevention` | boolean | — | no | — | inherited |
| `logging` | boolean | — | no | — | inherited |
| `managed` | boolean | — | no | false | **false** |
| `pluginEnforcementRequired` | boolean | — | no | true | inherited |
| `policyScope` | enum | `ingress`, `egress`, `ingress-egress` | no | "ingress" | inherited |
| `ruleCount` | integer | — | no | — | inherited |
| `stateful` | boolean | — | no | — | **true** |

Bold values are the ones this component pins.

## Rules that apply · 0

No rule selects this kind or its category.

## Other products of the same kind · 35

- [Cloud Firewall](https://localhost:3000/catalogue/components/alibaba-cloud-firewall.md) `alibaba-cloud-firewall` — alibabacloud
- [Network ACL](https://localhost:3000/catalogue/components/alibaba-network-acl.md) `alibaba-network-acl` — alibabacloud
- [ECS Security Group](https://localhost:3000/catalogue/components/alibaba-security-group.md) `alibaba-security-group` — alibabacloud
- [Network ACL](https://localhost:3000/catalogue/components/aws-network-acl.md) `aws-network-acl` — aws
- [AWS Network Firewall](https://localhost:3000/catalogue/components/aws-network-firewall.md) `aws-network-firewall` — aws
- [Amazon Route 53 Resolver DNS Firewall](https://localhost:3000/catalogue/components/aws-route53-dns-firewall.md) `aws-route53-dns-firewall` — aws
- [Security group](https://localhost:3000/catalogue/components/aws-security-group.md) `aws-security-group` — aws
- [Microsoft Entra Internet Access](https://localhost:3000/catalogue/components/azure-entra-internet-access.md) `azure-entra-internet-access` — azure
- [Azure Firewall](https://localhost:3000/catalogue/components/azure-firewall.md) `azure-firewall` — azure
- [Network Security Group](https://localhost:3000/catalogue/components/azure-network-security-group.md) `azure-network-security-group` — azure
- [Network security perimeter](https://localhost:3000/catalogue/components/azure-network-security-perimeter.md) `azure-network-security-perimeter` — azure
- [Cloudflare DNS Firewall](https://localhost:3000/catalogue/components/cloudflare-dns-firewall.md) `cloudflare-dns-firewall` — cloudflare
- [Cloudflare Gateway](https://localhost:3000/catalogue/components/cloudflare-gateway.md) `cloudflare-gateway` — cloudflare
- [Cloudflare Network Firewall](https://localhost:3000/catalogue/components/cloudflare-network-firewall.md) `cloudflare-network-firewall` — cloudflare
- [Generic firewall](https://localhost:3000/catalogue/components/firewall.md) `firewall` — default
- [Firewall appliance](https://localhost:3000/catalogue/components/firewall-appliance.md) `firewall-appliance` — default
- [Fortinet FortiGate](https://localhost:3000/catalogue/components/fortigate.md) `fortigate` — default
- [MikroTik RouterOS](https://localhost:3000/catalogue/components/mikrotik-routeros.md) `mikrotik-routeros` — default
- [nftables](https://localhost:3000/catalogue/components/nftables.md) `nftables` — default
- [OPNsense](https://localhost:3000/catalogue/components/opnsense.md) `opnsense` — default
- [Palo Alto Networks NGFW](https://localhost:3000/catalogue/components/palo-alto-ngfw.md) `palo-alto-ngfw` — default
- [pfSense](https://localhost:3000/catalogue/components/pfsense.md) `pfsense` — default
- [Snort](https://localhost:3000/catalogue/components/snort.md) `snort` — default
- [Suricata](https://localhost:3000/catalogue/components/suricata.md) `suricata` — default
- [VyOS](https://localhost:3000/catalogue/components/vyos.md) `vyos` — default
- [DigitalOcean Cloud Firewalls](https://localhost:3000/catalogue/components/digitalocean-cloud-firewall.md) `digitalocean-cloud-firewall` — digitalocean
- [Cloud IDS](https://localhost:3000/catalogue/components/google-cloud-ids.md) `google-cloud-ids` — gcp
- [Cloud NGFW](https://localhost:3000/catalogue/components/google-cloud-ngfw.md) `google-cloud-ngfw` — gcp
- [Secure Web Proxy](https://localhost:3000/catalogue/components/google-secure-web-proxy.md) `google-secure-web-proxy` — gcp
- [IBM Cloud Hardware Firewall](https://localhost:3000/catalogue/components/ibm-firewall.md) `ibm-firewall` — ibm
- [VPC Security Group](https://localhost:3000/catalogue/components/ibm-security-group.md) `ibm-security-group` — ibm
- [Network Firewall](https://localhost:3000/catalogue/components/oci-network-firewall.md) `oci-network-firewall` — oci
- [Network Security Group](https://localhost:3000/catalogue/components/oci-network-security-group.md) `oci-network-security-group` — oci
- [Security List](https://localhost:3000/catalogue/components/oci-security-list.md) `oci-security-list` — oci
- [Security Group](https://localhost:3000/catalogue/components/outscale-security-group.md) `outscale-security-group` — outscale

## Use it in a design

```yaml
nodes:
  - { id: "k8s-network-policy", component: "k8s-network-policy" }
```

## Source (`component` YAML, verbatim)

```yaml
# yaml-language-server: $schema=../../schema/component.schema.json
# Kubernetes NetworkPolicy: an allow list for pod-to-pod and pod-to-world traffic at OSI layer 3
# or 4. Per "Network Policies" pods are non-isolated until a policy selects them and accept traffic
# from any source; once selected, only connections matching a rule are allowed, reply traffic is
# implicitly allowed, and policies are additive so evaluation order does not matter. If policyTypes
# is omitted, Ingress is always set and Egress only when egress rules exist. Enforcement requires a
# network plugin that supports NetworkPolicy; without one the object has no effect.
schemaVersion: "1"
type: "component"
id: "k8s-network-policy"
kind: "firewall"
provider: "k8s"
docs: "https://kubernetes.io/docs/concepts/services-networking/network-policies/"
aliases: ["netpol"]
defaults:
  managed: false
  defaultAction: "deny"
  stateful: true
properties:
  policyScope:
    type: "enum"
    values: ["ingress", "egress", "ingress-egress"]
    default: "ingress"
  pluginEnforcementRequired:
    type: "boolean"
    default: true
  additiveRules:
    type: "boolean"
    default: true
```

Human page: https://localhost:3000/catalogue/components/k8s-network-policy
