Mastering Kubernetes One Task at a Time — RBAC Authorization with X509 Client Cert Authentication
An end-to-end example of Kubernetes Role-based access control (RBAC) authorization with User Account authentication.
Table of Contents
- Introduction
- Create KIND Cluster
- Part 1 — Create Pod, Role, and RoleBinding
- Part 2 — Create X509 Client Certs Authenticated “User”
- Part 3 — Test RBAC Authorization
- Conclusion

Introduction
True to its promise, The AWS Way — IaC in Action — A Docker and KIND Ready Amazon EC2 Node, has been my constant everyday companion since I wrote the blog a few weeks ago. I’ve been using it to create my KIND cluster and practice as many Kubernetes tasks as possible following the Kubernetes.io official guide. This single EC2 instance with the three “nodes” cluster has proven surprisingly resilient throughout the practice and testing cycle.
Taking a step further, now I’ve equipped this environment with a GitHub repository housing all my scripts under the /home/ec2-user/jdluther-kubernetes-io-tasks folder. You’re free to use these scripts for your purpose. The gist code below explains how to take advantage of these treasures. The repo is still a work in progress. I continue to add complete end-to-end scripts to make it easy to fire off the cluster and then practice these scripts one by one predictably and painlessly.
All towards the noble end-goal of Mastering Kubernetes One Task at a Time.
In this edition, I am going to present the RBAC authorization example. As you’ll see, the completeness of the scripts helps to learn and test out the concepts in a matter of a few minutes. It also provides the repeatability opportunity to play around and experiment further on your own.
I hope to bring similar demonstrations of all the other Kubernetes tasks in future posts.
Create KIND Cluster
All Kubernetes tasks will need a cluster, so we begin by creating the cluster using the Infrastructure as Code (IaC). Below are the blog and the gist code links to fire off terraform and prepare the cluster.
Please note this section would be a leitmotif of all Kubernetes tasks I am going to cover, including the present and future ones.
- Gist code — The AWS Way — IaC in Action — A Docker and KIND Ready Amazon EC2 Node-IaC Code. See the raw version for better readability and easier command copy/paste.
- See blog for more details — The AWS Way — IaC in Action — A Docker and KIND Ready Amazon EC2 Node.
Part 1 — Create Pod, Role, and RoleBinding
The entire demonstration consists of THREE parts, starting with Part I below, where we’ll create the Kubernetes role and bind the Role to a Kubernetes cluster “user” that we’d create in Part II. And, of course, we’ll also create the pod that the Role is trying to manage through its authorization specification.
Kubernetes.io — Using RBAC Authorization is the page you want to refer to for more information and learn about Kubernetes Role and RoleBinding.
Again, everything has already been bootstrapped in the EC2 instance running Docker and KIND cluster. The code below demonstrates how to execute the tasks using the provided code via the GitHub repo. You have full liberty to bypass the gist code below and instead refer to and run the code given in the script residing in the EC2 instance.





