Skip to main content
In this lesson, we’ll dive into Kubernetes Role-Based Access Control (RBAC) to manage permissions for users and services. We’ll cover:
  1. Inspecting API server authorization modes
  2. Counting existing Roles
  3. Examining the built-in kube-proxy Role
  4. Reviewing RoleBindings for kube-proxy
  5. Verifying dev-user permissions
  6. Granting Pod permissions to dev-user
  7. Fixing Pod permissions in the blue namespace
  8. Granting Deployment permissions in the blue namespace

1. Inspect API Server Authorization Modes

To confirm that RBAC is enabled, inspect the API server manifest:
Look for the --authorization-mode flag:
Alternatively, on the control-plane node:
The image shows a terminal interface with a task to inspect the environment and identify authorization modes configured on a Kubernetes cluster, specifically checking the kube-apiserver settings. There are options for selecting different authorization modes like Node, RBAC, ABAC, and Node,RBAC.
RBAC must be enabled on your API server for Roles and RoleBindings to function correctly.

2. Count Existing Roles

List Roles in the default namespace:
Count all Roles across namespaces:

3. Examine the kube-proxy Role

View the kube-proxy Role in kube-system:
True/False:
  • True: It can get the ConfigMap named kube-proxy.
  • False: It cannot delete or update the ConfigMap.
  • False: It cannot list or watch ConfigMaps.

4. Identify the Subject of the kube-proxy RoleBinding

List RoleBindings in kube-system:
Describe the kube-proxy RoleBinding:

5. Verify dev-user Permissions

After adding dev-user to your kubeconfig:
Attempt to list Pods in default:
dev-user currently has no permissions in default. You must create Roles and RoleBindings to grant access.

6. Grant Pod Permissions to dev-user

6.1 Create the developer Role

Verify:

6.2 Bind dev-user to the Role

Confirm:
Now dev-user can list Pods:

7. Fix Permissions for a Pod in the blue Namespace

  1. Inspect existing Roles and RoleBindings:
  2. Describe the developer Role:
  3. Edit the Role to match the actual Pod name:
    Update to:
  4. Verify access:

8. Grant Deployment Permissions in the blue Namespace

  1. Edit the developer Role again:
  2. Add a rule for deployments in the apps API group:
  3. Verify:
  4. Create a Deployment as dev-user:

Watch Video