~/ nmadiraju.com Amazon EKS · Labels, selectors and namespaces
arrow_back Back to nmadiraju
Visual Walkthrough · Kubernetes fundamentals

How Labels, Selectors and Namespaces Work on Amazon EKS

Follow a Service as it finds its Pods, loses them to one wrong letter, and meets a second namespace, then check yourself with 8 questions.

1Visual Walkthrough

Two namespaces, with a Service selecting Pods by label and traffic crossing the namespace line Left, namespace team-a with a Service web, three web Pods, a worker Pod and a database Pod. Right, namespace team-b with its own Service web and a checkout Pod. The walkthrough shows a selector matching labels, a case typo leaving the Service with no endpoints, DNS across namespaces, cross-namespace traffic allowed until a NetworkPolicy blocks it, and RBAC limited to one namespace. You kubectl · team-a dev NAMESPACE team-a Service web selector: app=web endpoints: 3 Pod web-1 app=web tier=frontend Pod web-2 app=web tier=frontend Pod web-3 app=web tier=frontend Pod worker app=worker not selected Pod postgres app=db port 5432 NetworkPolicy allows: same namespace other incoming traffic denied Role pod-editor + RoleBinding, in team-a you: get, list, update, delete pods applies only inside namespace team-a NAMESPACE team-b Service web selector: app=web a different web, same name Pod web-1 app=web team-b's web Pod checkout app=checkout calls other services

    2Quiz to check understanding

    Check yourself