Reading RBAC Permissions · CKA
Roles and bindings determine what an authenticated identity is allowed to do.
Learn with progress and quizzesFirst, understand the concepts.
Role and ClusterRole
A Role defines permissions within a namespace. A ClusterRole can define permissions for cluster-scoped resources or permissions reused across namespaces.
Bindings
A RoleBinding grants a Role or ClusterRole to users, groups, or ServiceAccounts within a namespace. A ClusterRoleBinding grants permissions cluster-wide.
Why it matters
An observer needs to read Pod state and logs but must not delete Pods. Split that requirement into resources and verbs before evaluating permissions.
Work through the reasoning
Read a rule as a sentence
Connect apiGroups, resources, and verbs: for example, get/list/watch pods in the core API. pods/log is a separate subresource; reading a Pod does not automatically grant log access.
Trace the binding
Follow subject and roleRef. A RoleBinding referencing a ClusterRole still grants access within its namespace. Allowed rules accumulate, so inspect other bindings as well.
Learn by doing.
You need kubectl and access to your own practice Kubernetes cluster. Each lab is independent. Check your current context first, then run the commands in your own terminal.
Check whether your account can read Pods, then inspect the current RoleBindings.
kubectl auth can-i get pods -n default
kubectl auth can-i create deployments -n default
kubectl get rolebindings -n default
kubectl get clusterrolesHow to check your result
Explain the difference between yes and no. If a list request returns Forbidden, your account lacks that permission; you do not need to elevate it for this exercise.
Apply what you learned
Pod listing works but logs return Forbidden. What should you inspect without granting cluster-admin?
Reveal the reasoning after trying
Check that the namespace binding targets the correct user or ServiceAccount, then review get access to pods/log in the core API group. Grant the required subresource rather than bypassing the problem with broad administrator privileges.
Ready to check your understanding?
What grants a ClusterRole’s permissions within a single namespace?
- ClusterRoleBinding
- RoleBinding
- NamespaceBinding
- Service
Reveal the reasoning after trying
RoleBinding
A RoleBinding grants permissions in its own namespace, even when it references a ClusterRole.