How do you enforce a default-deny network posture in a namespace?
IntermediateScenarioSecurity, RBAC and policy
Answer
Situation read → Compliance requires that pods only talk to what they need.
What I'd do →
- Apply a policy with
podSelector: {}andpolicyTypes: [Ingress, Egress] - Add explicit allows for DNS (UDP/TCP 53 to kube-dns)
- Add allows per app (frontend to backend, backend to DB)
- Test with
kubectl exec ... -- nc -zv - Use Cilium or Calico flow logs to find missing rules
Why → Default deny turns the model from allow-all to allow-listed.
Interview tip → Say DNS egress is the thing everyone forgets.
More on Security, RBAC and policy
A developer needs read-only access to one namespace. How do you grant it?BeginnerExplain the difference between Role, ClusterRole, RoleBinding and ClusterRoleBinding.IntermediateA CI pipeline needs to deploy to one namespace. What identity do you give it?IntermediateWhat does a ServiceAccount do and why should you disable the token automount?BeginnerHow do you let pods on EKS access S3 without static keys?IntermediateA pod has access to the node's IAM role through IMDS. How do you prevent credential theft?Advanced