Lock down a namespace with NetworkPolicies
- 12 min
- 6 steps
- Networking
Steps
0 of 6 done
Isolate every pod in shop, restore DNS, then open exactly the paths the frontend and one debug pod need.
Step 1 of 6
No policy exists yet. From the
debugpod in thetoolsnamespace, fetch the front page of theapiService inshopto see that traffic between namespaces is open by default.Checked against what your commands print.
Step 2, not started: Isolate every pod in
shopfor both ingress and egress, using the policy file in the working directory written for that.Step 3, not started:
frontendcan no longer resolve any name, because its egress to CoreDNS is dropped. Two drafts of a DNS policy are in the working directory and only one of them selects the CoreDNS pods on this cluster. Find out which, and apply it.Step 4, not started: Let
frontendreachapiover HTTP again without opening anything else.frontendandapiare both isolated, so think about which side of the connection each remaining file permits.Step 5, not started: The
debugpod intoolscarries the labelapp=frontendas well, yet its request toapitimes out. Ask the API server how it readsapi-allow-frontendand find which pods itsfrompeer can match.Step 6, not started: Allow pods labelled
app=frontendin thetoolsnamespace, and nowhere else, to reachapi. Do not change the policies you have already applied.
Enter runs the command. Tab completes, and the arrow keys recall earlier commands. Control C stops a watch. On an empty line, or after Escape, Tab moves focus out of the terminal.