Data Science In Action

Data Science In Action

[Tutorial] How to Configure K8s RBAC? (Part 2)

Let's go from namespaced to Cluster-wide RBAC

Engy Fouda's avatar
Engy Fouda
Jan 08, 2026
∙ Paid

In the previous tutorial: [Tutorial] How to Configure K8s RBAC? (Part 1), we followed the first path tutorial of creating a User/ServiceAccount, Role, and RoleBinding. In this part, we will continue the tutorial for the second path: cluster-wide. We will create the User/ServiceAccount as we did in the previous part, then create ClusterRole, and the ClusterRoleBinding.

[Tutorial] How to Configure K8s RBAC? (Part 1)

[Tutorial] How to Configure K8s RBAC? (Part 1)

Engy Fouda
·
December 18, 2025
Read full story

In the next part, we will see how the Role will be assigned to a Deployment rather than a Pod.

Data Science In Action is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.

Tutorial Steps

For this tutorial, we will use Killercoda to provision and prepare a cluster. Killercoda is a free educational platform that offers K8s playgrounds and extensive tutorials. You can sign up using your Gmail or GitHub account, or via other easy methods.

  • Goal:

    Learn and verify K8s RBAC using ServiceAccounts, Roles/ClusterRoles, and Bindings.

  • What we will do:

    1. Get the cluster nodes and the current context

    2. Create a namespace for the lab

    3. Create a user using ServiceAccount

    4. Create a ClusterRole to grant scoped permissions

    5. Create a ClusterRoleBinding to bind the ClusterRole to the ServiceAccount

    6. Confirm access with

kubectl auth can-i
User's avatar

Continue reading this post for free, courtesy of Engy Fouda.

Or purchase a paid subscription.
© 2026 Engy Fouda · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture