1. [Home](<https://delaparra-services.nl/>) 
1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) 
1. [NetworkPolicy](<https://delaparra-services.nl/knowledge-hub/networkpolicy>)

  

Category: Kubernetes 

# NetworkPolicy

  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    

## What is NetworkPolicy?

 

NetworkPolicy: A firewall for Pods. Declares which Pods may talk to which, by label and port. Without one, all Pods can reach all others. A NetworkPolicy is a firewall for pods in Kubernetes. It defines which pods may connect to which, using labels and ports. For example: only pods labelled ` app=api ` may reach the database on port 3306.

 

Definition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)

 

## Frequently asked questions about NetworkPolicy

  

### How is NetworkPolicy used in practice?

 

By default, every pod in a cluster can reach every other pod. That is convenient, but it means one compromised container can talk to everything, including databases it has no business with.

    

### What should you keep in mind with NetworkPolicy?

 

A good starting point is a default policy that blocks incoming traffic in a namespace, followed by specific policies that allow only the connections your application needs. Network policies require a network plugin that enforces them; most managed clusters support this, but check before relying on it. Test policies carefully, because a missing rule silently breaks connections.

    

### What does an example of NetworkPolicy look like?

 

```
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: db-allow-api spec: podSelector: matchLabels: { app: db } ingress: - from: - podSelector: matchLabels: { app: api }
```

 

## At a glance

   CategoryKubernetes Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026

 

## More Kubernetes terms

 

- [LoadBalancer](<https://delaparra-services.nl/knowledge-hub/loadbalancer>) 
- [logs](<https://delaparra-services.nl/knowledge-hub/logs>) 
- [Namespace](<https://delaparra-services.nl/knowledge-hub/namespace-kubernetes>) 
- [node](<https://delaparra-services.nl/knowledge-hub/node-kubernetes>) 
- [NodePort](<https://delaparra-services.nl/knowledge-hub/nodeport>) 
- [PersistentVolume (PV)](<https://delaparra-services.nl/knowledge-hub/persistentvolume-pv>)

 

[All terms starting with N](<https://delaparra-services.nl/knowledge-hub#letter-n>)

 

## Skills

 

- ### Kubernetes Security Policies

 

Implement Kubernetes security policies including NetworkPolicy, PodSecurityPolicy, and RBAC for production-grade security. Use when securing Kubernetes clusters, implementing network isolation, or enforcing pod security standards.

 [View skill](<https://delaparra-services.nl/skills/k8s-security-policies>) [Download zip](<https://delaparra-services.nl/skills/k8s-security-policies/download>) 
- ### Secrets Management

 

Implement secure secrets management for CI/CD pipelines using Vault, AWS Secrets Manager, or native platform solutions. Use when handling sensitive credentials, rotating secrets, or securing CI/CD environments.

 [View skill](<https://delaparra-services.nl/skills/secrets-management>) [Download zip](<https://delaparra-services.nl/skills/secrets-management/download>) 
- ### Kubernetes Manifest Generator

 

Create production-ready Kubernetes manifests for Deployments, Services, ConfigMaps, and Secrets following best practices and security standards. Use when generating Kubernetes YAML manifests, creating K8s resources, or implementing production-grade Kubernetes configurations.

 [View skill](<https://delaparra-services.nl/skills/k8s-manifest-generator>) [Download zip](<https://delaparra-services.nl/skills/k8s-manifest-generator/download>)

 [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/networkpolicy/skills.zip>)

 

## Manuals

 

- [Kubernetes and Terraform: do you need them?](<https://delaparra-services.nl/manuals/kubernetes-en-terraform-heb-je-het-nodig>) 
- [.env and environment variables](<https://delaparra-services.nl/manuals/env-en-omgevingsvariabelen>)

 

## Related services

 

- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)

Perhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.

 

## Need any help?

 

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.

  [Get in touch](<https://delaparra-services.nl/availability>)

[HTML version](https://delaparra-services.nl/knowledge-hub/networkpolicy)
