Skip to content

Lab 04 — Implement Zero Trust Networking

Item Details
Lab ID K8S-NET-LAB-04
Difficulty Advanced
Estimated Time 4–5 Hours
Environment Kubernetes Cluster (Amazon EKS / Azure AKS / Google GKE / kind)
Platform Kubernetes
Cost Free (kind) / Cloud Charges Apply
Primary Role Kubernetes Security Engineer
Module Module 03 — Kubernetes Network Security & Zero Trust
Previous Lab Lab 03 — Secure Ingress

CloudNova Technologies has successfully implemented Kubernetes Network Policies and secured its internet-facing applications using an Ingress Controller.

Although these improvements significantly reduced the attack surface, a recent Purple Team exercise demonstrated that a compromised workload could still communicate with several internal services that it did not legitimately require.

The Chief Information Security Officer (CISO) has approved a company-wide initiative to implement a Zero Trust Architecture for Kubernetes.

Under this model:

  • No workload is trusted automatically.
  • Every network connection must be explicitly authorised.
  • Communication is permitted only when there is a valid business requirement.
  • Every workload is isolated according to its role.
  • Access is continuously verified and monitored.

As the Kubernetes Security Engineer, your mission is to redesign the cluster so that every application communicates only with approved services, eliminating implicit trust and reducing the risk of lateral movement.


By completing this lab, you will learn how to:

  • Understand Zero Trust networking principles
  • Design a Zero Trust Kubernetes architecture
  • Implement namespace isolation
  • Enforce least-privilege communication
  • Combine ingress and egress Network Policies
  • Restrict east-west traffic
  • Protect north-south traffic
  • Validate application communication paths
  • Prevent lateral movement
  • Conduct an enterprise Zero Trust assessment

Internet Users
HTTPS Only
Ingress Controller
Customer Frontend Namespace
Allowed Application Traffic
Inventory API Namespace
Allowed Application Traffic
Database Namespace
--------------------------------------------------
Any Unauthorised Communication
Frontend ───────────────► Monitoring
Backend ────────────────► Logging
Random Pod ─────────────► Database
Development ────────────► Production
Result
❌ Denied

Throughout this lab, apply the following principles:

  • Never trust by default.
  • Verify every connection.
  • Grant only minimum required access.
  • Deny all unnecessary communication.
  • Isolate workloads by function.
  • Continuously validate network policies.

By the end of this lab, you will have:

  • Built a Zero Trust network architecture
  • Applied default deny policies
  • Implemented namespace isolation
  • Allowed only business-approved communication
  • Protected sensitive workloads
  • Prevented lateral movement
  • Validated secure application flows
  • Produced an enterprise Zero Trust assessment report

Before starting:

  • Complete Labs 01–03
  • Kubernetes cluster running
  • kubectl installed
  • Network Policies supported by the cluster CNI

Tool Purpose
kubectl Kubernetes administration
Docker Desktop Local runtime
kind Local Kubernetes
Visual Studio Code YAML editing
Git Bash / PowerShell Command execution

Traditional network security assumes that systems inside a trusted network can communicate freely.

Zero Trust removes this assumption.

Every workload must prove its identity and every communication path must be explicitly authorised.

In Kubernetes, Zero Trust is achieved through a combination of:

  • Namespace isolation
  • Network Policies
  • Least-privilege communication
  • Secure Ingress
  • Strong workload identities
  • Continuous monitoring

Customer Frontend
Inventory API
Database
Allowed
Everything Else
Denied

Confirm cluster connectivity.

Terminal window
kubectl cluster-info
kubectl get nodes

Verify:

  • Cluster accessible
  • Nodes Ready

Create namespaces representing different business functions.

Terminal window
kubectl create namespace frontend
kubectl create namespace backend
kubectl create namespace database
kubectl create namespace monitoring
kubectl create namespace development

Verify:

Terminal window
kubectl get namespaces

Task 03 — Deploy a Multi-Tier Application

Section titled “Task 03 — Deploy a Multi-Tier Application”

Deploy:

  • Frontend (NGINX)
  • Backend API (HTTPD)
  • PostgreSQL Database
  • Monitoring Application

Verify:

Terminal window
kubectl get pods -A

Before applying policies, test communication between all workloads.

Examples:

  • Frontend → Backend
  • Frontend → Database
  • Backend → Database
  • Monitoring → Database
  • Development → Backend

Record which connections succeed.


Implement:

  • Default Deny Ingress
  • Default Deny Egress

Deploy policies to every namespace.

Verify:

Terminal window
kubectl get networkpolicy -A

Confirm all communication is blocked until explicitly allowed.


Task 06 — Allow Business-Required Communication

Section titled “Task 06 — Allow Business-Required Communication”

Create Network Policies that allow only:

Internet
Ingress Controller
Frontend
Backend API
Database

Everything else remains blocked.

Validate:

Source Destination Expected
Frontend Backend ✅ Allowed
Backend Database ✅ Allowed
Frontend Database ❌ Denied
Monitoring Database ❌ Denied
Development Production ❌ Denied

Restrict communication between:

  • Development
  • Testing
  • Production
  • Monitoring

Ensure workloads cannot communicate across environments unless explicitly approved.

Validate connectivity.


Review the Ingress configuration.

Confirm:

  • HTTPS enforced
  • TLS enabled
  • Backend Services use ClusterIP
  • No unnecessary NodePort Services

Validate that only the Ingress Controller is externally accessible.


Task 09 — Simulate a Compromised Workload

Section titled “Task 09 — Simulate a Compromised Workload”

Assume the frontend Pod has been compromised.

Attempt to:

  • Reach the PostgreSQL database directly
  • Access monitoring systems
  • Scan other namespaces
  • Connect to unrelated Services

Expected:

All unauthorised communication is denied.

Discuss how Zero Trust limits attacker movement.


Task 10 — Validate Least-Privilege Communication

Section titled “Task 10 — Validate Least-Privilege Communication”

Review every application flow.

Ensure each workload communicates only with required dependencies.

Questions:

  • Does any workload have unnecessary access?
  • Are there unused allow rules?
  • Can policies be further restricted?

List policies.

Terminal window
kubectl get networkpolicy -A

Inspect one policy.

Terminal window
kubectl describe networkpolicy <policy-name> -n <namespace>

Review:

  • Pod selectors
  • Namespace selectors
  • Ingress rules
  • Egress rules
  • Policy types

Evaluate:

  • Default deny implemented
  • Namespace isolation
  • East-west segmentation
  • North-south protection
  • Least privilege networking
  • Secure Ingress
  • Policy documentation

Classify:

  • Compliant
  • Requires Improvement
  • Non-Compliant

Task 13 — Enterprise Zero Trust Assessment

Section titled “Task 13 — Enterprise Zero Trust Assessment”

Assess the environment against Zero Trust principles.

Control Status
Verify Explicitly
Least Privilege
Default Deny
Namespace Isolation
Secure Ingress
East-West Segmentation
Continuous Validation
Reduced Attack Surface

Task 14 — Produce a Zero Trust Assessment Report

Section titled “Task 14 — Produce a Zero Trust Assessment Report”

Document:

Cluster:
Namespaces:
Applications:
Policies Implemented:
Allowed Communication:
Blocked Communication:
Lateral Movement Assessment:
Security Findings:
Recommendations:
Overall Zero Trust Maturity:

Capture evidence for:

  • Namespaces
  • Pods
  • Services
  • Network Policies
  • Ingress configuration
  • Connectivity tests
  • Blocked traffic
  • Allowed traffic
  • Zero Trust assessment
  • Final report

Delete:

  • Test Deployments
  • Services
  • Network Policies
  • Temporary namespaces

Verify:

Terminal window
kubectl get namespaces
kubectl get networkpolicy -A

Ensure all temporary resources have been removed.


By completing this lab, you will be able to:

  • Design Zero Trust network architectures
  • Implement namespace isolation
  • Configure ingress and egress controls
  • Restrict east-west traffic
  • Secure north-south traffic
  • Apply least-privilege networking
  • Prevent lateral movement
  • Validate application communication paths
  • Assess enterprise Kubernetes security
  • Troubleshoot Zero Trust implementations

What is the core principle of Zero Trust networking?

  • A. Trust all internal workloads by default.
  • B. Allow communication only after explicit verification and authorisation.
  • C. Expose all Services through LoadBalancers.
  • D. Disable Network Policies.

Answer: B


Which Kubernetes feature is most commonly used to enforce Zero Trust communication between Pods?

  • A. ReplicaSets
  • B. ConfigMaps
  • C. Network Policies
  • D. Persistent Volumes

Answer: C


Which communication path should typically be allowed in a three-tier application?

  • A. Frontend → Database
  • B. Frontend → Backend → Database
  • C. Monitoring → Database
  • D. Development → Production

Answer: B


Why should development and production namespaces be isolated?

  • A. To increase application performance.
  • B. To reduce the risk of accidental or malicious access across environments.
  • C. To reduce Pod memory usage.
  • D. To improve DNS resolution.

Answer: B


Which outcome best demonstrates a successful Zero Trust implementation?

  • A. Every Pod can communicate with every Service.
  • B. All workloads share the same namespace.
  • C. Only explicitly authorised communication paths are permitted, and all other traffic is denied.
  • D. Every Service is exposed externally using NodePort.

Answer: C


In this lab, you implemented a comprehensive Zero Trust networking architecture for Kubernetes by combining Network Policies, namespace isolation, secure Ingress, and least-privilege communication. You applied default deny policies, explicitly authorised only business-required traffic, and validated that unauthorised east-west and north-south communication was blocked.

These techniques reflect the security architecture used by enterprise Kubernetes platforms to minimise the attack surface, prevent lateral movement, and enforce continuous verification of application communication. Zero Trust networking is a foundational capability for securing modern cloud-native environments and aligns with industry frameworks such as NIST Zero Trust Architecture and the CIS Kubernetes Benchmark.


➡️ Lab 05 — Service Mesh Security

In the next lab, you will implement a Service Mesh using technologies such as Istio or Linkerd to secure service-to-service communication with mutual TLS (mTLS), fine-grained traffic policies, and identity-based access controls, further strengthening the Zero Trust architecture established in this module.