<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sujjanthbalaji on Medium]]></title>
        <description><![CDATA[Stories by Sujjanthbalaji on Medium]]></description>
        <link>https://medium.com/@sujjanthbalaji?source=rss-6fcdefbc595b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ThWSCm2nqVN5Z3Yh</url>
            <title>Stories by Sujjanthbalaji on Medium</title>
            <link>https://medium.com/@sujjanthbalaji?source=rss-6fcdefbc595b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 23:13:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sujjanthbalaji/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Two]]></title>
            <link>https://medium.com/@sujjanthbalaji/two-0dacc5b0fc7d?source=rss-6fcdefbc595b------2</link>
            <guid isPermaLink="false">https://medium.com/p/0dacc5b0fc7d</guid>
            <dc:creator><![CDATA[Sujjanthbalaji]]></dc:creator>
            <pubDate>Thu, 17 Oct 2024 11:03:20 GMT</pubDate>
            <atom:updated>2024-10-17T11:03:20.651Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>How to enumerate the Kubernetes API: Extracting Version Info, RBAC Permissions, Namespaces, Pods, and Secrets</strong></h3><p>While using Kubernetes, it is important to understand the cluster’s internal workings and gain insight into the API, especially when carrying out security audits and automating processes. In this article, we shall explore the process of enumerating the Kubernetes API to obtain such crucial details in forensic collection such as version information, existing namespaces, RBAC roles, running pods, and secrets, to name a few. It is a hands-on approach for anyone who wishes to explore Kubernetes in more details and who would like to gather some “loot” for future research.</p><p><strong>What OS to use?</strong></p><p>It is recommended to use Talos Linux or just any other Linux/Ubuntu OS. These are widely supported in the DevOps and Kubernetes world and come with a large community of tools and documentation. Moreover, Ubuntu is the reference platform for Kubernetes on all major public cloud. Canonical Kubernetes is built on Ubuntu and combines security with optimal price-performance.</p><p>However, in this blog, we can explore the clusters and information extraction in Windows itself.</p><p><strong>Prerequisites</strong></p><p>Before we start, ensure you have the following:</p><p>· Minikube installed on your Windows machine.</p><p>· kubectlinstalled (this usually comes with Minikube).</p><p>If kubectl<strong>is not</strong> installed, you can set it up using these steps:</p><p>· Download from the <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/">official Kubernetes site</a>.</p><p>· Add kubectl to your system path. You can add its directory to the Windows <strong>PATH </strong>for easy access from PowerShell/Command Prompt.</p><p>Verify your kubectl installation using the command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d3I-BRh2lQ_PmxEPPhgwBQ.png" /></figure><p>kubectl version — client</p><p><strong>Step-by-step guide to Enumerating Kubernetes API on Windows</strong></p><p>With everything so far setup, let’s dive into the enumerting the Kubernetes API. Use Windows Powershell to run the commands.</p><p><strong><em>1. Check RBAC permissions</em></strong></p><p>To find out what actions your current user token can perform within the cluster, run:</p><p>kubectl auth can-i — list</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5E12YLwG1vprNTATHi3ng.png" /></figure><p>This will display a list of allowed actions, including whether you can create pods, read secrets, or perform other administrative tasks.</p><p>This command highlights the RBAC permissions on the token, i.e., if it can create pods, read secrets, etc</p><p><strong>2. List available Namespaces</strong></p><p>Namespaces are a great way to organize resources in Kubernetes. To list all the namespaces in your cluster, use:</p><p>kubectl get namespaces</p><p>You’ll see all available namespaces, their status and how old they are, which is helpful if you’re working on a multi-tenant or shared cluster.</p><p><em>Here, “AGE 9d” tells us that these namespaces are all 9 days old.</em></p><p><strong>3. List running pods</strong></p><p>To see all running pods across all namespaces, use:</p><p>kubectl get pods — all-namespaces</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DQnd085ENJatb6rma2YORw.png" /></figure><p>This command shows all running pods, their namespace, status, and age. Monitoring your running pods is essential for understanding cluster workloads and performance.</p><p>All the pods that were created on this machine are displayed along with their name, status, and age.</p><p><strong>4. Enumerate and decode secrets</strong></p><p>Secrets in Kubernetes are used to store sensitive information. You can list the secrets stored in the cluster by running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LchI6lEEm_Jtyftjd3b0Wg.png" /></figure><p>kubectl get secrets — all-namespaces</p><p>Displaying a secret that we have just created.</p><p>In case, you do not have any secrets in your namespace, you can create a generic secret jsut for testing purporses using a command that looks something like this:</p><p>kubectl create secret generic my-test-secret — from-literal=username=my-user — from-literal=password=my-password</p><p>Oh, and, secrets are encoded in <strong>base64</strong> by default, and you can decode them using the following commands:</p><p>· Get the base64-encoded password first:</p><p>kubectl get secret my-test-secret -o jsonpath=”{.data.password}”</p><p>· Decode base64 in Powershell:<br> <em>Replace “your-base64-encoded-string” with the actual string that you obtain from running the above command.</em></p><p>$encodedSecret = “your-base64-encoded-string”<br> [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encodedSecret))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DQnd085ENJatb6rma2YORw.png" /></figure><p>This will decode and display the actual secret contents. You can save it to a file if you need to analyze or store the data:</p><p>[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encodedSecret)) | Out-File -FilePath “path_to_your_file\secret_data.txt”</p><p>Two tabs displaying the command and the storing of the file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PThLrddt6XbfY71Q-gdbtw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SvQCsNhpnFKsUoR52x0OZQ.png" /></figure><p>With the above command, we can store the decoded secrets/data into a ‘<em>secrets.txt</em>’ file. Be cautious with this information, especially in a production environment, since secrets often contain credentials, tokens or other sensitive data.</p><p><strong>Conclusion</strong></p><p>This marks the end of the hands-on working on this article. Using this guide, you must be able to:</p><p>· Extract Kubernetes version information</p><p>· Enumerate RBAC permissions to understand user privileges</p><p>· List available namespaces and running pods</p><p>· Decode and store sensitive data from Kubernetes secrets</p><p><strong>Security Considerations</strong></p><p>Remember that exposing secrets or giving excessive permissions in a Kubernetes cluster can be a significant security risk. Always apply the principle of least privilege, ensuring that only the required permissions are assigned.</p><p>Make sure secrets are handled with care and that auditing and monitoring are regularly performed, especially in production environments.</p><p><em>“Kubernetes was born in a cauldron of fire, battle-tested and ready for massive workloads.”</em></p><p>With these steps, you’ll be able to dig deep into your Kubernetes API and manage your cluster more effectively. This setup works smoothly on Windows, so get ready to explore Kubernetes in-depth in the future!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0dacc5b0fc7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>