Lion Cipher Lab
Protect node metadata and the kubelet endpoint: an egress deny you can prove and kubelet auth checks
- Cloud Security
- Intermediate
- ~60 min
- Free · no account required
Why it matters
On a cloud machine, a metadata service at the link-local address 169.254.169.254 can hand out credentials for that machine. By default pods can reach it, so a bug in one app can become a cloud account problem. The kubelet, the agent on each node, also has an HTTPS API that can run commands in containers if it is left open. Blocking the metadata address and checking the kubelet are two of the cheapest node-level wins in cluster hardening, and testing them proves they work.
What you'll learn
- explaining why a pod reaching the cloud metadata address is a risk
- writing an egress NetworkPolicy with an ipBlock except rule for 169.254.169.254/32
- proving a policy blocks traffic with a stand-in service and curl timeouts
- reading a kubelet configuration file for anonymous access, authorization mode and the read-only port
- probing the kubelet API from a pod and reading the HTTP status
- stating what a NetworkPolicy cannot do for traffic to the pod's own node
Steps in this lab
- What a pod can reach beyond its own network
- Create the cluster and two stand-in services
- Start a client pod and see the traffic work first
- Write the egress policy that blocks the metadata address
- Prove it: the decoy times out, the other service still answers
- Read the kubelet configuration for the three settings that matter
- Probe the kubelet from a pod, with no credentials
- Clean up everything
Open the full interactive lab →