<?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 Taher on Medium]]></title>
        <description><![CDATA[Stories by Taher on Medium]]></description>
        <link>https://medium.com/@tahert?source=rss-57b7eedd3b8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*H7zlgI7U8wvTJQZLj8ynxA.jpeg</url>
            <title>Stories by Taher on Medium</title>
            <link>https://medium.com/@tahert?source=rss-57b7eedd3b8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 06:41:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tahert/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[Keeping Your Azure Bills in Check: A Witty Bash Script to Save Your Wallet]]></title>
            <link>https://medium.com/@tahert/keeping-your-azure-bills-in-check-a-witty-bash-script-to-save-your-wallet-8ae7e411b575?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ae7e411b575</guid>
            <category><![CDATA[finops]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Fri, 04 Jul 2025 04:29:12 GMT</pubDate>
            <atom:updated>2025-07-04T12:06:45.230Z</atom:updated>
            <content:encoded><![CDATA[<h3>Picture this: you’re sipping coffee, basking in the glow of your perfectly architected Azure cloud empire, when — BAM! — the monthly bill hits like a rogue asteroid. Suddenly, your meticulously planned budget is doing somersaults, and you’re wondering if your cloud resources have secretly been mining crypto on the side. Fear not, cloud crusader! Enter a nifty Bash script that’s here to keep your Azure costs in check with the precision of a Swiss watch and the charm of a stand-up comedian.</h3><p>In this article, we’ll dive into a simple yet powerful Bash script that queries your Azure subscription costs using the Azure Cost Management API. We’ll explore its use cases, benefits, and why it’s the financial sidekick you never knew you needed. Buckle up — this is going to be both informative <em>and</em> fun!</p><h3>The Script: Your Azure Bill’s New Best Friend</h3><p>Let’s meet the star of the show: a Bash script that fetches your month-to-date Azure subscription costs and presents them in a delightfully formatted way. Here’s the script in all its glory:</p><pre>#!/bin/bash<br><br>SUB_ID=$(az account show --query id -o tsv)<br><br># Get access token<br>ACCESS_TOKEN=$(az account get-access-token --resource https://management.azure.com --query accessToken -o tsv)<br><br>URL=&quot;https://management.azure.com/subscriptions/${SUB_ID}/providers/Microsoft.CostManagement/query?api-version=2023-11-01&quot;<br><br># Function to query cost for a given timeframe<br>query_cost() {<br>  local timeframe=$1<br>  local output_file=$2<br>  local request_body=&#39;{<br>    &quot;type&quot;: &quot;Usage&quot;,<br>    &quot;timeframe&quot;: &quot;&#39;${timeframe}&#39;&quot;,<br>    &quot;dataset&quot;: {<br>      &quot;granularity&quot;: &quot;None&quot;,<br>      &quot;aggregation&quot;: {<br>        &quot;totalCost&quot;: {<br>          &quot;name&quot;: &quot;PreTaxCost&quot;,<br>          &quot;function&quot;: &quot;Sum&quot;<br>        }<br>      }<br>    }<br>  }&#39;<br><br>  curl -s -X POST \<br>    &quot;${URL}&quot; \<br>    -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot; \<br>    -H &quot;Content-Type: application/json&quot; \<br>    -d &quot;${request_body}&quot; &gt; &quot;${output_file}&quot;<br>}<br><br># Query costs for different timeframes<br>query_cost &quot;YearToDate&quot; &quot;year_to_date.json&quot;<br>query_cost &quot;TheLastBillingMonth&quot; &quot;last_month.json&quot;<br>query_cost &quot;MonthToDate&quot; &quot;month_to_date.json&quot;<br><br># Extract costs using jq<br>year_to_date=$(jq &#39;.properties.rows[0][0]&#39; year_to_date.json 2&gt;/dev/null || echo &quot;0&quot;)<br>last_month=$(jq &#39;.properties.rows[0][0]&#39; last_month.json 2&gt;/dev/null || echo &quot;0&quot;)<br>month_to_date=$(jq &#39;.properties.rows[0][0]&#39; month_to_date.json 2&gt;/dev/null || echo &quot;0&quot;)<br><br># Display results in a table<br>echo &quot;📊 Azure Subscription Costs&quot;<br>printf &quot;Year To Date     | [1;32m USD $%.2f[0m \n&quot; $year_to_date<br>printf &quot;Last Month       | [1;32m USD $%.2f[0m \n&quot; $last_month<br>printf &quot;Month To Date    | [1;32m USD $%.2f[0m \n&quot; $month_to_date<br><br># Clean up temporary files<br>#rm -f year_to_date.json last_month.json month_to_date.json<br><br><br>printf &quot;\033[0m\n&quot;  # Reset styles<br>printf &quot;\033[34m╔═════════════════════════════════════════════════════════╗\n&quot;<br>printf &quot;\033[34m║\033[37;1m                                            \033[34m             ║\n&quot;    <br>printf &quot;\033[34m║\033[37;1m    \033[44;97;1m A Z U R E   S U B S C R I P T I O N   C O S T   \033[0m\033[34m    ║\n&quot;<br>printf &quot;\033[34m║\033[37;1m                                            \033[34m             ║\n&quot;<br>printf &quot;\033[34m╚═════════════════════════════════════════════════════════╝\n&quot;<br>printf &quot;\033[0m&quot;  # Reset styles again</pre><p>This script is like a financial detective: it logs into Azure, interrogates the Cost Management API, saves the evidence to a JSON file, and then proudly announces your month-to-date spending in bold green dollars. Let’s break down its use cases and why it’s the hero your Azure account deserves.</p><h3>Use Cases: Where This Script Shines Brighter Than a Supernova</h3><h3>1. Real-Time Budget Reality Checks</h3><p>Ever wonder how much your Azure playground is costing you <em>this month</em>? This script delivers a month-to-date cost snapshot faster than you can say “cloud overspending.” It’s perfect for teams who need to keep tabs on their budget without diving into the Azure portal’s labyrinth of menus. Run it daily, and you’ll know exactly when your VMs start acting like they’re on an all-you-can-eat buffet.</p><h3>2. Automated Cost Monitoring</h3><p>Plug this script into a cron job or a CI/CD pipeline, and you’ve got yourself a tireless cost watchdog. It’s like having a financial advisor who works for free and never sleeps. Set it to run daily, weekly, or whenever you feel like peeking at your Azure wallet, and it’ll dutifully report back with your spending stats.</p><h3>3. Team Accountability (a.k.a. “Who Let the VMs Run Wild?”)</h3><p>If you’re managing a team of cloud enthusiasts, this script can help you keep everyone in check. Share the output in a Slack channel or email, and suddenly everyone’s aware that those “experimental” Kubernetes clusters are costing more than a fancy coffee machine. Transparency breeds responsibility, and this script is your transparency machine.</p><h3>4. Auditing and Reporting</h3><p>Need to justify your cloud expenses to the CFO? The script saves the raw API response to cost_response.json, giving you a detailed record for audits or deeper analysis. Pair it with a tool like jq for custom queries, and you’ll be slicing and dicing cost data like a Michelin-star chef.</p><h3>5. Learning and Experimentation</h3><p>For Azure newbies or DevOps learners, this script is a fantastic way to dip your toes into the Azure Cost Management API. It’s simple enough to understand but powerful enough to inspire you to build more complex cost-tracking tools. Plus, it’s a great excuse to flex your Bash and curl skills.</p><h3>Benefits: Why This Script Is Your Cloud’s New BFF</h3><h3>1. Saves Time (and Sanity)</h3><p>Logging into the Azure portal, navigating to Cost Management, and waiting for the UI to load can feel like an eternity — especially when you’re just trying to answer, “How much are we spending?” This script delivers the answer in seconds, leaving you more time to debug that pesky Terraform script or, you know, enjoy your coffee.</p><h3>2. Cost-Conscious Culture</h3><p>When you make cost visibility a daily ritual, your team starts thinking twice before spinning up that 64-core VM “just to test something.” This script fosters a culture of cost awareness without the need for stern emails or budget meetings that drag on forever.</p><h3>3. Customizable and Extensible</h3><p>Want to track costs by resource group? Filter by service type? Add a fancy ASCII art dollar sign? The script’s JSON output and API flexibility make it a springboard for customization. With a bit of jq magic or additional API tweaks, you can tailor it to your heart’s content.</p><h3>4. No PhD in Azure Required</h3><p>The script uses the Azure CLI to handle authentication, so you don’t need to wrestle with OAuth tokens or complex credential management. If you’ve got the Azure CLI installed and a subscription ID, you’re halfway to cost-tracking nirvana.</p><h3>5. Pretty Output for the Win</h3><p>Let’s be honest: who doesn’t love a splash of color? The script’s printf command outputs your total cost in bold green, making the experience feel less like a budget review and more like a victory lap. (Unless your costs are through the roof, in which case… maybe switch to decaf.)</p><h3>A Few Caveats (Because No Hero Is Perfect)</h3><ul><li><strong>Subscription ID Required</strong>: You’ll need to pop your Azure subscription ID into the SUB_ID variable. No ID, no cost data—it’s like trying to order pizza without an address.</li><li><strong>Dependencies</strong>: The script assumes you’ve got az (Azure CLI), curl, and jq installed. If you don’t, it’s like showing up to a potluck with nothing but a fork.</li><li><strong>API Limits</strong>: The Azure Cost Management API has rate limits, so don’t go wild running this script every millisecond unless you want Azure to give you the cold shoulder.</li></ul><h3>How to Use It: A 30-Second Guide</h3><ol><li>Install the Azure CLI, curl, and jq on your machine.</li><li>Log in to Azure with az login.</li><li>Plug your subscription ID into the SUB_ID variable.</li><li>Run the script: bash cost_script.sh.</li><li>Marvel at your month-to-date costs in glorious green.</li></ol><p>Pro tip: Save the script as check_azure_costs.sh, make it executable with chmod +x check_azure_costs.sh, and schedule it with a cron job for automated cost updates.</p><h3>The Big Picture: Why This Matters</h3><p>In the wild world of cloud computing, costs can spiral faster than a viral cat video. This Bash script is your first line of defense — a lightweight, witty tool that keeps you informed without bogging you down. Whether you’re a solo developer, a DevOps guru, or a team lead herding cloud cats, this script empowers you to take control of your Azure spending with minimal fuss and maximum flair.</p><p>So, the next time your Azure bill tries to pull a fast one, you’ll be ready with this script in your toolkit. Run it, laugh at its colorful output, and rest easy knowing your cloud empire is both mighty <em>and</em> budget-friendly. Now, go forth and conquer the cloud — without breaking the bank!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ae7e411b575" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Patch to add a Liveness Probe]]></title>
            <link>https://medium.com/@tahert/patch-to-add-a-liveness-probe-03513899cd28?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/03513899cd28</guid>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Sun, 01 Dec 2024 04:59:08 GMT</pubDate>
            <atom:updated>2024-12-01T04:59:08.727Z</atom:updated>
            <content:encoded><![CDATA[<pre>kubectl patch deployment &lt;deployment-name&gt; \<br>  --patch &#39;{<br>    &quot;spec&quot;: {<br>      &quot;template&quot;: {<br>        &quot;spec&quot;: {<br>          &quot;containers&quot;: [<br>            {<br>              &quot;name&quot;: &quot;&lt;container-name&gt;&quot;,<br>              &quot;livenessProbe&quot;: {<br>                &quot;httpGet&quot;: {<br>                  &quot;path&quot;: &quot;/nonexistent&quot;,<br>                  &quot;port&quot;: 80<br>                },<br>                &quot;initialDelaySeconds&quot;: 5,<br>                &quot;periodSeconds&quot;: 10<br>              }<br>            }<br>          ]<br>        }<br>      }<br>    }<br>  }&#39;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03513899cd28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[To mount Azure Data Lake Storage (ADLS) (Gen1 or Gen2) to pods in an Azure Kubernetes Service (AKS)…]]></title>
            <link>https://medium.com/@tahert/to-mount-azure-data-lake-storage-adls-gen1-or-gen2-to-pods-in-an-azure-kubernetes-service-aks-1dc7c2375ab5?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1dc7c2375ab5</guid>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 03:54:59 GMT</pubDate>
            <atom:updated>2024-11-22T03:54:59.371Z</atom:updated>
            <content:encoded><![CDATA[<h3>To mount <strong>Azure Data Lake Storage (ADLS)</strong> (Gen1 or Gen2) to pods in an Azure Kubernetes Service (AKS) cluster</h3><p>. The mounting process uses <strong>blobfuse</strong> or <strong>NFS</strong> for Azure Blob Storage or <strong>ABFS driver</strong> for direct access to ADLS Gen2.</p><p>Here’s how you can mount Azure Data Lake Storage to AKS pods:</p><h3>1. Prerequisites</h3><ul><li><strong>ADLS Gen2 Enabled</strong>: Ensure your Azure Storage Account has hierarchical namespace enabled (if using ADLS Gen2).</li><li><strong>Azure Kubernetes Cluster</strong>: Ensure the AKS cluster is properly configured and has access to the Azure storage resources.</li><li><strong>Azure Role Assignment</strong>: Grant the necessary permissions (e.g., Storage Blob Data Reader or Contributor) to the AKS node&#39;s Managed Identity or the Service Principal.</li></ul><h3>2. Mount ADLS Using Blobfuse</h3><h4>Step 2.1: Install Blobfuse</h4><p>Blobfuse allows you to mount an Azure Blob Storage container as a filesystem in Linux. For ADLS Gen2, Blobfuse uses the ABFS driver.</p><h4>Step 2.2: Create a Kubernetes Secret</h4><p>Create a Kubernetes secret to store the storage account credentials.</p><pre>kubectl create secret generic blobfusecreds \<br>  --from-literal=accountname=&lt;storage-account-name&gt; \<br>  --from-literal=accountkey=&lt;storage-account-key&gt;</pre><h4>Step 2.3: Create a PersistentVolume (PV)</h4><p>Define a PV that uses the Blobfuse driver.</p><pre>apiVersion: v1<br>kind: PersistentVolume<br>metadata:<br>  name: blobfuse-pv<br>spec:<br>  capacity:<br>    storage: 5Gi<br>  accessModes:<br>    - ReadWriteMany<br>  persistentVolumeReclaimPolicy: Retain<br>  storageClassName: blobfuse<br>  csi:<br>    driver: blob.csi.azure.com<br>    volumeAttributes:<br>      containerName: &lt;container-name&gt;<br>      mountOptions: &quot;--use-https=true&quot;</pre><h4>Step 2.4: Create a PersistentVolumeClaim (PVC)</h4><p>Request storage using a PVC.</p><pre>apiVersion: v1<br>kind: PersistentVolumeClaim<br>metadata:<br>  name: blobfuse-pvc<br>spec:<br>  accessModes:<br>    - ReadWriteMany<br>  resources:<br>    requests:<br>      storage: 5Gi<br>  storageClassName: blobfuse</pre><h4>Step 2.5: Mount the PVC in a Pod</h4><p>Use the PVC in a pod definition.</p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: blobfuse-pod<br>spec:<br>  containers:<br>  - name: my-app<br>    image: nginx<br>    volumeMounts:<br>    - mountPath: &quot;/mnt/blob&quot;<br>      name: blob-storage<br>  volumes:<br>  - name: blob-storage<br>    persistentVolumeClaim:<br>      claimName: blobfuse-pvc</pre><h3>3. Mount ADLS Using NFS</h3><p>If your storage account has NFS enabled, you can use it to mount storage in AKS.</p><h4>Step 3.1: Enable NFS for the Storage Account</h4><ul><li>In the Azure Portal, enable the <strong>NFS v3 protocol</strong> for your storage account.</li></ul><h4>Step 3.2: Create a PersistentVolume</h4><p>Define a PV for NFS.</p><pre>apiVersion: v1<br>kind: PersistentVolume<br>metadata:<br>  name: nfs-pv<br>spec:<br>  capacity:<br>    storage: 5Gi<br>  accessModes:<br>    - ReadWriteMany<br>  persistentVolumeReclaimPolicy: Retain<br>  nfs:<br>    server: &lt;storage-account-nfs-endpoint&gt;<br>    path: &quot;/&lt;container-name&gt;&quot;</pre><h4>step 3.3: Create a PVC and Use in a Pod</h4><p>Follow the same steps as for Blobfuse to define a PVC and use it in a pod.</p><h3>4. Access ADLS Using the ABFS Driver</h3><p>The ABFS driver provides direct access to ADLS Gen2, primarily for big data processing frameworks like Hadoop. However, you can use it programmatically in containers.</p><h4>Step 4.1: Install Azure CLI in the Pod</h4><p>Include the Azure CLI in your container to authenticate with ADLS Gen2 using the ABFS driver.</p><h4>Step 4.2: Programmatically Access ADLS</h4><p>Use the Hadoop ABFS driver or other libraries (e.g., Python azure-storage-file-datalake) to access files within your application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1dc7c2375ab5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[if we’re giving the rbac permissions for the azure files, why do we need to give access keys ?]]></title>
            <link>https://medium.com/@tahert/if-were-giving-the-rbac-permissions-for-the-azure-files-why-do-we-need-to-give-access-keys-0f2f24523a49?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f2f24523a49</guid>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Mon, 28 Oct 2024 03:55:55 GMT</pubDate>
            <atom:updated>2024-10-28T03:55:55.061Z</atom:updated>
            <content:encoded><![CDATA[<h3>if we’re giving the rbac permissions for the azure files, why do we need to give access keys ?</h3><h3>Explanation</h3><ul><li><strong>Azure Files Authentication Options</strong>: Currently, <strong>Azure Files requires either Azure Active Directory Domain Services (AD DS)</strong> integration for <strong>SMB protocol access</strong> or <strong>access keys</strong> to authenticate access.</li><li><strong>RBAC Permissions</strong>: When you assign RBAC roles like <strong>Storage File Data SMB Share Contributor</strong>, these permissions allow the User-Assigned Managed Identity (UAMI) to interact with the Azure Files share, such as reading, writing, and deleting files, but they do <strong>not</strong> replace the need for an authentication mechanism (e.g., access key or AD DS) for mounting the share.</li></ul><h3>Why RBAC Alone Isn’t Sufficient</h3><p>Azure’s RBAC roles control <strong>authorization</strong> (what actions are allowed) but do <strong>not provide the means for authentication</strong> (how the resource is accessed). For Azure Files, SMB authentication still relies on either <strong>AD DS credentials</strong> or the <strong>storage account access key</strong>, even when you’ve given the UAMI necessary permissions.</p><h3>Summary</h3><ul><li><strong>RBAC</strong> manages permissions once the identity is authenticated.</li><li><strong>Access Key or AD DS</strong> is still required for the authentication step when mounting an Azure Files share via SMB.</li></ul><p>In essence, while RBAC controls the access level (what actions are permitted), the access key is still needed to establish the connection for SMB mounts. This is why storing the access key securely in Azure Key Vault can be a workaround if AD DS is not set up.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f2f24523a49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cross Subscription PVC with Storage Account]]></title>
            <link>https://medium.com/@tahert/cross-subscription-pvc-with-storage-account-3513ca19a477?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3513ca19a477</guid>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Fri, 18 Oct 2024 09:26:38 GMT</pubDate>
            <atom:updated>2024-10-18T09:26:38.581Z</atom:updated>
            <content:encoded><![CDATA[<p>To enforce security so that only a certain namespace can create a PersistentVolumeClaim (PVC) from a specific Azure File Share in Azure Kubernetes Service (AKS), you can leverage <strong>Kubernetes RBAC (Role-Based Access Control)</strong> and <strong>Storage Classes</strong>. Here’s how you can implement this:</p><h3>Key Steps:</h3><ol><li><strong>Create the Azure File Share and Secret for Access</strong></li><li><strong>Create a Kubernetes StorageClass for the Azure File Share</strong></li><li><strong>Create the PersistentVolume (PV)</strong></li><li><strong>Restrict PVC Creation to a Specific Namespace Using RBAC</strong></li></ol><h3>1. Create the Azure File Share and Secret for Access</h3><p>First, ensure that you have an Azure File Share set up in a Storage Account:</p><ul><li><strong>Create the Azure File Share</strong>:</li><li>az storage account create --name &lt;StorageAccountName&gt; --resource-group &lt;ResourceGroup&gt; --location &lt;Location&gt; --sku Standard_LRS az storage share create --name &lt;FileShareName&gt; --account-name &lt;StorageAccountName&gt;</li><li><strong>Get Storage Account Keys</strong>:</li><li>az storage account keys list --resource-group &lt;ResourceGroup&gt; --account-name &lt;StorageAccountName&gt;</li><li><strong>Create a Kubernetes Secret in the Target Namespace</strong>:</li><li>Store the access key for the storage account in a secret (you will create this secret in the specific namespace where you want to allow access).</li><li>kubectl create secret generic azure-secret --namespace &lt;TargetNamespace&gt; \ --from-literal=azurestorageaccountname=&lt;StorageAccountName&gt; \ --from-literal=azurestorageaccountkey=&lt;StorageAccountKey&gt;</li></ul><h3>2. Create a Kubernetes StorageClass for the Azure File Share</h3><p>Next, create a StorageClass that defines the Azure File Share as the storage provider.</p><pre>apiVersion: storage.k8s.io/v1<br>kind: StorageClass<br>metadata:<br>  name: azurefile-sc<br>provisioner: kubernetes.io/azure-file<br>parameters:<br>  skuName: Standard_LRS  # or Premium_LRS<br>  storageAccount: &lt;StorageAccountName&gt;</pre><p>Apply the StorageClass</p><h3>3. Create the PersistentVolume (PV)</h3><p>Now, create a PersistentVolume (PV) that uses the Azure File Share.</p><pre>apiVersion: v1<br>kind: PersistentVolume<br>metadata:<br>  name: azurefile-pv<br>spec:<br>  capacity:<br>    storage: 10Gi<br>  accessModes:<br>    - ReadWriteMany<br>  storageClassName: azurefile-sc<br>  azureFile:<br>    secretName: azure-secret<br>    shareName: &lt;FileShareName&gt;<br>    readOnly: false<br>  persistentVolumeReclaimPolicy: Retain</pre><p>Apply the PersistentVolume:</p><h3>4. Restrict PVC Creation to a Specific Namespace Using RBAC</h3><p>To restrict the creation of PersistentVolumeClaim (PVC) for this Azure File Share to only a certain namespace, you can use <strong>Kubernetes RBAC</strong> to limit who can create PVCs using this particular StorageClass.</p><ul><li><strong>Create a Role for PersistentVolumeClaim Creation</strong>:</li><li>Define a role that allows PVC creation only within the target namespace and only for the specific StorageClass.</li></ul><pre>apiVersion: rbac.authorization.k8s.io/v1<br>kind: Role<br>metadata:<br>  namespace: &lt;TargetNamespace&gt;<br>  name: pvc-creator<br>rules:<br>- apiGroups: [&quot;&quot;]  # Core API group<br>  resources: [&quot;persistentvolumeclaims&quot;]<br>  verbs: [&quot;create&quot;, &quot;get&quot;, &quot;list&quot;, &quot;watch&quot;]<br>  resourceNames: [&quot;azurefile-sc&quot;]  # Only allow PVCs bound to this StorageClass</pre><ul><li><strong>Bind the Role to Users/Service Accounts</strong>:</li><li>Bind the role to the users, groups, or service accounts that should have access to create PVCs in this namespace.</li></ul><pre>apiVersion: rbac.authorization.k8s.io/v1<br>kind: RoleBinding<br>metadata:<br>  name: pvc-creator-binding<br>  namespace: &lt;TargetNamespace&gt;<br>subjects:<br>- kind: User  # or ServiceAccount<br>  name: &lt;UserName or ServiceAccount&gt;<br>  apiGroup: rbac.authorization.k8s.io<br>roleRef:<br>  kind: Role<br>  name: pvc-creator<br>  apiGroup: rbac.authorization.k8s.io</pre><h3>5. Enforce Default StorageClass Only for the Target Namespace</h3><p>To enforce that the azurefile-sc StorageClass is used only in the target namespace, do <strong>not mark it as the default StorageClass</strong>. This ensures that PVCs created without specifying a StorageClass won&#39;t automatically bind to it.</p><h3>Summary:</h3><ul><li><strong>StorageClass</strong>: Defined for the Azure File Share.</li><li><strong>PersistentVolume</strong>: Configured to use the Azure File Share.</li><li><strong>Namespace and RBAC</strong>: You set up an RBAC role that allows PVC creation using the specific StorageClass only in the designated namespace. This ensures that only authorized users and workloads in that namespace can create PVCs from the Azure File Share.</li></ul><p>By combining <strong>RBAC</strong> with <strong>StorageClass</strong> restrictions, you can enforce security and limit which namespaces or users can access certain storage resources in AKS.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3513ca19a477" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Limiting the Blast Radius in the Cloud: The Art of “Oops Management” (Part 1)]]></title>
            <link>https://medium.com/@tahert/limiting-the-blast-radius-in-the-cloud-the-art-of-oops-management-part-1-0c1fcdb7320b?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/0c1fcdb7320b</guid>
            <category><![CDATA[hacks]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[zero-trust]]></category>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Sat, 07 Sep 2024 04:25:12 GMT</pubDate>
            <atom:updated>2024-09-07T04:33:33.923Z</atom:updated>
            <content:encoded><![CDATA[<h3>Welcome to the cloud! It’s where everything’s scalable, and security holes are, too! The more infrastructure you build, the more creative the disasters get, like cosmic irony on an enterprise scale. Let’s talk about limiting the “blast radius” — because if something goes wrong, you don’t want it to blow up the entire architecture.</h3><p>Get your bunker-ready attitude on; we’re building resilient cloud fortresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*hZzmqJn82yc5fSWMfKoRRg.jpeg" /></figure><h3>Divide and Conquer (No, Seriously)</h3><h3>“If your infrastructure was a pizza, slice it thin.”</h3><p>You wouldn’t build a house without fire doors. Why would you build an infrastructure without the same level of protection? Think of your cloud architecture like a pizza. It looks harmless until you realize you’ve thrown habaneros on just one slice. If that fire spreads, the whole pizza burns. Now you’ve got the attention of Ops, Security, and possibly someone in Marketing (“Why is our website down, bro?”).</p><p><strong>Segment everything</strong>. Firewalls, virtual networks, subnets — use them like pepperoni: generously and everywhere. A good rule of thumb is, “If it can talk to something else, ask yourself: should it?” (Hint: the answer is usually <strong>no</strong>).</p><p><strong>Example</strong>? A web app: The load balancer sits out front, ready to take all the internet’s love (and attacks), so isolate it from your app and data layers. Imagine your load balancer gets pwned (not your fault, totally a “feature” from the vendor, right?). You don’t want that to lead straight to your precious app servers. Keep them in their own padded rooms (aka <strong>isolated networks</strong>).</p><h3>Least Privilege: More like “Zero Trust”</h3><h3>“Why does that junior intern have access to your entire production environment? No reason.”</h3><p>Who needs access to your kingdom? Ideally, fewer people than get invited to your family dinner. Your infra doesn’t need to be an open-house for every dev, ops person, or <em>shudder</em> contractor. Least privilege is the golden rule: give the absolute bare minimum access to <em>everybody</em>.</p><p>In real life: That microservice that fetches cat pictures for your app doesn’t need write access to your database with <em>everything</em>. But guess what? People are lazy. “Just give it full access, it’s easier!” That’s how bad days happen. Restrict it to read-only, or your next prod outage might just have a feline flavor.</p><p>And for heaven’s sake, stop giving out permanent access. Temporary credentials are your best friend. They’re like the McDonald’s fries of security policies — simple, necessary, and always a good idea.</p><h3>Network Isolation: Not Everything Needs to Talk to Everything</h3><h3>“Your database shouldn’t DM your web app like it’s desperate for attention.”</h3><p>Imagine if everyone in your office could overhear every conversation. Sounds chaotic, right? Well, in your cloud infrastructure, if all your components can chat freely, that’s a nightmare waiting to happen.</p><p><strong>Network segmentation</strong> is your mute button. By separating the web layer, app layer, and database layer into different networks, you’re stopping a bad actor who’s accessed one area from waltzing over to the others. In fact, most of the time, your database doesn’t need to know what the internet is — it just needs to hear from the app.</p><p>And don’t even get me started on public IPs. Why on earth does that sensitive backend service have one? You wouldn’t let someone paint your house neon green if you’re going for a low-profile look, right? Don’t broadcast your internal services on the internet unless you’re dying to feature in the next data breach headline.</p><h3>MFA or GTFO</h3><h3>“The only thing better than a strong password is… no, wait, there isn’t. Just kidding: it’s MFA.”</h3><p>Do you like passwords? Of course you don’t, and neither do attackers. But you know what they hate even more? <strong>Multi-Factor Authentication</strong>. It’s like setting up a bouncer outside the club. You need to show your ID <em>and</em> get past the face-check.</p><p>Here’s a fun fact: 99.9% of compromised accounts could have been saved with MFA. So while passwords are the flimsy door holding back hackers, MFA is the sturdy deadbolt that keeps them from even trying.</p><p><strong>Pro tip</strong>: Use MFA for everything important — admin accounts, production environments, and even your old MySpace account. Why? Because one breach, one password guessed, or one phishing email clicked, and it’s game over. Make them work for it. If they’ve somehow managed to crack one layer, they’ll hate seeing the MFA popup before they can do any real damage.</p><h3>Let’s Talk About Firewalls</h3><h3>“If your infrastructure was a medieval castle, the firewall is the moat filled with crocodiles.”</h3><p>I’ll keep it simple: Firewalls are your first line of defense, like the moat around your infrastructure’s castle. But let’s be real; if your firewall rules look like Swiss cheese (full of holes), don’t expect it to stop anyone.</p><p>Deny everything by default and only allow traffic you <em>absolutely</em> need. “Oh, just allow 0.0.0.0/0 for convenience while I test this thing,” says the future ex-admin.</p><p>No. <strong>Block it.</strong> Then <em>carefully</em> open only the specific ports, addresses, and protocols your app needs. And trust me, that’s not nearly as many as you think. “I can’t SSH from anywhere in the world anymore?!” Good, you shouldn’t.</p><h3>Monitoring, Because You’re Not a Psychic</h3><h3>“Your infrastructure isn’t a teenager; don’t assume it will tell you when something’s wrong.”</h3><p>You’ve put up the defenses, limited the access, and scattered your services into isolated zones. Great! But now what? Are you just going to sit back, assume everything’s working fine, and pop open a cold one? <strong>No</strong>.</p><p>You need <strong>monitoring</strong>. Logs, alerts, dashboards — these are your eyes and ears in the cloud. Because the moment something shady happens, you don’t want to find out a week later when your CFO is asking why half the customer data is missing.</p><p>Tools like <strong>Azure Monitor</strong> or <strong>Log Analytics</strong> are not optional; they are essential. <strong>Alerts</strong> should scream in your face the second something’s wrong, not whisper weeks later when the damage is done. In fact, if your phone isn’t buzzing at 3 AM from some weird login attempt, you’re probably not monitoring hard enough.</p><h3>The Art of Panic Management</h3><h3>“Everything’s on fire? Good news, you’ve limited the blast.”</h3><p>Let’s face it: Incidents happen. But when things explode (figuratively), the goal is to keep that blast contained to a small corner of your infrastructure, not the whole shebang.</p><p>This is where limiting the blast radius is an absolute game-changer. You didn’t let one breached service talk to all your other services. You didn’t give full database access to your public web server (right?). So now, instead of cleaning up a global disaster, you’re dealing with a localized problem. A fire in the corner, not a forest.</p><p><strong>Bonus tip</strong>: Practice this in your chaos engineering drills. Test what happens when certain services fail. If one thing breaks, does the rest of your infra shrug it off, or do you find yourself in full-blown crisis mode?</p><h3>Conclusion: Secure Like You Mean It</h3><p>At the end of the day, limiting your blast radius isn’t just about good design — it’s about survival. If you want your cloud architecture to withstand attacks, outages, or that <em>one</em> developer who accidentally pushes debug code to prod (it happens), you need these principles.</p><p>Remember: slice your infra thin, give access like you’re a paranoid dictator, and make sure every layer is as isolated as your introverted coworker at the office party. Because when stuff hits the fan, you’ll be glad you built with damage control in mind.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c1fcdb7320b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Application Load Balancers: The Brainy Cousins ]]></title>
            <link>https://medium.com/@tahert/application-load-balancers-the-brainy-cousins-88f0425bee29?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/88f0425bee29</guid>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Thu, 09 May 2024 06:34:35 GMT</pubDate>
            <atom:updated>2024-05-09T06:34:35.541Z</atom:updated>
            <content:encoded><![CDATA[<p>Continuing the <a href="https://medium.com/@tahert/the-bouncer-keeping-your-apps-from-the-nerd-rage-24ee46200a56">load balancer saga</a> with a deep dive into Layer 7 Application Load Balancers! 💻⚖️</p><p>When Layer 4 load balancing just wasn’t cutting it anymore, enter the brainy cousins of load balancers — Layer 7 Application Load Balancers. These beauties don’t just shuffle traffic around; they understand it.</p><p>Imagine your old load balancer was a traffic cop with a blindfold, randomly directing cars. Layer 7 balancers? They’re the GPS-equipped traffic orchestrators, steering requests based on actual content, not just IP addresses.</p><p>Lets understand it with an example below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0Fu56sBGJfihFiHJ" /></figure><p>The Application Load Balancer acts like a traffic controller for incoming requests to your application. It listens for HTTP (normal web traffic) and HTTPS (secure web traffic) requests coming in.</p><p>When a request comes in, the Load Balancer looks at the URL path (like /products or /accounts) and routes that request to the correct service behind it. Requests going to /products get sent to Service B. Requests for /accounts go to Service C. Any other requests (like /) get routed to Service A.</p><p>So the Load Balancer’s job is to distribute the incoming traffic across the different services running your application code. This helps balance the load and ensures no one service gets overwhelmed if there is a traffic spike. It makes things run smoothly by spreading requests across multiple services.</p><h3>The Art of Understanding Content 🖋️</h3><p>Layer 7 LBs aren’t impressed by mere traffic volume. They dive deep into HTTP headers, analyze URL paths, and even peek into cookies. It’s like they have x-ray vision for web traffic.</p><p>So when Karen’s cookie preferences clash with Steve’s cache desires, Layer 7 LBs step in, ensuring everyone gets their content without a meltdown.</p><h3>Rules, Policies, and Witty Banter 🎭</h3><p>But wait, there’s more! Layer 7 LBs come armed with rules and policies. Want to route all mobile traffic to the snazzy new mobile site? Done. Need to throttle those API requests that Gary keeps hammering? Consider it done, with a side of witty banter in the error logs.</p><h3>The Cloud’s Love Affair with Layer 7 LBs ☁️❤️</h3><p>Of course, the cloud couldn’t resist these intelligent load balancers. AWS, Azure, and Google Cloud all embraced Layer 7 goodness, weaving it into their fabric like a master tailor.</p><p>With cloud-native solutions, you get the power of Layer 7 without the hefty price tag of hardware boxes. It’s like upgrading from a clunky flip phone to the latest smartphone, but for your website’s traffic management.</p><h3>Future-Proofing with Layer 7 LBs 🚀</h3><p>As we hurtle towards a future of microservices and serverless wonders, Layer 7 LBs are poised to evolve. We’re talking AI-powered traffic routing, real-time content analysis, and load balancing as smooth as butter.</p><p>So here’s to Layer 7 Application Load Balancers, the unsung heroes of web traffic management. They may not wear capes, but they sure know how to keep the internet running smoothly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88f0425bee29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Bouncer Keeping Your Apps From the Nerd Rage.]]></title>
            <link>https://medium.com/@tahert/the-bouncer-keeping-your-apps-from-the-nerd-rage-24ee46200a56?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/24ee46200a56</guid>
            <category><![CDATA[load-balancing]]></category>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Wed, 08 May 2024 06:13:25 GMT</pubDate>
            <atom:updated>2024-05-08T06:13:25.450Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*HzyazrSZOfr1AmYPUlNUXA.jpeg" /></figure><p>In the early days of the world wide web, loading a website was like playing Russian roulette with your patience. You’d click a link and simply pray that you didn’t encounter the feared website equivalent of the Coneheads family — incredibly dense and impossibly slow to load.</p><p>Lack of load balancing was giving overloaded servers performance aneurysms as they struggled with too many user requests. It was like expecting one Starbucks barista to flawlessly serve a entire stadium’s worth of impatient caffeine addicts. Chaos, errors, and sloooooow response times ensued.</p><h3>The Need for Content Traffic Controllers</h3><p>As the internet’s popularity exploded in the late 90s, it became glaringly clear that a single server could only handle so much traffic before metaphorically melting into a plastic heap of despair. The world needed a solution to distribute website requests across multiple servers to prevent overloading any one poor bastard.</p><ul><li>Load balancing to the rescue! By strategically dividing the traffic load, these systems prevented any one server from becoming utterly overwhelmed and imploding.</li><li>The smartest concepts used intelligent algorithms to route requests based on factors like server capacity, current traffic levels, geography, and more.</li></ul><h3>The Birth of Load Balancers</h3><p>While first generation load balancing appliances were a bit rough around the edges, they paved the way for the advanced solutions we use today. Hardware load balancers from “EF 5”, “Ceetreex”, and others became ubiquitous in data centers worldwide to tame the website traffic beast.</p><ul><li>These physical boxes acted as the bouncer deciding which server would take the next request</li><li>They used a varying techniques like basic round robin load distribution or more advanced methods like least connections</li><li>Over time, they evolved to support tons of advanced traffic management capabilities like SSL offloading, caching, compression, and more</li></ul><blockquote><em>Of course, like every technology revolution, the load balancer market had its share of massive egos and delusions of grandeur. These appliance makers liked to boast that their $50,000 proprietary boxes used superior, meticulously engineered algorithms that a mom’s spaghetti code couldn’t replicate. Sure, Karen.</em></blockquote><h3>The Radical Cloud Disruption</h3><p>Just when the load balancer industry was coasting on its phrackers and phrackers (see what I did there?), the cloud came along and flipped the game on its head. The public clouds had different needs, architectures, and philosophies.</p><ul><li>The big cloud titans like AWS, Microsoft and Google realized load balancing was a critical capability to bake into their platforms</li><li>Rather than $50k hardware boxes, they aimed for software-based load balancing that was affordable, auto-scaling and self-healing</li><li>Solutions like AWS’s Elastic Load Balancing evolved into sophisticated fully-managed services</li></ul><h3>How Cloud Load Balancing Works</h3><p>At its core, cloud load balancing uses many of the same proven techniques as traditional appliances, but in a more modern, dynamic way:</p><ul><li>A load balancer control plane (often multi-AZ or multi-region) manages distribution algorithmic smarts</li><li>A pool of load balancer instances route requests to registered backend targets</li><li>Advanced features like health checks, SSL termination, and security policies are all built-in</li></ul><blockquote><em>Of course, cloud load balancing introductions weren’t without its hilarious teenage hiccups. Customers would excitedly fire up load balancers only to smack their foreheads when they realized they hadn’t properly configured routing, security groups, and subnet layouts.</em></blockquote><h3>So What’s Next? The Future of Load Balancing</h3><p>Even today’s sophisticated cloud load balancing offerings are just the foundation. As architectures embrace more distributed models like serverless and service mesh, load balancing will evolve:</p><ul><li>Client-side load balancing and service discovery from tools like Consul and Istio</li><li>Incorporating sharper intelligence about application behavior and performance needs</li><li>Load balancing as code using immutable infrastructure models</li><li>Unified load balancing policies and metrics across hybrid cloud/on-prem deployments</li></ul><p>The endless quest for more perfect traffic load distribution continues. Developers and companies seeking mastery over their scaling, performance, and availability will keep demanding more robust systems. Time for load balancing to level up!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24ee46200a56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Security Explained with an Example.]]></title>
            <link>https://medium.com/@tahert/kubernetes-security-explained-with-an-example-4352c5f3468c?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4352c5f3468c</guid>
            <category><![CDATA[azure-kubernetes-service]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Wed, 15 Mar 2023 09:08:58 GMT</pubDate>
            <atom:updated>2023-03-15T09:08:58.219Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/745/0*hJTFoJsN3BKJpJEl.jpg" /></figure><p>As more and more organizations are moving their workloads to Kubernetes, securing these deployments has become a top priority. In this post, we will discuss some best practices for implementing Kubernetes security, along with a real-world example use case.</p><ol><li>Use Role-Based Access Control (RBAC) to limit permissions and access to the Kubernetes API.</li><li>Apply Security Contexts to individual containers to enforce policies and reduce attack surface.</li><li>Use Network Policies to control traffic between pods and nodes.</li><li>Use Kubernetes Secrets to manage sensitive information like passwords, keys, and certificates.</li><li>Enable Kubernetes Audit Logging to track API server requests and responses.</li><li>Use Pod Security Policies to control the security context of a pod and limit its capabilities.</li><li>Deploy a Service Mesh like Istio to secure traffic between microservices and enforce policies like encryption, rate limiting, and access control.</li><li>Use a Kubernetes Security Scanner like Aqua Security or Twistlock to detect vulnerabilities in images and configurations.</li><li>Implement a Continuous Integration and Continuous Deployment (CI/CD) pipeline to automate security checks and updates.</li><li>Monitor Kubernetes logs and metrics to detect and respond to security incidents.</li></ol><p>Now let’s see an example of how to implement these security best practices in a Kubernetes deployment. Suppose we have a web application that runs on Kubernetes, consisting of several microservices like frontend, backend, and database.</p><p>First, we apply RBAC to limit access to the Kubernetes API. We create a service account with minimal permissions for each microservice, so they can only access the resources they need. For example, the frontend service account can only create and manage pods and services for the frontend deployment.</p><p>Next, we apply Security Contexts to each container. For instance, we set the frontend container to run as a non-root user, with read-only access to the filesystem and no network privileges. This reduces the attack surface and limits the damage in case of a breach.</p><p>Then, we use Network Policies to control traffic between the microservices. We create a policy that allows traffic from the frontend to the backend, but not the other way around. This prevents any unauthorized access to the backend service.</p><p>We also use Kubernetes Secrets to manage sensitive information like database passwords and API keys. We create a secret for each microservice and mount it as a volume in the container.</p><p>To enable audit logging, we set up a logging agent like Fluentd or Logstash to collect and store Kubernetes API server logs. This allows us to track any requests and responses to the API.</p><p>We apply Pod Security Policies to each deployment to enforce security policies. For example, we limit the privileges of the database pod to read-only access to the filesystem and no network access.</p><p>To secure traffic between the microservices, we deploy Istio as a Service Mesh. Istio provides encryption, rate limiting, and access control for microservices.</p><p>We use a Kubernetes Security Scanner like Aqua Security to detect vulnerabilities in the images and configurations. We run this scanner as part of our CI/CD pipeline to ensure that we catch any security issues before they are deployed to production.</p><p>Finally, we monitor Kubernetes logs and metrics using a tool like Prometheus or Grafana. This allows us to detect and respond to any security incidents, such as unauthorized access or unusual activity.</p><p>By implementing these Kubernetes security best practices, we can ensure that our deployment is secure and protected against any potential threats. What other best practices do you use for Kubernetes security? Share in the comments below! #KubernetesSecurity #ContainerSecurity #DevSecOps #ServiceMesh #CyberSecurity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4352c5f3468c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pod identity in AKS allows pods running in a Kubernetes cluster to authenticate to Azure Active…]]></title>
            <link>https://medium.com/@tahert/pod-identity-in-aks-allows-pods-running-in-a-kubernetes-cluster-to-authenticate-to-azure-active-b0c3b997e3da?source=rss-57b7eedd3b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0c3b997e3da</guid>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Taher]]></dc:creator>
            <pubDate>Fri, 13 Jan 2023 18:19:04 GMT</pubDate>
            <atom:updated>2023-01-13T18:19:04.236Z</atom:updated>
            <content:encoded><![CDATA[<h2>Pod identity in AKS allows pods running in a Kubernetes cluster to authenticate to Azure Active Directory (AAD) and access Azure resources securely. Here’s an example of how it works:</h2><p>A pod is deployed in a Kubernetes cluster on AKS.</p><p>The pod is assigned a Kubernetes identity by the admission controller. This identity is a unique identifier that represents the pod’s identity within the cluster.</p><p>The AAD Pod Identity controller then maps the Kubernetes identity to a managed identity in Azure AD. This managed identity represents the pod’s identity outside of the cluster, and can be used to authenticate to Azure services.</p><p>The pod can then use the managed identity to authenticate to Azure services, such as Azure Storage or Azure SQL, without the need for hard-coded credentials.</p><p>For example, let’s say you have a pod running in an AKS cluster that needs to access an Azure Storage account. Instead of providing the pod with the storage account’s access key, you can assign a Kubernetes identity to the pod and map it to a managed identity in Azure AD. Then, you can grant that managed identity access to the storage account, allowing the pod to access it using its assigned identity. This way the pod don’t need to store or manage the credentials.</p><p>This feature is implemented through the use of a Kubernetes admission controller and an AAD Pod Identity controller, which work together to assign and manage identities for pods, and to map those identities to managed identities in Azure AD</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0c3b997e3da" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>