People and pods both send requests to the API server Developer kim uses kubectl to list pods in shop-dev. The deploy tool pod asks for the same list.
Every operation in Kubernetes is a request to the API server. Clicking a dashboard button and typing kubectl are the same.
First it checks "who are you" The API server checks who sent the request using the attached certificate or token. This is authentication.
Kubernetes has no "user account" resource. It simply trusts the name that a certificate or the company login system provides.
Key idea If authentication fails, you get 401. You cannot log in at all.
Next, RBAC decides "may you do this" Authorization is usually done with RBAC (Role-Based Access Control). First it looks for RoleBindings linked to kim.
A RoleBinding says "to whom". The Role it points to is a set of permissions that says "which actions on which resources".
Key idea A Role alone does nothing. It takes effect only when a RoleBinding links it to someone.
The rule matches, so it passes The Role says "may get·list·watch pods", so authorization passes.
The API server reads the shop-dev pods from etcd and returns the list to kim.
Delete is rejected with 403 Forbidden Now kim tries to delete a pod. Authentication still passes, but the Role has no delete.
RBAC only lists what is allowed. Anything not allowed is denied, and 403 Forbidden comes back.
Watch out If you can log in but one action is blocked, it is an authorization problem, not authentication. The error message names the user, verb, and resource.
Pods get the same check through a ServiceAccount A program inside a pod authenticates with a ServiceAccount token (an account for programs). Kubernetes mounts this token into the pod.
A ServiceAccount is a namespaced Kubernetes resource. It gets permissions through a RoleBinding, just like a person. Here ci-bot is in the same RoleBinding, so listing pods is allowed.
Key idea A pod with no ServiceAccount set uses the namespace's default account. Grant permissions to default and every pod gets them.
Cluster-wide resources like nodes are bound differently kim wants to list nodes. Nodes belong to no namespace. They are cluster-scoped, so a Role inside shop-dev cannot grant them.
You write the permissions in a ClusterRole and bind it with a ClusterRoleBinding. Permissions bound this way apply to every namespace.
Watch out A RoleBinding can also point to a ClusterRole. Then the permissions apply only inside that RoleBinding's namespace. This is how you hand out a shared permission set per namespace.
Grant only what is needed Narrow it down in order: scope (cluster or one namespace) → resource (which kind) → verb (read only, or write too). One namespace is usually enough.
Allowing everything (*) for convenience opens up reading secrets, editing roles, even deleting nodes. Resource kinds added later are included automatically too.
Watch out Even weak-looking permissions can be dangerous. With permission to create pods, you can start a pod as another ServiceAccount in that namespace and use its permissions.
Authentication is "who", RBAC is "what, to whom" A request is processed only after authentication confirms the subject and RBAC authorization checks the permissions bound to that subject.
User permissions kept by a management console or dashboard are a different layer from Roles and RoleBindings in the cluster. What actually applies to the Kubernetes API is RBAC.
Summary 403 Forbidden means you are authenticated but that action is not allowed. Use kubectl auth can-i <verb> <resource> --as <subject> to see what is blocked.