KCNA ยท Kubernetes security
How does the API server decide what a request may do, and where does RBAC fit?
API request flow (authn, authz, admission), Role, ClusterRole, RoleBinding, ClusterRoleBinding, least privilege.
Key points
- Each request passes, in order:
- Authentication: who are you? Failure: 401.
- Authorization: may you do this verb on this resource? Failure: 403.
- Admission control: may this object be accepted or mutated?
- RBAC (authorization mode): Role (namespaced) or ClusterRole (cluster-wide) lists allowed verbs on resources.
- RoleBinding or ClusterRoleBinding grants it to users, groups or service accounts.
- Least privilege: grant only what is needed.
Source: https://kubernetes.io/docs/concepts/security/controlling-access/
Practice questions
Which RBAC object grants permissions only inside a single namespace?
- ClusterRole
- ClusterRoleBinding
- Role
- ServiceAccount
Show answer
Answer: C. Role
A Role is namespaced. A ClusterRole is cluster-scoped, and bindings attach roles to subjects rather than defining permissions.
Which statements about RBAC are correct?
- RBAC permissions are purely additive; there are no deny rules
- A Role lists the users it applies to
- A RoleBinding can reference a ClusterRole to grant it within one namespace
- RBAC verifies the identity of the caller
- Bindings connect a role to users, groups or service accounts
Show answer
Answer: A. RBAC permissions are purely additive; there are no deny rules, C. A RoleBinding can reference a ClusterRole to grant it within one namespace, E. Bindings connect a role to users, groups or service accounts
RBAC is additive: there are only allow rules. A RoleBinding can reference a ClusterRole to reuse it within one namespace. Roles never hold subjects, and RBAC does not authenticate.
True or false: Kubernetes has a built-in User object that you create with kubectl to define human users.
Show answer
Answer: False
False. Kubernetes has no User object; identities come from authenticators such as client certificates or tokens. Service accounts are the only identity type stored as API objects.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
