Default-Deny NetworkPolicies and Egress Control
Advanced · 30 minutes · 5 tasks, checked automatically · 100 points
In this advanced networking lab you will implement a zero-trust network posture inside a Kubernetes cluster using NetworkPolicy resources. You will create isolated namespaces, deploy workloads, enforce default-deny ingress and egress policies, and then carve out precise exceptions to allow only the traffic your application legitimately needs. By the end you will understand how to layer NetworkPolicies to control both inbound and outbound traffic at the pod level.
What you’ll learn
- Deploy a multi-tier application across two namespaces and label pods for policy selection
- Apply default-deny-all NetworkPolicies for both ingress and egress in each namespace
- Carve out precise ingress and egress exceptions so only the required traffic flows while everything else remains blocked
How this lab works
- Start the lab: One click starts a real Kubernetes cluster on your computer (kind), with kubectl ready in a toolbox terminal.
- Work through 5 tasks: Each task says what to build or fix. You do it yourself, in a real terminal, with hints when you get stuck.
- Check your work: Check my work reads your live cluster and says, task by task, what passed and what to fix.
- Finish and keep going: 100 points, your progress saved, and the next lab to try.
What it runs on
- Cluster: A real Kubernetes cluster on your computer (kind)
- Kubernetes: 1.34.8
What you need
- A free LearnXops account
- The LearnXops desktop app for macOS, Windows or Linux
- Docker Desktop installed and running
- A kind cluster created in the Kubernetes Playground
Topics: networkpolicy, zero-trust, egress, ingress, namespace-isolation, dns, security, advanced-networking
Create a free account to start this lab.
Keep going
- TLS Termination at the Ingress with Kubernetes Secrets
- EndpointSlices: How Services Track Pod Endpoints
- The Gateway API: Routes, Gateways, and GatewayClasses
- Zero-Trust mTLS Between Services with Linkerd
- Route HTTP Traffic with an Ingress Controller
- Expose a Service of type LoadBalancer (cloud-provider-kind)