Venture Lab 10BETA Free beta · early access

Home › Guides › DevOps Template Store

Checklist · DevOps Template Store

Kubernetes default-deny NetworkPolicy: a safe rollout checklist

A default-deny policy is the base of network isolation in Kubernetes. Applied carelessly, it also cuts your workloads off from DNS and each other. Use this list to roll it out one namespace at a time.

Updated · Venture Lab 10

The policy

This is the free sample from the DevOps Template Store. It selects every pod in one namespace and isolates them for both ingress and egress:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny
  namespace: demo-only
spec:
  podSelector: {}
  policyTypes: [Ingress, Egress]

Kubernetes documents that by default a pod is non-isolated, so all connections are allowed. A policy like this one makes the selected pods isolated. Only the traffic that another policy explicitly allows can then flow.

Before you apply it

Apply in order

Keep it maintainable

The free DevOps templates include this policy, the Terraform validation workflow and an incident triage runbook. They are starter examples, provided as-is, so review them for your cluster.

Sources

Venture Lab 10 is independent. Other product and service names are used only to describe compatibility or for comparison, and are trademarks of their owners.

← All guides