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

    A ClusterRole with a ClusterRoleBinding grants permissions cluster-wide, so the user could manage deployments in every namespace, not just 'development'. It is tempting because ClusterRole and ClusterRoleBinding are correct when a subject genuinely needs cluster-scoped access across all namespaces.

  • ✗

    Role and ClusterRoleBinding

    Why it's wrong here

    Pairing a namespaced Role with a ClusterRoleBinding grants the permissions cluster-wide, since ClusterRoleBinding ignores namespace boundaries and binds across all namespaces. It tempts because Role plus ClusterRoleBinding is valid syntax for granting a Role's rules everywhere, which suits cluster-scoped resources or platform administrators, not a single-namespace developer.

  • ✓

    Role and RoleBinding

    Why this is correct

    A Role defines the permitted verbs on deployments, while a RoleBinding grants that Role to the specific user within the development namespace. Namespace-scoped RoleBinding confines the permissions to that namespace only, satisfying the requirement to manage deployments there alone.

  • ✗

    ClusterRole and RoleBinding

    Why it's wrong here

    A RoleBinding can only reference a Role or ClusterRole within its own namespace, so pairing it with a ClusterRole grants the permissions namespace-scoped, which works here. However, the question expects a Role plus RoleBinding; a ClusterRole is designed for permissions reused across namespaces or for cluster-scoped resources.

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 726-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: Option A is correct because the existing ClusterRole 'deployer' already contains the desired rules (create Deployments and Services), so it can be referenced directly without duplicating it. Option C is correct because a RoleBinding in namespace 'app' can reference a ClusterRole and bind it to the ServiceAccount 'ci-cd', thereby granting those ClusterRole permissions only within the 'app' namespace. Option B is unnecessary since the ClusterRole already exists and re-creating the same rules would be redundant. Option D is wrong because a ClusterRoleBinding would grant the permissions cluster-wide, not scoped to namespace 'app' as intended. Option E is incorrect because ServiceAccount tokens are handled automatically by Kubernetes and no manual Secret is required for this binding.

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.