Computer scienceSystem administration and DevOpsKubernetesNetworking and traffic management

Ingress and egress network policies

Theory

Zero-trust egress posture

Report a typo

The platform security team wants to prevent application Pods from reaching the cloud provider's instance metadata endpoint, which can otherwise be abused to steal node credentials. Create a NetworkPolicy manifest that enforces this restriction with the following requirements:

  • name — block-metadata-service.

  • The policy should apply to every Pod.

  • The policy governs only egress traffic.

  • Allow outbound traffic to all IPv4 destinations (0.0.0.0/0) except:

    • 169.254.169.254/32 — the well-known IMDS address.

    • 169.254.0.0/16 — the broader link-local range.

Write a program
# Create the network policy below

Create a free account to access the full topic