<?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 Dhesi on Medium]]></title>
        <description><![CDATA[Stories by Dhesi on Medium]]></description>
        <link>https://medium.com/@ffdhesi143?source=rss-4353f0021081------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*cwYqqc1dKC71jdAM</url>
            <title>Stories by Dhesi on Medium</title>
            <link>https://medium.com/@ffdhesi143?source=rss-4353f0021081------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 00:26:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ffdhesi143/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[When Ingress Versions Make You Cry Louder Than Your CI/CD Fails]]></title>
            <link>https://medium.com/@ffdhesi143/when-ingress-versions-make-you-cry-louder-than-your-ci-cd-fails-0704be5b5a45?source=rss-4353f0021081------2</link>
            <guid isPermaLink="false">https://medium.com/p/0704be5b5a45</guid>
            <category><![CDATA[ingresscontroller]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[csp]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[ingress]]></category>
            <dc:creator><![CDATA[Dhesi]]></dc:creator>
            <pubDate>Fri, 15 Aug 2025 06:32:33 GMT</pubDate>
            <atom:updated>2025-08-15T06:32:33.074Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes in DevOps, it’s not the code that breaks you — it’s the <em>version differences</em>.<br> This is the story of how upgrading from <strong>NGINX Ingress Controller v1.10</strong> to <strong>v1.12</strong> made me question my career choices…</p><h3><strong>What my problem :</strong></h3><p>custom <strong>CSP (Content Security Policy)</strong> and <strong>CORS</strong> configurations defined via nginx.ingress.kubernetes.io/configuration-snippet annotations failed to take effect. Even if allow-snippet-annotations was enabled.</p><h3>The Beginning — VAPT, 11 Issues, and False Confidence</h3><p>It all started when the client ran a <strong>Vulnerability Assessment and Penetration Test (VAPT)</strong> on our UAT environment. The report came back with <em>11 open issues</em> that needed fixing <strong>ASAP</strong>.</p><p>I looked at it and thought:</p><blockquote><em>“Ah, just some CSP and CORS policy updates? Pfft… I already did this in Dev. This will be easy.”</em></blockquote><p>So, I updated my Ingress YAML, confident everything would go smoothly. Spoiler: it didn’t.</p><h3>The First Punch — Vanishing Ingress</h3><p>A while back, I had tweaked the <strong>ValidatingWebhookConfiguration</strong> for the ingress-controller. To apply those changes, I deleted the <strong>ingress-controller pod</strong>, thinking a new pod would spin up with my new settings.</p><p>It did. But here’s the twist — deleting the ingress-controller pod also meant my <strong>application Ingress configuration vanished</strong>.</p><p>Why?<br> When you create an Ingress, it writes entries to /etc/nginx/nginx.conf inside the ingress-controller pod.<br> Delete the pod → config file is gone → new pod starts fresh → my site throws <strong>404 errors</strong> like candy at a parade.</p><p>After some frantic troubleshooting, I reapplied the Ingress, and the site came back. Crisis averted… or so I thought.</p><h3>The Second Punch — CSP &amp; CORS That Refused to Listen</h3><p>The main point of the update was to fix <strong>CSP (Content Security Policy)</strong> and <strong>CORS</strong> headers.<br> I had something like this in my Ingress:</p><pre>nginx.ingress.kubernetes.io/enable-cors: &quot;false&quot; <br>nginx.ingress.kubernetes.io/configuration-snippet: |<br>  if (some_conditions) {<br>      add_header &#39;Access-Control-Allow-Origin&#39; &quot;$http_origin&quot; always;<br>      add_header &#39;Access-Control-Allow-Methods&#39; &#39;GET, POST, OPTIONS, PUT, DELETE&#39; always;<br>      add_header &#39;Access-Control-Allow-Headers&#39; &#39;Authorization, Content-Type, Accept&#39; always;<br>      add_header &#39;Access-Control-Allow-Credentials&#39; &#39;true&#39; always;<br>  }<br>  add_header Content-Security-Policy &quot;default-src &#39;self&#39;&quot; always;<br>  add_header X-XSS-Protection &quot;1; mode=block&quot; always;<br>  add_header X-Content-Type-Options &quot;nosniff&quot; always;<br>  add_header X-Frame-Options &quot;DENY&quot; always;</pre><p>In Dev (v1.10), it worked perfectly.<br> In UAT (v1.12)… nothing. My custom headers were completely ignored, and the default NGINX config kept taking over.</p><h3>The Hidden Trap — “Annotations Risk Level”</h3><p>After hours of Googling, reading GitHub issues, and talking to ChatGPT, I discovered the real villain:</p><p>Starting in <strong>v1.12</strong>, NGINX Ingress Controller categorizes certain annotations (like configuration-snippet) by <strong>risk level</strong>. This is a security feature to prevent unsafe directives from sneaking into production configs.</p><p>The result?<br> Even with allow-snippet-annotations: &quot;true&quot;, my CSP &amp; CORS config was silently ignored unless I explicitly set:</p><pre>annotations-risk-level: Critical</pre><p>in the <strong>ingress-controller ConfigMap</strong>:</p><pre>apiVersion: v1<br>data:<br>  allow-snippet-annotations: &quot;true&quot;<br>  annotations-risk-level: Critical<br>kind: ConfigMap<br>metadata:<br>  name: ingress-nginx-controller<br>  namespace: ingress-nginx<br>  labels:<br>    app.kubernetes.io/component: controller<br>    app.kubernetes.io/instance: ingress-nginx<br>    app.kubernetes.io/name: ingress-nginx<br>    app.kubernetes.io/version: 1.12.0</pre><h3>The Final Facepalm — Deleting the Pod… Again</h3><p>I updated the ConfigMap, restarted the ingress-controller pod…<br> …and <strong>forgot again</strong> that deleting the pod wipes my Ingress config.</p><p>This time, I caught it within a minute. Because I may be <em>dumb</em>, but I’m not <em>dumber</em>.</p><p>I reapplied the Ingress, refreshed the site, and finally — CSP &amp; CORS headers were working.</p><h3>Lessons Learned</h3><ol><li><strong>Ingress configs are stored inside the pod</strong> — deleting the controller wipes them.</li><li><strong>NGINX Ingress Controller v1.12</strong> enforces annotation risk levels. If you use configuration-snippet, you need annotations-risk-level: Critical.</li></ol><h3>Conclusion</h3><p>What I thought would be a <strong>two-hour fix</strong> turned into a <strong>multi-day debugging saga</strong>.<br> Ingress version differences can be subtle but brutal, and sometimes, the only thing you gain from an upgrade is a headache.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0704be5b5a45" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>