<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Kubernetes Has No Users—So Why Not to Build One (Certificates + RBAC Explained)]]></title><description><![CDATA[Kubernetes Has No Users—So Why Not to Build One (Certificates + RBAC Explained)]]></description><link>https://kubeekam.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/69ee03993d6a492cddf912a3/77fc92d4-0d75-4277-9341-2f60a5c94dcd.png</url><title>Kubernetes Has No Users—So Why Not to Build One (Certificates + RBAC Explained)</title><link>https://kubeekam.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 23:07:55 GMT</lastBuildDate><atom:link href="https://kubeekam.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Kubernetes Has No Users—So I Built One (A Practical Guide to Certificates & RBAC)]]></title><description><![CDATA[Kubernetes doesn’t actually have a built-in concept of “users.”
Yet, we often hear things like:

“Create a user and give access to the cluster.”

So what’s really happening under the hood?
In this gui]]></description><link>https://kubeekam.hashnode.dev/kubernetes-has-no-users-so-i-built-one-a-practical-guide-to-certificates-rbac</link><guid isPermaLink="true">https://kubeekam.hashnode.dev/kubernetes-has-no-users-so-i-built-one-a-practical-guide-to-certificates-rbac</guid><dc:creator><![CDATA[Ekamveer Walia]]></dc:creator><pubDate>Mon, 27 Apr 2026 04:20:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69ee03993d6a492cddf912a3/4154af53-f51b-41af-b28c-ec81787ad508.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3><strong>Kubernetes doesn’t actually have a built-in concept of “users.”</strong></h3>
<p>Yet, we often hear things like:</p>
<blockquote>
<p><em>“Create a user and give access to the cluster.”</em></p>
</blockquote>
<p>So what’s really happening under the hood?</p>
<p>In this guide, we’ll walk through how to <strong>create a Kubernetes user using client certificates</strong>, assign permissions using <strong>RBAC</strong>, and configure access using <strong>kubeconfig</strong>.</p>
<p>By the end, you’ll understand:</p>
<ul>
<li><p>How Kubernetes handles identity</p>
</li>
<li><p>How authentication and authorisation actually work</p>
</li>
<li><p>And how to securely give access to a cluster</p>
</li>
</ul>
<h3>🔍 <strong>The Reality: Kubernetes Has No Users</strong></h3>
<p>Kubernetes does not store users internally.</p>
<p>Instead, it works in two steps:</p>
<ol>
<li><strong>Authentication (Who are you?)</strong></li>
</ol>
<p>Kubernetes verifies identity using:</p>
<p>Certificates Tokens External providers (OIDC)</p>
<p>2. <strong>Authorisation (What can you do?)</strong></p>
<p>Handled using RBAC (Role-Based Access Control).</p>
<p>👉 A “user” in Kubernetes is simply:</p>
<p>An identity backed by a trusted certificate</p>
<h2>🔐 Step 1: Create a Private Key and CSR</h2>
<p>First, we generate a private key and a Certificate Signing Request (CSR):</p>
<pre><code class="language-plaintext">openssl genrsa -out ekam.key 2048

openssl req -new -key ekam.key -out ekam.csr -subj "/CN=ekam/O=group1"
</code></pre>
<h3>🧠 What’s happening here?</h3>
<ul>
<li><p><code>CN=ekam</code> → Username</p>
</li>
<li><p><code>O=group1</code> → Group</p>
</li>
</ul>
<p>We are basically saying:</p>
<blockquote>
<p>“This identity should be recognised as <em>ekam</em>”</p>
</blockquote>
<h2>🏛️ Step 2: Ask Kubernetes CA to Sign the Certificate</h2>
<p>We now send the CSR to Kubernetes:</p>
<pre><code class="language-plaintext">cat ekam.csr | base64 | tr -d '\n'
</code></pre>
<p>After this you will get a output like this :</p>
<img src="https://cdn.hashnode.com/uploads/covers/69ee03993d6a492cddf912a3/edce6573-1240-4e51-9627-305a3463d53f.png" alt="" style="display:block;margin:0 auto" />

<ol>
<li><p>You need to copy the output .</p>
</li>
<li><p>You need to use <code>vi</code> command to create a <code>csr.yaml</code> file and need to copy the following code provided.</p>
</li>
<li><p>The output that you copied from (1) pointer should be pasted in 6th line in the request option by leaving a space after colon.</p>
</li>
</ol>
<pre><code class="language-plaintext">apiVersion: certificates.k8s.io/v1
kind: CertificateSigningRequest
metadata:
  name: ekam
spec:
  request: here paste the output from pointer (1)
  signerName: kubernetes.io/kube-apiserver-client
  usages:
  - client auth
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69ee03993d6a492cddf912a3/5af1879c-3596-42c1-a996-4960e3e87177.png" alt="" style="display:block;margin:0 auto" />

<p>Apply and approve:</p>
<pre><code class="language-plaintext">kubectl apply -f csr.yaml
kubectl certificate approve ekam
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69ee03993d6a492cddf912a3/7c3c697c-286b-446b-bc31-587ca8ef0fef.png" alt="" style="display:block;margin:0 auto" />

<p>Retrieve the signed certificate:</p>
<pre><code class="language-plaintext">kubectl get csr ekam -o jsonpath='{.status.certificate}' \
| base64 --decode &gt; ekam.crt
</code></pre>
<h3>🧠 What just happened?</h3>
<ul>
<li><p>Kubernetes <strong>verified and signed</strong> our request using its <strong>Certificate Authority (CA)</strong></p>
</li>
<li><p>Now, our identity is <strong>trusted by the cluster</strong></p>
</li>
</ul>
<hr />
<h2>🛂 Step 3: Assign Permissions Using RBAC</h2>
<p>Right now, the user exists—but has <strong>no permissions</strong>.</p>
<p>Let’s fix that.</p>
<ol>
<li>use this mentioned command, to create roles and users</li>
</ol>
<pre><code class="language-plaintext">cat &lt;&lt; EOF | kubectl apply -f -
</code></pre>
<ol>
<li>then use the mentioned code for creating roles</li>
</ol>
<pre><code class="language-yaml">kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  namespace: default
  name: pod-reader
rules:
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get", "watch", "list"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: read-pods
  namespace: default
subjects:
- kind: User
  name: ekam
  apiGroup: rbac.authorization.k8s.io
roleRef:
  kind: Role
  name: pod-reader
  apiGroup: rbac.authorization.k8s.io
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69ee03993d6a492cddf912a3/383b3f51-4bcf-45e2-9a79-7f744b7dd441.png" alt="" style="display:block;margin:0 auto" />

<h3>🧠 What’s happening here?</h3>
<ul>
<li><p>The <strong>Role</strong> (<code>pod-reader</code>) defines <em>what actions are allowed</em>:</p>
<ul>
<li>Read pods (<code>get</code>, <code>watch</code>, <code>list</code>) in the <code>default</code> namespace</li>
</ul>
</li>
<li><p>The <strong>RoleBinding</strong> connects that Role to our user:</p>
<ul>
<li>It says: <em>“Give these permissions to user</em> <code>ekam</code><em>”</em></li>
</ul>
</li>
</ul>
<h2>⚙️ Step 4: Configure kubeconfig</h2>
<p>Now we connect this identity to our cluster:</p>
<pre><code class="language-plaintext">kubectl config set-credentials ekam --client-certificate=ekam.crt --client-key=ekam.key
kubectl config get-contexts
kubectl config set-context ekam-context --cluster=kubernetes --namespace=default --user=ekam
kubectl config use-context ekam-context
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69ee03993d6a492cddf912a3/0f448199-e748-4dbe-880a-1b5ee1bf0d39.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/69ee03993d6a492cddf912a3/7a65844e-afa0-4b47-a64d-23a74d548b8b.png" alt="" style="display:block;margin:0 auto" />

<p>Now I have created a user named <code>ekam</code> who can only access <code>get</code> , <code>watch</code> and <code>list</code> pods.</p>
<hr />
<p>I’m Ekamveer Walia, I keep a strong interest in cloud computing and Kubernetes. I enjoy breaking down complex systems into simple, practical concepts and building things that actually work.</p>
<p>Currently, I’m focused on sharpening my skills in cloud and distributed systems with the goal of working in global tech environments. If you found this useful, feel free to connect or follow along—more hands-on content coming soon.</p>
<p>🔗 <a href="https://x.com/ekamsx">Twitter</a></p>
<p>🧑🏻‍💻 <a href="https://github.com/ekam-walia">GitHub</a></p>
<p>🔎 <a href="https://www.linkedin.com/in/ekamveer-walia-878660341/">LinkedIn</a></p>
]]></content:encoded></item></channel></rss>