Bitzu

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

Single choice

Which RBAC object grants permissions only inside a single namespace?

  1. ClusterRole
  2. ClusterRoleBinding
  3. Role
  4. 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.

Select all that apply

Which statements about RBAC are correct?

  1. RBAC permissions are purely additive; there are no deny rules
  2. A Role lists the users it applies to
  3. A RoleBinding can reference a ClusterRole to grant it within one namespace
  4. RBAC verifies the identity of the caller
  5. 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

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.

Download on the App StoreGet it on Google Play

More KCNA topics in this module