Courseiva

Granting Namespace-Specific Permissions with Role and RoleBinding

You need to allow a specific user to create and manage deployments in the 'development' namespace only. Which RBAC resources should you create?

Quick Answer

The answer is Role and RoleBinding. This is correct because a Role grants permissions within a specific namespace, and a RoleBinding binds that Role to a user or service account within the same namespace, making them the precise RBAC resources for namespace-specific permissions. When you need to restrict a user to creating and managing deployments only in the 'development' namespace, a Role scoped to that namespace combined with a RoleBinding ensures the user cannot affect resources in other namespaces. On the CKA exam, this concept tests your understanding of Kubernetes RBAC scoping—a common trap is confusing Role with ClusterRole, which would grant permissions cluster-wide. Remember the memory tip: "Role is local, ClusterRole is global"—if the intent is namespace-specific permissions, always pair a Role with a RoleBinding.

⚠ Common exam trap

CNCF often tests the distinction between namespace-scoped and cluster-scoped resources, and the trap here is that candidates mistakenly think a ClusterRole is required for any 'management' task, or they confuse the scope of RoleBinding vs ClusterRoleBinding, leading them to pick options that grant permissions beyond the intended namespace.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Role and RoleBinding

A Role grants permissions within a specific namespace, and a RoleBinding binds that Role to a user or service account within the same namespace. To restrict a user to creating and managing deployments only in the 'development' namespace, you need a Role (scoped to that namespace) and a RoleBinding (also scoped to that namespace). ClusterRole and ClusterRoleBinding are cluster-scoped and would grant permissions across all namespaces, which is not desired here.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ClusterRole and ClusterRoleBinding

    Why it's wrong here

    These would grant permissions cluster-wide, not limited to the 'development' namespace.

  • Role and ClusterRoleBinding

    Why it's wrong here

    A Role is namespace-scoped, but a ClusterRoleBinding would grant it cluster-wide, which is not desired.

  • Role and RoleBinding

    Why this is correct

    A Role defines permissions within a namespace, and a RoleBinding grants those permissions to a user in that namespace.

  • ClusterRole and RoleBinding

    Why it's wrong here

    A ClusterRole can be used with a RoleBinding to scope it to a namespace, but the question asks for the simplest solution; Role and RoleBinding are sufficient.

Quick reference

Access Control Model Comparison

ModelAcronymWho Controls Access?Best For
Discretionary Access ControlDACResource ownerSmall teams, file shares
Mandatory Access ControlMACSystem / security labelsClassified govt / military
Role-Based Access ControlRBACAdministrator (via roles)Enterprise environments
Attribute-Based Access ControlABACPolicy engine (user + resource attributes)Fine-grained, dynamic policies
Rule-Based Access ControlRuBACSystem rules / ACLsFirewall rules, network ACLs

About these practice questions

This CKA question is part of Courseiva's 302-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on CKA

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. You have a ClusterRole named 'deployer' that allows creating Deployments and Services. You want to grant a ServiceAccount 'ci-cd' in namespace 'app' the permissions defined in this ClusterRole. Which TWO resources are needed? (Choose TWO.)

medium
  • A.The existing ClusterRole 'deployer'
  • B.Create a new ClusterRole with the same rules
  • C.RoleBinding in namespace 'app' referencing ClusterRole 'deployer' and ServiceAccount 'ci-cd'
  • D.ClusterRoleBinding with subject ServiceAccount 'ci-cd' in namespace 'app'
  • E.A Secret for the ServiceAccount

Why A: The ClusterRole 'deployer' already contains the necessary rules to allow creating Deployments and Services. You do not need to create a new ClusterRole; you can reuse the existing one. Option C is correct because a RoleBinding in namespace 'app' can reference a ClusterRole and bind it to a ServiceAccount within that namespace, granting the permissions only in that namespace. This is the standard method to grant cluster-scoped permissions to a namespaced subject.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.