<?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 Dheeman Das on Medium]]></title>
        <description><![CDATA[Stories by Dheeman Das on Medium]]></description>
        <link>https://medium.com/@dheemandas2912?source=rss-40a5c5bf0a8a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TAgTiroM5StiyX1i</url>
            <title>Stories by Dheeman Das on Medium</title>
            <link>https://medium.com/@dheemandas2912?source=rss-40a5c5bf0a8a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:08:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dheemandas2912/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[From NGINX Ingress to Kubernetes Gateway API on AKS: My Real-World Migration Journey]]></title>
            <link>https://dheemandas2912.medium.com/from-nginx-ingress-to-kubernetes-gateway-api-on-aks-my-real-world-migration-journey-c96212418e68?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c96212418e68</guid>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Sun, 29 Nov 2026 19:39:42 GMT</pubDate>
            <atom:updated>2026-11-29T19:39:42.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hJRmHd5j_2BXzWatFqsrMw.png" /></figure><p>Migrating from Kubernetes Ingress to Gateway API sounds straightforward on paper.</p><p>Create a Gateway. Create some HTTPRoutes. Point DNS at the new endpoint. Test the applications. Remove the old Ingress resources.</p><p>In a real environment, it is rarely that simple.</p><p>I recently worked on migrating workloads in a DEV Azure Kubernetes Service (AKS) environment from NGINX Ingress to Kubernetes Gateway API. We started with one UI service, which I’ll call finv2ui, and then expanded the approach across roughly 40 API services.</p><p>The Kubernetes resources themselves were not the hardest part.</p><p>The interesting problems appeared around DNS cutover, shared CNAMEs, HTTPS and SNI, downstream dependencies, application readiness, and making sure we could move traffic back to NGINX quickly if something unexpected happened.</p><p>This article describes how I approached it, what went wrong along the way, and what I learned.</p><blockquote>All organization names, domains, IP addresses, cluster names, certificates, and other environment-specific information have been anonymized.</blockquote><h3>1. Where We Started: Kubernetes Ingress</h3><p>A Kubernetes Service gives applications a stable network endpoint inside a cluster.</p><p>But users outside the cluster still need a way to reach the application.</p><p>Traditionally, Kubernetes has solved HTTP/HTTPS entry into a cluster using an <strong>Ingress</strong> resource together with an <strong>Ingress Controller</strong>.</p><p>A typical architecture looks like this:</p><p>Mermaid diagram</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qEsD-mg8O0fupiuVo5tsRw.png" /></figure><p>An Ingress might look something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*khT_MqYAAt5PPgQvFH0aLQ.png" /></figure><p>The flow is essentially:</p><p>Browser</p><p>↓</p><p>ui.dev.example.com</p><p>↓</p><p>DNS</p><p>↓</p><p>NGINX endpoint</p><p>↓</p><p>Ingress rule</p><p>↓</p><p>finv2ui Service</p><p>↓</p><p>finv2ui Pod</p><p>This model works well and has powered Kubernetes environments for years.</p><p>The problem is that the Ingress API itself is intentionally limited.</p><h3>2. Why Gateway API?</h3><p>Ingress provides a relatively simple model:</p><p>Hostname + Path</p><p>↓</p><p>Backend</p><p>As environments become more complex, teams often need considerably more.</p><p>For example:</p><ul><li>multiple listeners</li><li>HTTP and HTTPS separation</li><li>traffic splitting</li><li>advanced matching</li><li>header-based routing</li><li>cross-namespace routing</li><li>clearer infrastructure/application ownership</li><li>reusable gateways</li><li>extensible routing capabilities</li></ul><p>Historically, Ingress controllers solved many of these requirements using controller-specific annotations.</p><p>That works, but it also means configuration can become tightly coupled to a particular implementation.</p><p>Gateway API takes a different approach.</p><p>Instead of putting most routing responsibility into one resource, it separates the different responsibilities.</p><p>The important resources for our migration were:</p><p>Gateway</p><p>HTTPRoute</p><p>Service</p><p>Pod</p><p>And the resulting architecture became:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujF7bd5zZ8JlnkDOuR16rA.png" /></figure><p>That separation may look like an extra layer at first.</p><p>In practice, it makes the routing model much clearer.</p><h3>3. Gateway API vs. Ingress</h3><p>The simplest way I explain the difference is:</p><p><strong>Ingress says where HTTP traffic should go. Gateway API creates a broader model of how traffic enters the platform and how that traffic should be routed.</strong></p><p>A simplified comparison:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z9ZOxnSLXPWyL2VYXwmvrQ.png" /></figure><p>One of the biggest benefits for me was the separation between <strong>traffic entry</strong> and <strong>application routing</strong>.</p><p>A Gateway can define listeners such as:</p><p>:80 → HTTP</p><p>:443 → HTTPS</p><p>Applications then attach HTTPRoutes to those listeners.</p><p>So instead of every application effectively describing the whole entry model, we can have something conceptually like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*mHAyGOJpHV0Wfqq03us7rw.png" /></figure><h3>4. Our Target Architecture</h3><p>For a simplified application such as finv2ui, I wanted the final traffic path to be:</p><p>Client</p><p>↓</p><p>DNS</p><p>↓</p><p>Gateway endpoint</p><p>↓</p><p>Gateway HTTPS listener</p><p>↓</p><p>finv2ui HTTPRoute</p><p>↓</p><p>finv2ui Service</p><p>↓</p><p>finv2ui Pod</p><p>Or visually:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*7dsnqlnj1tWQPm9F8naoXw.png" /></figure><p>An important point here is that <strong>Gateway API does not replace Kubernetes Services</strong>.</p><p>The Service remains the stable Kubernetes abstraction in front of the workload.</p><p>Gateway API changes how external traffic reaches that Service.</p><h3>5. I Deliberately Avoided a Big-Bang Migration</h3><p>One of the most important decisions was not technical.</p><p>It was migration strategy.</p><p>We had many services to move. Instead of creating everything and switching the entire DEV environment at once, I treated the migration as a series of small cutovers.</p><p>The sequence was roughly:</p><p>Understand existing traffic</p><p>↓</p><p>Create Gateway</p><p>↓</p><p>Create HTTPRoutes</p><p>↓</p><p>Validate route configuration</p><p>↓</p><p>Test application directly</p><p>↓</p><p>Test HTTP/HTTPS</p><p>↓</p><p>Move DNS</p><p>↓</p><p>Validate application</p><p>↓</p><p>Observe downstream dependencies</p><p>↓</p><p>Continue with next service</p><p>finv2ui was useful as an end-to-end POC because a UI application exposed more than basic routing.</p><p>It forced us to think about what the application itself called after the initial page loaded.</p><p>Once the approach worked, the same model could be applied across the API services.</p><h3>6. Step 1: Understand the Existing Ingress</h3><p>Before creating Gateway API resources, I first needed to understand what NGINX was currently doing.</p><p>For each application, that meant identifying:</p><p>Hostname</p><p>Ingress</p><p>Service</p><p>Service port</p><p>Pod</p><p>TLS configuration</p><p>DNS record</p><p>Dependencies</p><p>Useful commands included:</p><p>kubectl get ingress -A</p><p>kubectl describe ingress &lt;ingress-name&gt; -n &lt;namespace&gt;</p><p>kubectl get svc &lt;service-name&gt; -n &lt;namespace&gt;</p><p>kubectl get endpoints &lt;service-name&gt; -n &lt;namespace&gt;</p><p>This sounds basic, but it prevents a very common migration mistake:</p><blockquote><em>Recreating what the YAML appears to say instead of understanding how traffic actually reaches the application.</em></blockquote><h3>7. Step 2: Create the Gateway</h3><p>The Gateway became the entry point for Gateway API traffic.</p><p>Conceptually:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*yVudPI5iLHU3flTUJz-vyg.png" /></figure><p>The exact configuration depends on the Gateway implementation and how TLS is managed.</p><p>The important concept is:</p><p>Gateway = network entry point</p><p>HTTPRoute = application routing rule</p><p>That distinction becomes extremely useful when multiple applications share the same Gateway.</p><h3>8. Step 3: Create an HTTPRoute for Each Application</h3><p>For finv2ui, the simplified routing model looked like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*8bPTeQfJrUqqw-vapfhG9w.png" /></figure><p>The important relationship is:</p><p>HTTPRoute</p><p>│</p><p>├── attaches to → Gateway</p><p>│</p><p>└── sends traffic to → Service</p><p>And the Service selects the Pods:</p><p>Service</p><p>↓</p><p>selector</p><p>↓</p><p>Pods</p><p>Gateway API therefore sits naturally in the existing Kubernetes networking model.</p><h3>9. Step 4: Validate the Route Before Changing DNS</h3><p>This became one of my most important rules:</p><blockquote><strong><em>A deployed HTTPRoute does not automatically mean a working HTTPRoute.</em></strong></blockquote><p>I checked the route status first:</p><p>kubectl get httproute -A</p><p>kubectl describe httproute &lt;route-name&gt; -n &lt;namespace&gt;</p><p>The two conditions I paid particular attention to were:</p><p>Accepted=True</p><p>ResolvedRefs=True</p><h3>Accepted=True</h3><p>This tells me the route was accepted by its parent Gateway.</p><p>In plain English:</p><blockquote><em>“The Gateway recognizes this route.”</em></blockquote><h3>ResolvedRefs=True</h3><p>This tells me references such as the backend Service were resolved successfully.</p><p>In plain English:</p><blockquote><em>“The route can find the resources it is supposed to send traffic to.”</em></blockquote><p>For multiple services, checking these conditions in bulk became an important part of migration validation.</p><h3>10. But Accepted=True Is Not the Same as Application Healthy</h3><p>This is worth emphasizing.</p><p>A route can show:</p><p>Accepted=True</p><p>ResolvedRefs=True</p><p>and the application can still fail.</p><p>Those conditions validate the Gateway API configuration.</p><p>They do not prove:</p><ul><li>DNS is correct</li><li>TLS negotiation works</li><li>the Pod is healthy</li><li>the application returns HTTP 200</li><li>the application can reach its dependencies</li><li>authentication works</li><li>downstream APIs are available</li></ul><p>So I treated route validation as only one layer of the test.</p><h3>11. Step 5: Validate the Workload</h3><p>Next came the normal Kubernetes checks.</p><p>kubectl get pods -n &lt;namespace&gt;</p><p>kubectl get svc -n &lt;namespace&gt;</p><p>kubectl get endpoints &lt;service-name&gt; -n &lt;namespace&gt;</p><p>For the application readiness endpoint, the test was conceptually:</p><p>curl -k <a href="https://api.dev.example.com/health/ready">https://api.dev.example.com/health/ready</a></p><p>I expected something equivalent to:</p><p>HTTP/1.1 200 OK</p><p>For dozens of services, doing this manually would be error-prone, so I automated readiness testing.</p><p>That gave me a much clearer picture:</p><p>service-a 200</p><p>service-b 200</p><p>service-c 200</p><p>service-d FAILED</p><p>Now I could focus troubleshooting only on the failures.</p><h3>12. Step 6: Verify DNS Separately</h3><p>DNS became one of the most important parts of the migration.</p><p>For example:</p><p>Resolve-DnsName api.dev.example.com</p><p>OR</p><p>nslookup api.dev.example.com</p><p>The desired flow after migration was:<br>api.dev.example.com</p><p>↓</p><p>DNS</p><p>↓</p><p>Gateway endpoint</p><p>But we discovered something that changed how I approached the cutover.</p><p>Some application hostnames did not have completely independent DNS records.</p><p>They used aliases.</p><p>For example:</p><p>ui.dev.example.com</p><p>↓</p><p>CNAME</p><p>↓</p><p>shared-dev.example.net</p><p>↓</p><p>A record</p><p>↓</p><p>NGINX endpoint</p><p>That is very different from:</p><p>ui.dev.example.com</p><p>↓</p><p>Gateway endpoint</p><p>because changing:</p><p>shared-dev.example.net</p><p>could potentially affect <strong>every application pointing to the same shared name</strong>.</p><h3>13. DNS Became Part of the Migration Design</h3><p>Instead of treating DNS as simply the final step, I started treating it as a separate dependency graph.</p><p>Plain Text</p><p>Application</p><p>↓</p><p>Hostname</p><p>↓</p><p>CNAME</p><p>↓</p><p>Canonical hostname</p><p>↓</p><p>A record</p><p>↓</p><p>Gateway endpoint</p><p>Before changing a record, I wanted to know:</p><p>Plain Text</p><p>What points to this hostname?</p><p>What else shares this target?</p><p>What will move if I change it?</p><p>This prevented us from blindly changing shared DNS records.</p><p>For Gateway API, the final desired relationship was:</p><p>Plain Text</p><p>Application hostname</p><p>↓</p><p>DNS</p><p>↓</p><p>Gateway endpoint</p><p>with the blast radius clearly understood before making the change.</p><h3>14. Step 7: Test HTTP and HTTPS Separately</h3><p>Another valuable lesson was not to treat:</p><p>HTTP works</p><p>as equivalent to:</p><p>Plain Text</p><p>the application works</p><p>I tested both protocols independently.</p><p>For example:</p><p>Shell</p><p>curl -I <a href="http://api.dev.example.com/">http://api.dev.example.com</a></p><p>Then:</p><p>Shell</p><p>curl -vk <a href="https://api.dev.example.com/">https://api.dev.example.com</a></p><p>This allowed me to distinguish:</p><p>Plain Text</p><p>DNS problem</p><p>Routing problem</p><p>TLS problem</p><p>Application problem</p><p>instead of treating every failure as “Gateway API is broken.”</p><h3>15. The Most Interesting Problem: The Route Could Be Healthy While the Application Wasn’t</h3><p>One of the more useful engineering lessons came from finv2ui.</p><p>At one stage, the Kubernetes pieces looked healthy.</p><p>We could have:</p><p>Plain Text</p><p>Gateway → Healthy</p><p>HTTPRoute → Accepted=True</p><p>ResolvedRefs → True</p><p>Service → Present</p><p>Endpoint → Present</p><p>Pod → Running</p><p>That looks great.</p><p>But there was another layer.</p><p>finv2ui depended on other API endpoints.</p><p>So the real application architecture was closer to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6u5GBV5b6VmmRkf4_oKukA.png" /></figure><p>The UI could be reachable while a downstream call still failed.</p><p>That changed how I thought about migration validation.</p><h3>16. Kubernetes Health Is Not the Same as Application Health</h3><p>A Pod can report:</p><p>Plain Text</p><p>Running</p><p>and the application can still be unusable.</p><p>Likewise, an HTTPRoute can report:</p><p>Plain Text</p><p>Accepted=True</p><p>ResolvedRefs=True</p><p>while the end-to-end user experience is broken.</p><p>So my final validation model became:</p><p>Plain Text</p><p>DNS</p><p>↓</p><p>TLS/SNI</p><p>↓</p><p>Gateway Listener</p><p>↓</p><p>HTTPRoute</p><p>↓</p><p>Service</p><p>↓</p><p>Endpoint</p><p>↓</p><p>Pod</p><p>↓</p><p>Readiness</p><p>↓</p><p>Application</p><p>↓</p><p>Downstream dependencies</p><p>Every layer answers a different question.</p><h3>17. How I Troubleshot Issues During the Migration</h3><p>Instead of jumping randomly between Kubernetes objects, I started following the request from the outside in.</p><h3>1. Check DNS</h3><p>On Windows:</p><p>PowerShell</p><p>Resolve-DnsName app.dev.example.com</p><p>or:</p><p>PowerShell</p><p>nslookup app.dev.example.com</p><p>First question:</p><blockquote><em>Is the hostname resolving where I expect?</em></blockquote><h3>2. Check HTTP</h3><p>Shell</p><p>curl -v <a href="http://app.dev.example.com/">http://app.dev.example.com</a></p><h3>3. Check HTTPS</h3><p>Shell</p><p>curl -vk <a href="https://app.dev.example.com/">https://app.dev.example.com</a></p><p>Here I looked at:</p><p>Plain Text</p><p>TLS handshake</p><p>Certificate</p><p>Hostname</p><p>HTTP status</p><p>Response</p><h3>4. Check the Gateway</h3><p>Shell</p><p>kubectl describe gateway &lt;gateway-name&gt;</p><p>I verified that the relevant listeners were healthy.</p><h3>5. Check HTTPRoute</h3><p>Shell</p><p>kubectl describe httproute &lt;route-name&gt;</p><p>Specifically:</p><p>Plain Text</p><p>Accepted=True</p><p>ResolvedRefs=True</p><h3>6. Check the Service</h3><p>Shell</p><p>kubectl get svc &lt;service-name&gt; -n &lt;namespace&gt;</p><h3>7. Check endpoints</h3><p>Shell</p><p>kubectl get endpoints &lt;service-name&gt; -n &lt;namespace&gt;</p><h3>8. Check Pods</h3><p>Shell</p><p>kubectl get pods -n &lt;namespace&gt;</p><h3>9. Check application logs</h3><p>Shell</p><p>kubectl logs &lt;pod-name&gt; -n &lt;namespace&gt;</p><h3>10. Check readiness</h3><p>Shell</p><p>curl -k <a href="https://app.dev.example.com/health/ready">https://app.dev.example.com/health/ready</a></p><h3>11. Check downstream dependencies</h3><p>Finally, I asked:</p><blockquote><em>Which other services does this application call?</em></blockquote><p>That last question explained some problems that Kubernetes networking checks alone could never answer.</p><h3>18. My Troubleshooting Mental Model</h3><p>By the end of the project, I started thinking about routing problems as layers:</p><p>Layer 1 DNS</p><p>Layer 2 Network connectivity</p><p>Layer 3 TLS/SNI</p><p>Layer 4 Gateway</p><p>Layer 5 HTTPRoute</p><p>Layer 6 Kubernetes Service</p><p>Layer 7 Endpoint</p><p>Layer 8 Pod</p><p>Layer 9 Application</p><p>Layer 10 Downstream dependencies</p><p>Then I looked for the <strong>first failing layer</strong>.</p><p>For example:</p><p>Plain Text</p><p>DNS PASS</p><p>TLS PASS</p><p>Gateway PASS</p><p>Accepted TRUE</p><p>ResolvedRefs TRUE</p><p>Service PASS</p><p>Endpoints PASS</p><p>Readiness FAIL</p><p>Now I know not to start debugging the Gateway configuration.</p><p>The problem is further downstream.</p><p>This sounds obvious when written down, but following this approach saved a lot of time during the actual migration.</p><h3>19. Expanding From finv2ui to the API Services</h3><p>Once the end-to-end path was proven with finv2ui, I expanded the migration across the API services.</p><p>I still didn’t want a blind big-bang cutover.</p><p>Instead, the process was repeatable:</p><p>Plain Text</p><p>Create HTTPRoutes</p><p>↓</p><p>Validate route conditions</p><p>↓</p><p>Validate Services/endpoints</p><p>↓</p><p>Validate DNS</p><p>↓</p><p>Test HTTP/HTTPS</p><p>↓</p><p>Test /health/ready</p><p>↓</p><p>Validate dependencies</p><p>↓</p><p>Move next workloads</p><p>Across roughly 40 API services, manual checking quickly becomes inefficient.</p><p>So bulk validation became increasingly important.</p><h3>20. Automating Validation Across Many Services</h3><p>For every application, I essentially needed to answer the same questions:</p><p>Plain Text</p><p>Does the route exist?</p><p>Is Accepted=True?</p><p>Is ResolvedRefs=True?</p><p>Does DNS resolve correctly?</p><p>Does HTTPS work?</p><p>Does /health/ready return 200?</p><p>That lends itself naturally to automation.</p><p>Conceptually, I wanted output such as:</p><p>Plain Text</p><p>SERVICE ROUTE DNS HTTPS READY</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>api-a PASS PASS PASS 200</p><p>api-b PASS PASS PASS 200</p><p>api-c PASS PASS PASS 200</p><p>api-d PASS PASS PASS 200</p><p>This gave me much more confidence than simply seeing:</p><p>Plain Text</p><p>Deployment succeeded</p><p>Because successful deployment only proves that Kubernetes accepted the resources.</p><p>It doesn’t prove that users can reach the application.</p><h3>21. When Did I Consider a Service Successfully Migrated?</h3><p>For me, creating an HTTPRoute was <strong>not</strong> the definition of success.</p><p>A service was migrated only after the whole path had been validated:</p><p>Plain Text</p><p>Gateway healthy</p><p>+</p><p>HTTPRoute Accepted=True</p><p>+</p><p>ResolvedRefs=True</p><p>+</p><p>Service/endpoints healthy</p><p>+</p><p>DNS correct</p><p>+</p><p>HTTP/HTTPS correct</p><p>+</p><p>TLS correct</p><p>+</p><p>Readiness = 200</p><p>+</p><p>Application behavior correct</p><p>For applications with dependencies, I added:</p><p>Plain Text</p><p>Downstream communication verified</p><p>Only then did I consider the migration complete.</p><h3>22. Making Gateway API the Permanent Architecture</h3><p>Once the workloads had been successfully migrated and validated, Gateway API became the permanent routing model.</p><p>The final architecture was:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujF7bd5zZ8JlnkDOuR16rA.png" /></figure><p>For HTTPS:</p><p>Plain Text</p><p>Client</p><p>↓</p><p>DNS</p><p>↓</p><p>Gateway :443</p><p>↓</p><p>TLS / SNI</p><p>↓</p><p>HTTPS Listener</p><p>↓</p><p>HTTPRoute</p><p>↓</p><p>Service</p><p>↓</p><p>Pod</p><p>At that stage, NGINX was no longer part of the application’s traffic path.</p><p>That distinction mattered to me.</p><p>I didn’t want to describe the work as:</p><blockquote><em>“We tested Gateway API.”</em></blockquote><p>The goal was:</p><blockquote><strong><em>Migrate the application routing architecture from NGINX Ingress to Gateway API and make Gateway API the final traffic path.</em></strong></blockquote><h3>23. Migration Checklist</h3><p>Here is the practical checklist I took away from the project.</p><h3>Discovery</h3><ul><li>Identify all Ingress resources</li><li>Identify application hostnames</li><li>Map Ingress → Service</li><li>Identify Service ports</li><li>Identify TLS requirements</li><li>Identify DNS records</li><li>Map CNAME dependencies</li><li>Identify shared DNS targets</li><li>Identify application dependencies</li><li>Identify readiness endpoints</li></ul><h3>Gateway API</h3><ul><li>Gateway created</li><li>Gateway status healthy</li><li>HTTP listener configured</li><li>HTTPS listener configured</li><li>TLS configuration verified</li><li>HTTPRoutes created</li><li>Correct Gateway referenced</li><li>Correct backend Services referenced</li></ul><h3>Kubernetes validation</h3><ul><li>Accepted=True</li><li>ResolvedRefs=True</li><li>Service exists</li><li>Service port correct</li><li>Endpoints exist</li><li>Pods are Ready</li></ul><h3>DNS</h3><ul><li>Hostname resolves correctly</li><li>CNAME chain understood</li><li>Shared DNS targets identified</li><li>DNS points toward Gateway architecture</li></ul><h3>HTTP/HTTPS</h3><ul><li>HTTP behavior verified</li><li>HTTPS behavior verified</li><li>TLS handshake successful</li><li>Certificate valid for hostname</li><li>SNI behavior correct</li></ul><h3>Application</h3><ul><li>/health/ready returns 200</li><li>UI works</li><li>API requests work</li><li>Authentication works where applicable</li><li>Downstream dependencies work</li><li>Application logs show no migration-related failures</li></ul><h3>Finalization</h3><ul><li>All migrated applications use Gateway API</li><li>Gateway API is the final traffic path</li><li>Old Ingress resources removed where no longer required</li><li>DNS configuration cleaned up</li><li>Temporary migration configuration removed</li><li>Monitoring updated</li><li>Migration documentation updated</li></ul><h3>24. Lessons I Learned</h3><h3>Lesson 1: This is not just a Kubernetes migration</h3><p>My biggest takeaway was that migrating from Ingress to Gateway API involves much more than:</p><p>Plain Text</p><p>Ingress YAML → HTTPRoute YAML</p><p>The real migration involves:</p><p>Plain Text</p><p>DNS</p><p>TLS</p><p>Certificates</p><p>Gateway</p><p>Routes</p><p>Services</p><p>Pods</p><p>Applications</p><p>Dependencies</p><p>All of those layers need to agree.</p><h3>Lesson 2: Understand DNS before touching DNS</h3><p>The most dangerous DNS assumption is:</p><blockquote><em>“I’m changing the DNS for one application.”</em></blockquote><p>That may not actually be true.</p><p>If the application uses:</p><p>Plain Text</p><p>Application hostname</p><p>↓</p><p>CNAME</p><p>↓</p><p>Shared hostname</p><p>changing the shared target may affect multiple applications.</p><p>Always map the DNS chain first.</p><h3>Lesson 3: Accepted=True is not the finish line</h3><p>Seeing:</p><p>Plain Text</p><p>Accepted=True</p><p>ResolvedRefs=True</p><p>is important.</p><p>But it only tells us that the Gateway API configuration is in a good state.</p><p>I still need:</p><p>Plain Text</p><p>DNS ✓</p><p>TLS ✓</p><p>HTTP ✓</p><p>HTTPS ✓</p><p>Readiness ✓</p><p>Application ✓</p><p>Dependencies ✓</p><h3>Lesson 4: Test the user path, not just the Pod</h3><p>This was particularly important with finv2ui.</p><p>A Pod being:</p><p>Plain Text</p><p>Running</p><p>did not prove that:</p><p>Plain Text</p><p>Browser → UI → APIs</p><p>worked successfully.</p><p>Infrastructure health and user-facing application health are related, but they are not identical.</p><h3>Lesson 5: TLS problems can look like routing problems</h3><p>A request failing on HTTPS does not necessarily mean HTTPRoute is incorrect.</p><p>It could be:</p><p>Plain Text</p><p>DNS</p><p>Certificate</p><p>SNI</p><p>Gateway listener</p><p>Hostname</p><p>TLS configuration</p><p>Debug HTTPS as its own layer.</p><h3>Lesson 6: Small migrations are easier to understand</h3><p>Using one workload as an end-to-end POC gave me a much clearer understanding of the architecture before expanding across many services.</p><p>My preferred model is:</p><p>Plain Text</p><p>One workload</p><p>↓</p><p>Understand</p><p>↓</p><p>Validate</p><p>↓</p><p>Automate</p><p>↓</p><p>Expand</p><p>rather than:</p><p>Plain Text</p><p>Migrate everything</p><p>↓</p><p>Troubleshoot everything</p><h3>Lesson 7: Automate validation as early as possible</h3><p>With one application, manual commands are manageable.</p><p>With 40 applications, they become a liability.</p><p>Checks like:</p><p>Plain Text</p><p>Accepted</p><p>ResolvedRefs</p><p>DNS</p><p>HTTPS</p><p>Readiness</p><p>should be automated.</p><p>Ideally, a migration pipeline should eventually produce something like:</p><p>Plain Text</p><p>40 services checked</p><p>HTTPRoutes accepted: 40/40</p><p>Backend references valid: 40/40</p><p>DNS validated: 40/40</p><p>HTTPS validated: 40/40</p><p>Readiness HTTP 200: 40/40</p><p>That is the type of signal I want before declaring an infrastructure migration successful.</p><h3>25. Was Gateway API Worth the Migration?</h3><p>For me, yes.</p><p>Not because NGINX Ingress suddenly became a bad technology.</p><p>It served its purpose well.</p><p>What I gained from Gateway API was a cleaner, more expressive routing architecture.</p><p>Instead of thinking primarily in terms of individual Ingress objects, I now have the model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*mZKLkdcQI51KVt3OAVckWQ.png" /></figure><p>The separation between the shared network entry point and application-specific routing becomes particularly valuable as the number of services grows.</p><h3>Conclusion</h3><p>When I started this migration, I thought the main challenge would be converting Kubernetes Ingress configuration into Gateway API resources.</p><p>It wasn’t.</p><p>The Kubernetes YAML was only one part of the story.</p><p>The real challenge was understanding the complete request:</p><p>Client</p><p>↓</p><p>DNS</p><p>↓</p><p>TLS / SNI</p><p>↓</p><p>Gateway</p><p>↓</p><p>HTTPRoute</p><p>↓</p><p>Service</p><p>↓</p><p>Pod</p><p>↓</p><p>Application</p><p>↓</p><p>Dependencies</p><p>That understanding changed how I approached the migration.</p><p>I started with finv2ui as an end-to-end POC, validated the Gateway and HTTPRoute behavior, worked through DNS and HTTPS/TLS issues, understood the downstream application dependencies, and then expanded the approach across the API services.</p><p>The migration was deliberately progressive rather than a single big-bang change.</p><p>And after completing the application and infrastructure validation, <strong>Gateway API became the permanent routing architecture for the migrated workloads.</strong></p><p>Before:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DdGJsy5pW9IBAl9DMSlMwA.png" /></figure><p>After:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NkbEX7ozOZd8EmoGFoF7Yg.png" /></figure><p>The architecture diagram looks simple.</p><p>Getting there safely required understanding much more than those six boxes.</p><p>If I had to summarize the whole migration in one line, it would be:</p><blockquote><strong><em>Don’t migrate YAML. Migrate the traffic path, validate every layer, and automate the evidence that proves the migration actually works.</em></strong></blockquote><p>That was the difference between simply deploying Gateway API and <strong>actually migrating to it</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c96212418e68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Azure DevOps Agents on Kubernetes with KEDA and Docker-in-Docker]]></title>
            <link>https://dheemandas2912.medium.com/running-azure-devops-agents-on-kubernetes-with-keda-and-docker-in-docker-7e359e605b5d?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e359e605b5d</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Sun, 24 May 2026 06:08:47 GMT</pubDate>
            <atom:updated>2026-05-24T06:17:23.469Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Introduction:</em></strong><br><em>With Kubernetes 1.30 coming to AKS, the KEDA add-on is getting updated to version 2.14, which adds support for Workload Identity on the TriggerAuthentication object.</em></p><p><em>This article demonstrates how to deploy Azure DevOps self-hosted agents on an AKS cluster running Kubernetes version 1.30 or later, using the KEDA and Workload Identity add-ons for AKS.</em></p><p><em>In this setup, KEDA automatically scales Azure DevOps agent pods based on the pending jobs in the Azure DevOps agent pool. Workload Identity is used to authenticate securely without storing credentials directly inside Kubernetes secrets.</em></p><p><em>The implementation also uses a Docker-in-Docker sidecar container, which allows the Azure DevOps agent running inside Kubernetes to execute Docker commands such as building, tagging, and pushing container images. The agent container connects to the DinD container through the Docker daemon exposed inside the same pod.</em></p><p><em>The schema below shows the key components of the configuration:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/0*eXK_ebqYtfuPyc2R.png" /></figure><p><strong><em>Prerequisites:Azure / AKS</em></strong></p><p><em>| Requirement | Details |</em></p><p><em>| AKS cluster (Kubernetes 1.28+) | Required for native sidecar containers |</em></p><p><em>| KEDA installed on cluster | See installation section below |</em></p><p><em>| Azure Workload Identity configured | Service account `&lt;your-service-account&gt;` with federated credentials |</em></p><p><em>| ACR (Azure Container Registry) | To store the agent image |</em></p><p><em>| Node pool with sufficient resources | Each pod needs ~1 CPU + 2Gi memory |</em></p><p><strong><em>Architecture:</em></strong></p><p><em>┌──────────────────────────────────────────────────────────┐</em></p><p><em>│ AKS Cluster │</em></p><p><em>│ │</em></p><p><em>│ ┌─────────────── Pod (per job) ──────────────────────┐ │</em></p><p><em>│ │ │ │</em></p><p><em>│ │ ┌─────────────┐ ┌──────────────────────┐ │ │</em></p><p><em>│ │ │ ado-agent │──────▶│ dind (native sidecar)│ │ │</em></p><p><em>│ │ │ (main) │ tcp://│ Docker daemon │ │ │</em></p><p><em>│ │ │ │ :2375 │ privileged: true │ │ │</em></p><p><em>│ │ └─────────────┘ └──────────────────────┘ │ │</em></p><p><em>│ │ │ │ │ │</em></p><p><em>│ │ └────── emptyDir ────────┘ │ │</em></p><p><em>│ │ /var/lib/docker │ │</em></p><p><em>│ └────────────────────────────────────────────────────┘ │</em></p><p><em>│ │</em></p><p><em>│ ┌──────────────┐ ┌────────────────────────────┐ │</em></p><p><em>│ │ KEDA │───▶│ Azure DevOps Pool Queue │ │</em></p><p><em>│ │ (polls ADO) │ │ via Workload Identity │ │</em></p><p><em>│ └──────────────┘ └────────────────────────────┘ │</em></p><p><em>└──────────────────────────────────────────────────────────┘</em></p><p><strong><em>How It Works:</em></strong></p><p><em>1. A pipeline job is queued in Azure DevOps</em></p><p><em>2. KEDA polls the ADO agent pool queue every 5 seconds</em></p><p><em>3. KEDA spins up a pod (agent + DinD sidecar) for each pending job</em></p><p><em>4. The agent registers with ADO, picks up the job, runs it, deregisters, and exits</em></p><p><em>5. The DinD sidecar is automatically terminated (native sidecar pattern)</em></p><p><em>6. Pod completes cleanly → KEDA frees the slot → next queued job gets a new pod</em></p><p><em>7. No jobs in queue → zero pods running (no wasted resources)</em></p><p><strong><em>Repo Structure:</em></strong></p><p><em>├── Dockerfile # Agent container image (Ubuntu 24.04 + all tooling)</em></p><p><em>├── start.sh # Agent entrypoint — authenticates via Workload Identity,</em></p><p><em>│ # registers with ADO, runs one job, deregisters</em></p><p><em>├── keda-scaled-jobs.yaml # KEDA ScaledJob manifest — auto-scaling config</em></p><p><em>├── placeholder.yaml # Placeholder agent job — keeps the ADO pool alive</em></p><p><em>├── trigger-auth.yaml # KEDA TriggerAuthentication — Workload Identity for KEDA</em></p><p><em>├── deployment.yaml # (smoke-test only) Always-on single agent pod</em></p><p><em>├── certs/ #certificates (baked into the image)</em></p><p><em>├── pipelines/</em></p><p><em>│ └── adoagent-azure-pipelines.yml # Bootstrap pipeline — builds image + deploys YAMLs</em></p><p><em>└── script/</em></p><p><em>└── start.sh # Reference/test scripts</em></p><p><strong><em>Azure DevOps:</em></strong></p><p><em>| What | Where to create |</em></p><p><em>| Agent Pool (e.g. `aks-poc-pool`) | ADO → Organization Settings → Agent Pools |</em></p><p><em>| Service Connection to ACR | ADO → Project Settings → Service Connections |</em></p><p><em>| Service Connection to Azure subscription | ADO → Project Settings → Service Connections |</em></p><p><strong><em>KEDA Installation:</em></strong></p><p><em>helm repo add kedacore </em><a href="https://kedacore.github.io/charts"><em>https://kedacore.github.io/charts</em></a></p><p><em>helm repo update</em></p><p><em>helm install keda kedacore/keda — namespace keda — create-namespace</em></p><p><strong><em>## File Descriptions</em></strong></p><p><strong><em>### `Dockerfile`</em></strong></p><p><em>Ubuntu 24.04-based agent image with the following tools pre-installed:</em></p><p><em>| Tool | Version source |</em></p><p><em>| — -| — -|</em></p><p><em>| Git | Official PPA (latest) |</em></p><p><em>| Docker CLI + Buildx + Compose | Docker official repo |</em></p><p><em>| Python | 3.14 (deadsnakes PPA) |</em></p><p><em>| Node.js + npm | 22.x (NodeSource) |</em></p><p><em>| Azure CLI + azure-devops extension | Microsoft official |</em></p><p><em>| .NET SDK + Runtime | 10.0 (Microsoft repo) |</em></p><p><em>| Terraform | Latest (HashiCorp repo) |</em></p><p><em>| PowerShell Core | Microsoft repo |</em></p><p><em>| kubectl | Latest stable |</em></p><p><em>| Helm | Official repo |</em></p><p><em>| Others | curl, jq, openssl, dnsutils, unzip, zip, wget |</em></p><p><em>The image runs as non-root user `agent`. All tool installations happen as root before `USER agent`.</em></p><p><strong><em>### `start.sh`</em></strong></p><p><em>Agent entrypoint script:</em></p><p><em>1. Authenticates to Azure using </em><strong><em>**Workload Identity**</em></strong><em> (federated token)</em></p><p><em>2. Obtains an ADO access token via `az account get-access-token`</em></p><p><em>3. Downloads the latest ADO agent binaries</em></p><p><em>4. Configures and registers the agent with the pool</em></p><p><em>5. Runs the agent with ` — once` flag (processes one job, then exits)</em></p><p><em>6. On exit, deregisters the agent from the pool (cleanup trap)</em></p><p><strong><em>**Important:**</em></strong><em> This file </em><strong><em>**must have LF line endings**</em></strong><em> (not CRLF). On Windows:</em></p><p><em>git config core.autocrlf input</em></p><p><strong><em>### `keda-scaled-jobs.yaml`</em></strong></p><p><em>KEDA ScaledJob configuration:</em></p><p><em>```yaml</em></p><p><em>Key settings:</em></p><p><em>parallelism: 1 # One agent per pod</em></p><p><em>shareProcessNamespace: true # Required for native sidecar termination</em></p><p><em>pollingInterval: 5 # Check ADO queue every 5 seconds</em></p><p><em>maxReplicaCount: 10 # Max simultaneous pods (adjust based on cluster capacity)</em></p><p><em>```</em></p><p><strong><em>**DinD as native sidecar:**</em></strong><em> The `dind` container is defined under `initContainers` with `restartPolicy: Always`. This is the Kubernetes 1.28+ native sidecar pattern — when the main container (`ado-agent`) exits, Kubernetes automatically terminates the sidecar. This ensures pods complete cleanly and KEDA can recycle slots.</em></p><p><strong><em>**Docker connectivity:**</em></strong><em> The agent uses `DOCKER_HOST=tcp://localhost:2375` to communicate with the DinD sidecar (unencrypted, pod-internal only).</em></p><p><strong><em>**MTU setting:**</em></strong><em> ` — default-network-opt=bridge=com.docker.network.driver.mtu=1400` prevents packet fragmentation in Azure overlay networks.</em></p><p><strong><em>### `placeholder.yaml`</em></strong></p><p><em>A one-shot Kubernetes Job that registers a permanent </em><strong><em>**offline placeholder agent**</em></strong><em> in the ADO pool. This is required because:</em></p><p><em>- An empty ADO pool cannot receive job requests</em></p><p><em>- KEDA needs at least one agent registered to route jobs</em></p><p><em>- The placeholder registers once and stays offline — it never runs jobs</em></p><p><em>Deploy it once, and it stays in the pool permanently.</em></p><p><strong><em>### `trigger-auth.yaml`</em></strong></p><p><em>KEDA TriggerAuthentication resource:</em></p><p><em>- Uses </em><strong><em>**Azure Workload Identity**</em></strong><em> (pod identity) to authenticate KEDA’s polling of the ADO agent pool queue</em></p><p><em>- No PAT token required — fully managed identity based</em></p><p><em>- References the managed identity’s `clientId` and `tenantId`</em></p><p><strong><em>### `certs/`</em></strong></p><p><em>Root certificates. These are copied into the image at build time and added to the system CA store via `update-ca-certificates`. Required for TLS connections to internal services.</em></p><p><strong><em>## Deployment Steps</em></strong></p><p><strong><em>### Step 1 — Configure Parameters</em></strong></p><p><em>Edit `pipelines/adoagent-azure-pipelines.yml` parameters to match your environment:</em></p><p><em>parameters:</em></p><p><em>- name: containerRegistry</em></p><p><em>default: ‘your-acr.azurecr.io’</em></p><p><em>- name: imageRepository</em></p><p><em>default: ‘adoagent’</em></p><p><em>- name: tag</em></p><p><em>default: ‘v1’</em></p><p><em>- name: ClusterName</em></p><p><em>default: ‘YOUR-AKS-CLUSTER’</em></p><p><em>- name: ClusterRG</em></p><p><em>default: ‘YOUR-AKS-RG’</em></p><p><em>- name: adoOrgUrl</em></p><p><em>default: ‘https://dev.azure.com/YOUR-ORG&#39;</em></p><p><em>- name: adoPoolName</em></p><p><em>default: ‘your-agent-pool-name’</em></p><p><strong><em>### Step 2 — Build and Push the Agent Image</em></strong></p><p><em>Register the pipeline in ADO and run the </em><strong><em>**Build**</em></strong><em> stage. This:</em></p><p><em>1. Builds the Dockerfile</em></p><p><em>2. Pushes the image to ACR as `adoagent:&lt;tag&gt;`</em></p><p><strong><em>### Step 3 — Deploy to AKS</em></strong></p><p><em>The </em><strong><em>**DeployYaml**</em></strong><em> stage runs:</em></p><p><em>kubectl apply -f keda-scaled-jobs.yaml</em></p><p><em>kubectl apply -f placeholder.yaml</em></p><p><em>kubectl apply -f trigger-auth.yaml</em></p><p><em>Or manually:</em></p><p><em>az aks get-credentials — resource-group &lt;RG&gt; — name &lt;CLUSTER&gt;</em></p><p><em>kubectl apply -f trigger-auth.yaml</em></p><p><em>kubectl apply -f placeholder.yaml</em></p><p><em>kubectl apply -f keda-scaled-jobs.yaml</em></p><p><strong><em>### Step 4 — Verify</em></strong></p><p><em># Check KEDA ScaledJob is ready</em></p><p><em>kubectl describe scaledjob ado-agent-scaledjob</em></p><p><em># Check placeholder registered in ADO pool (should show offline)</em></p><p><em># ADO → Project Settings → Agent Pools → your pool → Agents tab</em></p><p><em># Trigger a test pipeline using the pool</em></p><p><em># Watch pods spin up:</em></p><p><em>kubectl get pods -w | Select-String ado</em></p><p><strong><em>## Using the Agent in Pipelines</em></strong></p><p><em>In any ADO pipeline YAML:</em></p><p><em>pool:</em></p><p><em>name: aks-poc-pool</em></p><p><em>KEDA handles scaling automatically.</em></p><p><strong><em>## Scaling Behavior</em></strong></p><p><em>| Setting | Current | Effect |</em></p><p><em>| — -| — -| — -|</em></p><p><em>| `maxReplicaCount` | 10 | Max 10 pods simultaneously; jobs beyond 10 wait in queue |</em></p><p><em>| `pollingInterval` | 5s | KEDA checks for new jobs every 5 seconds |</em></p><p><em>| `successfulJobsHistoryLimit` | 0 | Completed pods are cleaned up immediately |</em></p><p><em>| `failedJobsHistoryLimit` | 0 | Failed pods are cleaned up immediately |</em></p><p><strong><em>**Example:**</em></strong><em> 30 jobs queued with `maxReplicaCount: 10` → runs in 3 batches → each batch ~5 min → total ~15 min.</em></p><p><strong><em>**To increase speed:**</em></strong><em> Raise `maxReplicaCount` (ensure cluster has capacity):</em></p><p><em>kubectl top nodes # Check current resource usage</em></p><p><strong><em>## Updating the Agent Image</em></strong></p><p><em>1. Modify `Dockerfile` or `start.sh`</em></p><p><em>2. Increment the `tag` parameter (e.g. `v1` → `v2`)</em></p><p><em>3. Re-run the pipeline</em></p><p><em>4. Update `keda-scaled-jobs.yaml` image tag to match</em></p><p><em>5. Apply the updated YAML</em></p><p><strong><em>— -</em></strong></p><p><strong><em>## Troubleshooting</em></strong></p><p><em>| Issue | Cause | Fix |</em></p><p><em>| — -| — -| — -|</em></p><p><em>| Pods stuck in `NotReady` (1/2) | DinD sidecar not exiting | Ensure `dind` is in `initContainers` with `restartPolicy: Always` |</em></p><p><em>| Jobs stuck in ADO queue | `maxReplicaCount` too low or pods not completing | Increase `maxReplicaCount` or check pod logs |</em></p><p><em>| `docker: command not found` in pipeline | `DOCKER_HOST` not set | Ensure `DOCKER_HOST=tcp://localhost:2375` env var is present |</em></p><p><em>| `az acr login` fails | No Docker daemon available | DinD sidecar must be running before agent starts |</em></p><p><em>| Agent not registering | Workload Identity misconfigured | Check `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, token file mount |</em></p><p><em>| CRLF errors in `start.sh` | Windows line endings | Run `git config core.autocrlf input` and re-clone |</em></p><p><strong><em>## Key Design Decisions</em></strong></p><p><em>1. </em><strong><em>**Workload Identity over PAT**</em></strong><em> — No secret rotation needed, federated token auto-refreshes</em></p><p><em>2. </em><strong><em>**Native sidecar (K8s 1.28+)**</em></strong><em> — DinD exits automatically when agent finishes, no zombie pods</em></p><p><em>3. </em><strong><em>**` — once` flag**</em></strong><em> — Each agent runs exactly one job, ensuring clean isolation</em></p><p><em>4. </em><strong><em>**`shareProcessNamespace: true`**</em></strong><em> — Required for Kubernetes to signal the sidecar on pod termination</em></p><p><em>5. </em><strong><em>**MTU 1400**</em></strong><em> — Prevents packet fragmentation in Azure CNI overlay networks</em></p><p><em>6. </em><strong><em>**Placeholder agent**</em></strong><em> — Keeps the ADO pool alive for KEDA to route jobs to</em></p><p><em>I hope you guys like my article.</em></p><p><em>Happy Learning:)</em></p><p><em>Follow me on Github:-</em><a href="https://github.com/Reliable-Royalty-29"><em>https://github.com/Reliable-Royalty-29</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e359e605b5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 Real-World Lessons from My DevOps Journey (With a Dash of Humor)]]></title>
            <link>https://dheemandas2912.medium.com/10-real-world-lessons-from-my-devops-journey-with-a-dash-of-humor-89a6cd68b8d5?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/89a6cd68b8d5</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Wed, 03 Sep 2025 15:18:35 GMT</pubDate>
            <atom:updated>2025-09-03T15:18:35.303Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CxEOh_THTmm5HGTz.jpeg" /></figure><p>Hey Medium fam! As a DevOps Engineer II, I’ve spent enough time in the trenches to earn a healthy respect for production servers — and a touch of paranoia on Friday evenings. Here are my hard-earned lessons, peppered with wisdom and just enough humor to keep your CI/CD pipeline running and your sanity intact.</p><p><strong>Understand the Big Picture (A–Z):</strong><br>Before touching a single script, dive headfirst into your project’s architecture and workflow. Knowing how every piece fits together is the secret to catching issues before they snowball into “urgent, now!” incidents.</p><p><strong>Business Needs Trump Personal Preferences:</strong><br>You might be in love with GitHub Actions, but if your organization swears by Azure DevOps, remember: it’s not your wedding — business requirements always take priority. Tool choices should serve the organization, not individual taste.</p><p><strong>Master Troubleshooting:</strong><br>Errors are like uninvited guests — they arrive when least expected. Trace issues to their commit IDs and attack with precision. Sometimes, the commit history is more dramatic than any Netflix series.</p><p><strong>Document Everything (Your Brain Will Thank You):</strong><br>Every nugget you learn, jot it down! Trust me, your “Daily DevOps Diary” will save countless hours when the fire alarm (read: incident call) rings. Documentation is your superhero cape in a crisis.</p><p><strong>Expect (and Embrace) Change:</strong><br>Project requirements don’t come carved in stone — they’re more dynamic than a Friday deployment schedule. Be ready to switch focus, adapt, and always align with evolving business priorities.</p><p><strong>Lifelong Learning, One Day at a Time:</strong><br>Even the smallest lesson stacks up. Whether it’s a new CLI flag or a fancy automation trick, continuous learning keeps your skills sharp and your job interesting.</p><p><strong>Practical Experience Beats Theory:</strong><br>Documentation isn’t just helpful — it’s your lifeline. Hands-on troubleshooting and deep dives into official docs are far more valuable than any flashy certification on your wall.</p><p><strong>Certifications: Good, But Reality Is Better:</strong><br>Sure, certifications look nice on resumes. But live environments toss errors that never appeared in the exam! Real skills show when you’re firefighting colorful issues at 3 a.m. Certifications are nice; hands-on skills are gold.</p><p><strong>Trust Your Intuition (But Don’t Experiment in Prod):</strong><br>If something looks suspicious, investigate! Instinct can prevent painful outages — but save experiments for dev or staging. Stress-testing your health in prod = bad idea, especially when caffeine is your last line of defense.</p><p><strong>Golden Rule: No Friday Evening Deployments. Ever:</strong><br>Deploying to prod on a Friday evening? Legendary move… if you like living dangerously! Resist the urge. Your weekend will thank you — and so will the entire engineering team. Never say “just a quick push before I log off.” Never.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89a6cd68b8d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[️ Terraform vs Azure Backup Policy Bug: A Real-World Fix for azurerm_backup_policy_vm]]></title>
            <link>https://dheemandas2912.medium.com/%EF%B8%8F-terraform-vs-azure-backup-policy-bug-a-real-world-fix-for-azurerm-backup-policy-vm-60db5aa1da2d?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/60db5aa1da2d</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Thu, 31 Jul 2025 04:41:24 GMT</pubDate>
            <atom:updated>2025-07-31T04:41:24.298Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iIuOSK-a6uIuR5Z_h1f50A.png" /></figure><h3>📌 Overview</h3><p>While automating infrastructure with Terraform, we encountered a puzzling issue with the azurerm_backup_policy_vm resource. Specifically, applying a backup policy with a weekly retention schedule triggered a 400 error from the Azure API. This post outlines the issue, the workaround we implemented, and how others can resolve it if they face similar challenges.</p><h3>🧩 The Problem</h3><p>We were using the following configuration in our Terraform code:</p><p><strong>retention_weekly {</strong></p><p><strong>count = 4</strong></p><p><strong>weekdays = [“Sunday”]</strong></p><p><strong>}</strong></p><p>When running terraform apply from the master branch, the apply failed with a 400 error from the Azure API. The error message pointed to a failure in the ProtectionPoliciesClient#CreateOrUpdate call.</p><p>This issue is documented in <a href="https://github.com/hashicorp/terraform-provider-azurerm/issues/27444,">https://github.com/hashicorp/terraform-provider-azurerm/issues/27444,</a> where others have reported similar failures when modifying backup times or retention schedules.</p><h3>🧪 Our Workaround</h3><p>To isolate and resolve the issue, we followed these steps:</p><ol><li>Created a new branch from master in VS Code.</li><li>Modified the policy by replacing the weekly retention block with a daily retention block:</li></ol><p><strong>retention_daily {</strong></p><p><strong>count = 7</strong></p><p><strong>}</strong></p><p>3. Applied the changes in our UAT environment — success!</p><p>4. Switched back to master and re-applied — success again, even with the original weekly retention policy.</p><h3>🧠 Analysis</h3><p>This behavior suggests that the Azure API has a latent bug when provisioning or updating backup policies with weekly retention schedules. The workaround — temporarily switching to a daily policy — appears to reset or bypass the problematic state in the Azure backend.</p><h3>✅ Recommendations</h3><p>If you encounter similar issues:</p><ul><li>❌ Avoid modifying backup times or retention schedules directly in policies that include retention_weekly.</li><li>✅ Use a temporary retention_daily policy to apply changes successfully.</li><li>🔍 Follow <a href="https://github.com/hashicorp/terraform-provider-azurerm/issues/27444">https://github.com/hashicorp/terraform-provider-azurerm/issues/27444</a> for community updates and fixes.</li></ul><h3>📚 References</h3><ul><li><a href="https://github.com/hashicorp/terraform-provider-azurerm/issues/27444">https://github.com/hashicorp/terraform-provider-azurerm/issues/27444</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60db5aa1da2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Automate Gmail Cleanup with Python: Delete Promotions, Social & Updates in One Click]]></title>
            <link>https://dheemandas2912.medium.com/automate-gmail-cleanup-with-python-delete-promotions-social-updates-in-one-click-ddeeada53c9a?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddeeada53c9a</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 18:41:26 GMT</pubDate>
            <atom:updated>2025-07-21T19:24:22.529Z</atom:updated>
            <content:encoded><![CDATA[<p>Is your Gmail inbox overflowing with marketing emails, social media notifications, or those random updates you never read? You’re not alone. Fortunately, with a little Python and the Gmail API, you can <strong>automatically clean up your inbox</strong> and regain control — without clicking “Delete” 10,000 times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r6e9ja6AEcdf0SJL" /></figure><p>In this guide, I’ll walk you through building a <strong>Gmail cleanup script</strong> that deletes emails from the <strong>Promotions</strong>, <strong>Social</strong>, and <strong>Updates</strong> tabs — using just Python and a few Google Cloud configurations.</p><h3>🎯 What You’ll Achieve</h3><p>By the end of this article, you’ll have a script that:</p><p>✅ Connects to your Gmail securely<br> ✅ Automatically deletes all emails from the <strong>Promotions</strong>, <strong>Social</strong>, and <strong>Updates</strong> tabs<br> ✅ Saves you hours of manual cleanup every month</p><h3>🛠️ Prerequisites</h3><p>Before we dive in, make sure you have:</p><ul><li>A <strong>Gmail account</strong></li><li><strong>Python 3.6+</strong> installed</li><li>A <strong>Google Cloud Project</strong> with the <strong>Gmail API enabled</strong></li></ul><h3>🚀 Step-by-Step Setup</h3><h3>✅ Step 1: Create a Google Cloud Project</h3><ol><li>Head to the Google Cloud Console.</li><li>Click <strong>“New Project”</strong>, name it (e.g., “Gmail Cleaner”), and create it.</li><li>Navigate to <strong>APIs &amp; Services → Library</strong>.</li><li>Search for <strong>“Gmail API”</strong>, select it, and click <strong>Enable</strong>.</li></ol><h3>✅ Step 2: Configure OAuth Consent Screen</h3><ol><li>Go to <strong>OAuth Consent Screen</strong> in the sidebar.</li><li>Choose <strong>External</strong>, and click <strong>Create</strong>.</li><li>Fill in:</li></ol><ul><li><strong>App Name</strong>: Gmail Cleanup Script</li><li><strong>User Support Email</strong>: your Gmail</li><li><strong>Developer Contact Info</strong>: your Gmail</li></ul><ol><li>Skip scopes (it’s for personal use).</li><li>Add <strong>your Gmail address</strong> to the Test Users list.</li><li>Save and go back.</li></ol><h3>✅ Step 3: Create OAuth Credentials</h3><ol><li>Go to <strong>Credentials</strong> → <strong>Create Credentials → OAuth client ID</strong></li><li>Select:</li></ol><ul><li><strong>Application Type</strong>: Desktop App</li><li><strong>Name</strong>: gmail-script</li></ul><ol><li>Click <strong>Create</strong> and immediately download the <strong>JSON</strong> file.</li><li>Rename it to credentials.json and place it in your project folder.</li></ol><p>⚠️ <em>If you close the window before downloading, you’ll need to delete the client and recreate it.</em></p><h3>✅ Step 4: Install Required Python Libraries</h3><p>Open your terminal and run:<br>python -m pip install — upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib</p><h3>✅ Step 5: Run the Script</h3><p>Let’s get to the magic. Run the following:</p><p>python delete_gmail_categories.py</p><ul><li>On first run, a browser will pop up asking for Gmail access.</li><li>Log in and <strong>allow access</strong>.</li><li>A token.json file will be saved for future use, so you won’t need to log in every time.</li></ul><h3>🧠 Script Logic: How It Works</h3><p>Your Python script will:</p><ul><li>Authenticate securely using OAuth</li><li>Use Gmail API to search for emails labeled:</li><li>category:promotions</li><li>category:social</li><li>category:updates</li><li>Delete them in batches</li></ul><p>That’s it — inbox, decluttered.</p><h3>❗ Common Errors and Fixes</h3><h3>🚫 Error 403: access_denied</h3><ul><li><strong>Cause</strong>: Your Gmail isn’t added as a Test User</li><li><strong>Fix</strong>: Go back to the OAuth consent screen and add your email to the test users.</li></ul><h3>🚫 Missing credentials.json</h3><ul><li>You must download it <strong>immediately</strong> after creating your OAuth client.</li><li>If you missed it:</li><li>Delete the client</li><li>Create a new one</li><li>Download again</li></ul><h3>🐍 pip not working?</h3><p>Try:<br>python -m pip install &lt;package-name&gt;</p><p>📁 Recommended Folder Structure<br>gmail_cleaner/<br>├── delete_gmail_categories.py<br>├── credentials.json # Your downloaded OAuth client<br>└── token.json # Created on first script run</p><h3>🧘 Final Thoughts</h3><p>Cleaning your Gmail manually is tedious. But with this simple automation, your inbox stays organized and clutter-free — with <strong>zero effort</strong> after setup.</p><p>Whether you run it weekly or monthly, this script helps you focus on what truly matters — no more digging through promo spam or social media notifications.</p><p>📌 <strong>Ready to reclaim your inbox?</strong></p><p>👉 Get the full source code here:<br> <strong>🔗 GitHub Repository — </strong><a href="https://github.com/Reliable-Royalty-29/Gmail-Cleanup-Automation/tree/main"><strong>Gmail-Cleanup-Automation</strong></a></p><p>If you found this helpful, <strong>give the repo a ⭐ on GitHub</strong> to show your support — it helps others discover it too!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddeeada53c9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform Tricks for Azure: How count and for_each Impact Your Infrastructure]]></title>
            <link>https://dheemandas2912.medium.com/terraform-tricks-for-azure-how-count-and-for-each-impact-your-infrastructure-2c1a182ebac1?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c1a182ebac1</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Fri, 11 Jul 2025 17:20:07 GMT</pubDate>
            <atom:updated>2025-07-11T17:20:07.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*qE2zDk6boXh0AXjV.jpg" /></figure><p>When using Terraform to manage Azure resources, it’s important to know the difference between count and for_each. Both let you create multiple resources, but they work differently. count creates a set number of identical resources and uses numbers to keep track of them, which is simple but can cause issues if the list changes. On the other hand, for_each lets you create resources based on a list or map with unique names, giving you better control and preventing Terraform from accidentally deleting or recreating resources when changes happen.<br>Let me explain you both meta-arguments with proper examples.</p><h3>🔍 Understanding count</h3><p>The count meta-argument allows you to specify the number of instances of a resource to create. It&#39;s particularly useful when you need to create a fixed number of identical resources.</p><h4>Example: Creating Multiple Resource Groups</h4><p>resource “azurerm_resource_group” “example” {<br> count = 3<br> name = “example-resources-${count.index}”<br> location = “East US”<br>}</p><p>This configuration creates three resource groups:</p><ul><li>example-resources-0</li><li>example-resources-1</li><li>example-resources-2</li></ul><p><strong>Caution</strong>: If you modify the list (e.g., remove an item), Terraform might recreate all subsequent resources, leading to potential disruptions.</p><h3>🧩 Understanding for_each</h3><p>The for_each meta-argument allows you to iterate over a map or set, creating a resource for each item. This approach is beneficial when each resource has unique attributes or when you need more control over resource naming.</p><h4>Example: Creating Resource Groups with Unique Names</h4><p>resource “azurerm_resource_group” “example” {<br> for_each = toset([“dev”, “staging”, “prod”])</p><p>name = “example-resources-${each.key}”<br> location = “East US”<br>}</p><p>This configuration creates three resource groups:</p><ul><li>example-resources-dev</li><li>example-resources-staging</li><li>example-resources-prod</li></ul><p><strong>Advantage</strong>: If you remove &quot;staging&quot; from the set, only the staging resource group is deleted, leaving the others intact.</p><h3>🛠️ Best Practices for Azure Deployments</h3><ul><li><strong>Use </strong><strong>count</strong> when you need to create a fixed number of identical resources without concern for unique naming or attributes.</li><li><strong>Use </strong><strong>for_each</strong> when each resource has unique attributes or when you require predictable naming and behavior.</li></ul><p><strong>Example: Creating Virtual Machines with Unique Names</strong></p><p>resource “azurerm_virtual_machine” “example” {<br> for_each = toset([“vm1”, “vm2”, “vm3”])</p><p>name = each.key<br> location = “East US”<br> resource_group_name = azurerm_resource_group.example.name<br> network_interface_ids = [azurerm_network_interface.example.id]<br> vm_size = “Standard_DS1_v2”<br>}</p><p>This configuration creates three virtual machines:</p><ul><li>vm1</li><li>vm2</li><li>vm3</li></ul><p>Each VM has its own unique name and attributes, ensuring clear identification and management.</p><h3>🧪 Advanced Use Case: Combining count and for_each</h3><p>In some scenarios, you might need to combine both count and for_each to achieve the desired configuration. However, be aware that Terraform does not allow both meta-arguments on the same resource block simultaneously.</p><p>To work around this, you can use locals to define your resources and then iterate over them.</p><h4>Example: Creating Multiple Virtual Machines with Different Configurations</h4><p>locals {<br> vm_configs = [<br> { name = “vm1”, size = “Standard_DS1_v2” },<br> { name = “vm2”, size = “Standard_DS2_v2” },<br> { name = “vm3”, size = “Standard_DS3_v2” }<br> ]<br>}</p><p>resource “azurerm_virtual_machine” “example” {<br> for_each = { for idx, vm in local.vm_configs : vm.name =&gt; vm }</p><p>name = each.key<br> location = “East US”<br> resource_group_name = azurerm_resource_group.example.name<br> network_interface_ids = [azurerm_network_interface.example.id]<br> vm_size = each.value.size<br>}</p><p>This configuration creates three virtual machines with different sizes:</p><ul><li>vm1 with size Standard_DS1_v2</li><li>vm2 with size Standard_DS2_v2</li><li>vm3 with size Standard_DS3_v2</li></ul><p>By using locals and for_each, you can dynamically create resources with varying configurations.</p><h3>🧠 Final Thoughts</h3><p>Choosing between count and for_each depends on your specific use case and the level of control you need over your resources. While count is straightforward and useful for identical resources, for_each offers greater flexibility and control, especially when dealing with resources that have unique attributes or require specific naming conventions.</p><p>Always consider the implications of modifying your lists and the potential impact on your infrastructure. By understanding the differences and best practices associated with count and for_each, you can make informed decisions that lead to more efficient and manageable Azure deployments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c1a182ebac1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are You Really a Kubernetes Expert? Take This 10-Question Challenge to Find Out]]></title>
            <link>https://dheemandas2912.medium.com/are-you-really-a-kubernetes-expert-take-this-10-question-challenge-to-find-out-7b6af7b25ed3?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b6af7b25ed3</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Sun, 06 Jul 2025 18:27:58 GMT</pubDate>
            <atom:updated>2025-07-06T18:27:58.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BjhgidFqKOb6o9uTzMd63g.jpeg" /></figure><h3>🧠 Introduction</h3><p>Kubernetes has become the backbone of modern cloud-native applications. But let’s face it — just deploying a few Pods and Services doesn’t make someone a Kubernetes expert.</p><p>Whether you’re a developer, DevOps engineer, SRE, or architect, mastering Kubernetes means understanding its deeper workings — from container orchestration and scaling to networking, probes, and troubleshooting.</p><p>So here’s a quick challenge:</p><blockquote><em>Can you answer 10 questions that test your real-world Kubernetes knowledge?</em></blockquote><p>This isn’t your average multiple-choice quiz — it’s a <strong>hands-on knowledge check</strong> designed to separate casual users from true pros.</p><p>Let’s see how much you really know about Kubernetes.<br> 👇 Scroll down and start the quiz!</p><h3>1. In a cluster with two nodes, one with pods and the other without, which node will a new pod be scheduled to?</h3><h3>🧠 Situation:</h3><ul><li>You have <strong>two shelves</strong> (nodes).</li><li><strong>Shelf A</strong> already has some boxes (pods).</li><li><strong>Shelf B</strong> is completely <strong>empty</strong>.</li><li>A <strong>new box</strong> (pod) comes in.</li><li>Now, you ask: <strong>Which shelf will it go to?</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o9olLgM-3JnF7C9LkdNpiw.png" /></figure><h3>📦 How Kubernetes Thinks:</h3><p>Kubernetes acts like a <strong>smart organizer</strong>. When a new box (pod) needs to be placed:</p><ol><li>It checks <strong>both shelves</strong>.</li><li>It looks at <strong>available space</strong>, <strong>resources (CPU/memory)</strong>, and a few other conditions.</li><li>If <strong>Shelf B is empty</strong> and has <strong>more free space</strong>, Kubernetes will <strong>usually choose the empty shelf</strong>.</li></ol><p>Why?</p><p>Because it tries to:</p><ul><li><strong>Balance the load</strong> across shelves.</li><li>Use resources <strong>efficiently</strong>.</li><li>Avoid putting too much on one shelf while the other one is empty.</li></ul><h3>✅ So, in simple words:</h3><blockquote><em>If you have two computers (nodes), and one already has apps (pods) running while the other is doing nothing, Kubernetes will typically put the next app (pod) on the </em><strong><em>empty one</em></strong><em> — to keep things balanced.</em></blockquote><h3>🛠 Caveat:</h3><p>This assumes both nodes are <strong>healthy</strong>, <strong>ready</strong>, and <strong>have enough resources</strong>. If the empty node is not working or doesn’t meet the pod’s needs, Kubernetes <strong>won’t use it</strong>, even if it’s empty.</p><h3>2. If an application running in a container encounters an OOM (Out-of-Memory) error, will the container restart, or will the entire Pod be recreated?</h3><h3>🧠 Situation:</h3><ul><li>You’re running an <strong>application</strong> inside a <strong>container</strong>, and it’s part of a <strong>Pod</strong> in Kubernetes.</li><li>The app uses <strong>more memory than allowed</strong>, and hits an <strong>OOM (Out-of-Memory) error</strong>.</li></ul><h3>🚨 What happens next?</h3><h4>🔄 Will the container restart?</h4><p>✅ <strong>Yes</strong> — Kubernetes will <strong>restart the container</strong> inside the pod.</p><h4>🏗 Will the whole Pod be recreated?</h4><p>❌ <strong>No</strong>, the <strong>Pod is not recreated</strong> (unless there’s some other issue).</p><h3>🔧 Why is that?</h3><p>Think of a Pod like a <strong>house,</strong> and a container like an <strong>appliance inside it (like a microwave)</strong>.</p><ul><li>If the <strong>microwave blows a fuse</strong> (OOM error), you <strong>replace or restart the microwave</strong>, but you don’t <strong>rebuild the entire house</strong>.</li><li>Similarly, Kubernetes will <strong>restart the container</strong> that failed, <strong>not the whole pod</strong>, unless something more serious happens.</li></ul><h3>✅ In short:</h3><blockquote><em>If a container hits an OOM error, </em><strong><em>only that container restarts</em></strong><em>, </em><strong><em>not the whole pod</em></strong><em>. The pod remains the same — Kubernetes just gives the container another shot.</em></blockquote><h3>3. Can application configurations such as environment variables or ConfigMap updates be applied dynamically without recreating the Pod?</h3><h3>🔴 For Environment Variables:</h3><p>❌ <strong>No</strong>, you <strong>cannot change environment variables dynamically</strong> for a running pod.</p><ul><li>When you define environment variables in a pod spec, they get <strong>injected only at pod startup</strong>.</li><li>To apply changes, you need to <strong>recreate the Pod</strong> (either manually or through a deployment rollout).</li></ul><p>➡️ Think of it like baking a cake with some ingredients (env vars). Once baked, you can’t change the sugar level — you need to bake a new cake.</p><h3>🟡 For ConfigMaps:</h3><p>It depends on <strong>how your application consumes them</strong>:</p><h4>✅ Mounted as Volumes (Recommended Way):</h4><ul><li>If your ConfigMap is mounted as a <strong>volume</strong>, and you <strong>update the ConfigMap</strong>, the <strong>file contents in the Pod can update</strong> automatically <strong>(usually within a few seconds)</strong>.</li><li>BUT: the <strong>application must re-read the file</strong> to reflect the changes.</li></ul><p>✅ <strong>Pod restart not needed</strong>, <strong>if your app watches the file</strong>.</p><h4>❌ Used as Environment Variables:</h4><ul><li>If you use ConfigMap values as <strong>env vars</strong>, they behave <strong>just like normal env vars</strong>.</li><li>So: ❌ You <strong>must recreate the Pod</strong> to see the changes.</li></ul><h3>4. Is a Pod stable once created, even if the user takes no further action?</h3><h4>🟡 The honest answer:</h4><p><strong>“It depends.”</strong><br> A Pod is <strong>not guaranteed to be permanently stable</strong> just because it’s created. Here’s why:</p><h3>✅ When is a Pod stable?</h3><p>A Pod is <em>stable</em> <strong>only as long as:</strong></p><ul><li>The <strong>node it’s running on stays healthy</strong></li><li>The <strong>container inside doesn’t crash</strong></li><li>There are <strong>no external forces</strong> (like eviction or scaling events)</li><li>It’s not affected by <strong>resource pressure</strong> (memory, CPU, disk)</li></ul><h3>🧠 TL;DR:</h3><blockquote><em>A pod </em><strong><em>can run stably</em></strong><em> for a while if nothing goes wrong, but it is </em><strong><em>not inherently stable or self-healing</em></strong><em>.<br> Use controllers (like Deployments) to ensure </em><strong><em>long-term stability and auto-recovery</em></strong><em>.</em></blockquote><h3>5. Can a Service of type ClusterIP ensure load balancing for TCP traffic?</h3><h3>🔹 What is a ClusterIP Service?</h3><ul><li>It’s the <strong>default type</strong> of Service in Kubernetes.</li><li>It exposes a group of pods <strong>internally</strong> (within the cluster).</li><li>Other services or pods inside the cluster can <strong>access it via a stable virtual IP</strong>.</li></ul><h3>🔄 Does it Load Balance?</h3><p>✅ <strong>Yes</strong>, it <strong>automatically load balances</strong> traffic across all healthy pod endpoints <strong>behind the service</strong>.</p><p>This applies to:</p><ul><li>✅ <strong>TCP traffic</strong></li><li>✅ <strong>UDP traffic</strong></li><li>✅ <strong>HTTP/HTTPS traffic</strong> (since they’re built on TCP)</li></ul><h3>⚙️ How it works (TCP context):</h3><ol><li>You create a Service with ClusterIP type and point it to a selector.</li><li>Kubernetes keeps track of all the <strong>pods matching the selector</strong>.</li><li>When a pod inside the cluster sends a <strong>TCP request to the service IP</strong>, Kubernetes (via <strong>kube-proxy</strong>) uses <strong>round-robin</strong> or similar strategy to <strong>load balance</strong> that TCP connection to one of the backend pods.</li></ol><h3>🧠 TL;DR:</h3><blockquote><em>Yes, a </em><em>ClusterIP service </em><strong><em>does load balancing</em></strong><em> for </em><strong><em>TCP traffic</em></strong><em>, across all matching pods inside the cluster. It’s automatic, internal, and built-in.</em></blockquote><h3>6. How should application logs be collected, and is there a risk of losing logs?</h3><h3>🧱 1. Standard Practice: Write logs to stdout/stderr</h3><ul><li>Your app should <strong>not write to files inside the container</strong> (like /var/log/app.log).</li><li>Instead, it should log to <strong>standard output (stdout)</strong> and <strong>standard error (stderr)</strong>.</li><li>This is because Kubernetes captures these logs <strong>automatically</strong> via the container runtime.</li></ul><h3>🧠 TL;DR:</h3><blockquote><em>✔️ </em><strong><em>Log to stdout/stderr</em></strong><em>,<br> ❌ </em><strong><em>Don’t rely on local logs inside the container</em></strong><em>,<br> 🛡️ </em><strong><em>Use centralized log collection tools</em></strong><em> (like Fluent Bit, Loki, etc.) to ensure logs are saved and searchable even if pods crash or nodes go down.</em></blockquote><h3>7. If an HTTP Server Pod’s livenessProbe is functioning correctly, does it mean the application is problem-free?</h3><p>🔍 <strong>No</strong>, a passing livenessProbe does <strong>not necessarily mean</strong> the application is <strong>problem-free</strong>.</p><p>Let’s explain that clearly:</p><h3>✅ What a livenessProbe actually checks:</h3><ul><li>It <strong>only checks if the container is alive</strong> — i.e., it’s not stuck, crashed, or frozen.</li><li>If the liveness check passes, <strong>Kubernetes assumes the app is still running</strong> — but it doesn’t mean everything is working perfectly.</li></ul><h3>📍 Real-world example:</h3><p>Imagine your app has an HTTP endpoint /healthz used by livenessProbe.</p><ul><li>The endpoint simply returns 200 OK if the server is running.</li><li>BUT… your app’s real business logic (like DB queries or user APIs) might be:</li><li>Returning 500 errors</li><li>Failing to connect to the database</li><li>Timing out due to internal issues</li></ul><blockquote><em>Kubernetes </em><strong><em>won’t know any of that</em></strong><em> unless your liveness probe is smart enough to check those too — which it usually isn’t (and shouldn’t).</em></blockquote><h3>✅ Best Practice:</h3><ul><li>Use <strong>livenessProbe</strong> to check:<br> 👉 <em>Is the process running and not stuck?</em></li><li>Use <strong>readinessProbe</strong> to check:<br> 👉 <em>Can the app serve traffic right now?</em></li><li>Use <strong>external monitoring</strong> or application-level health checks to track <strong>real issues</strong>.</li></ul><h3>🧠 TL;DR:</h3><blockquote><em>✅ A working </em><em>livenessProbe just means the container is </em><strong><em>alive</em></strong><em>.<br> ❌ It does </em><strong><em>not</em></strong><em> mean the application is problem-free, healthy, or ready to serve real user requests.</em></blockquote><h3>8. How can an application scale to handle traffic fluctuations?</h3><h3>✅ The answer: Auto-scaling mechanisms</h3><p>In Kubernetes, the most common and effective way to scale applications is by using:</p><h3>🔹 1. Horizontal Pod Autoscaler (HPA)</h3><blockquote><em>Automatically </em><strong><em>adds or removes pods</em></strong><em> based on resource usage like </em><strong><em>CPU</em></strong><em>, </em><strong><em>memory</em></strong><em>, or </em><strong><em>custom metrics</em></strong><em>.</em></blockquote><h4>🛠 How it works:</h4><ul><li>If traffic increases ➡️ CPU goes up ➡️ HPA adds more pods.</li><li>If traffic decreases ➡️ CPU drops ➡️ HPA reduces pods.</li></ul><h3>🔹 2. Cluster Autoscaler</h3><blockquote><em>Dynamically </em><strong><em>adds/removes nodes</em></strong><em> in the cluster based on pod demands.</em></blockquote><ul><li>If there aren’t enough nodes to run new pods, Kubernetes will request the cloud provider to <strong>add nodes</strong>.</li><li>When nodes are underused, they can be <strong>terminated</strong> to save cost.</li></ul><p>🧠 Used together with HPA = full-stack scaling.</p><h3>🔹 3. Vertical Pod Autoscaler (VPA)</h3><blockquote><em>Adjusts </em><strong><em>CPU and memory requests/limits</em></strong><em> of pods.</em></blockquote><ul><li>Less common in high-fluctuation traffic cases.</li><li>More useful for optimizing stable workloads (e.g., batch jobs, cron jobs).</li></ul><h3>🔹 4. Custom Metrics Autoscaler</h3><blockquote><em>You can also scale based on </em><strong><em>application-specific metrics</em></strong><em> like:</em></blockquote><ul><li>Request rate (RPS)</li><li>Queue length</li><li>Latency</li><li>Business metrics (e.g., number of active users)</li></ul><p>This uses the <strong>Kubernetes Metrics Server</strong> or <strong>Prometheus Adapter</strong>.</p><h3>9. When you execute kubectl exec -it &lt;pod&gt; -- bash, are you logging into the pod?</h3><p>✅ <strong>Yes</strong>, when you run:</p><pre>bash</pre><pre>CopyEdit</pre><pre>kubectl exec -it &lt;pod&gt; -- bash</pre><p>You are essentially <strong>“logging into” the pod’s container</strong>, but let’s explain <strong>what that really means</strong>.</p><h3>✅ So are you logging in?</h3><p>✔️ <strong>Yes — in practical terms</strong>:<br> You’re getting a <strong>shell inside the container</strong> running in the pod — so it <strong>feels like you’re logged in</strong>, similar to SSH.</p><p>❌ <strong>But technically</strong>:<br> You’re <strong>not logging into the pod itself</strong>, you’re running a command (bash) <strong>inside one container of the pod</strong>. You’re not touching the pod object; you’re entering <strong>one of its containers</strong>.</p><h3>10. How would you troubleshoot if a container in a Pod repeatedly exits and restarts?</h3><h3>🧠 TL;DR Troubleshooting Flow:</h3><ol><li>🔍 kubectl get pods → Check status and restarts</li><li>📝 kubectl describe pod → Look for exit codes, events</li><li>📜 kubectl logs --previous → Analyze crash logs</li><li>⚙️ Check config, env, entrypoint, resources</li><li>🧪 Use kubectl exec if possible</li><li>🛠 Fix, redeploy, and monitor</li></ol><h3>🏁 Conclusion</h3><p>So, how did you do?</p><p>If you aced the quiz — congratulations! You’ve likely spent some serious time in the trenches with Kubernetes. If you stumbled on a few questions, that’s okay too — Kubernetes is vast, and there’s always more to learn.</p><p>Whether you’re preparing for a certification, a job interview, or just leveling up your cloud-native skills, the key is <strong>continuous learning and hands-on practice</strong>.</p><p>✅ Stay curious.<br> ✅ Keep exploring.<br> ✅ And remember: even the best engineers are always learning.</p><p>If you found this quiz helpful, share it with your network and challenge your colleagues too — let’s see who the real Kubernetes experts are! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b6af7b25ed3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Ensuring High Availability in Kubernetes with Pod Resources and Pod Disruption Budgets]]></title>
            <link>https://dheemandas2912.medium.com/ensuring-high-availability-in-kubernetes-with-pod-resources-and-pod-disruption-budgets-2ae45c430d2c?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ae45c430d2c</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Thu, 03 Jul 2025 13:17:12 GMT</pubDate>
            <atom:updated>2025-07-03T13:17:12.689Z</atom:updated>
            <content:encoded><![CDATA[<p>As containerized applications scale, reliability and resource optimization become critical. Recently, I dived deep into how <strong>Kubernetes Pod Resources</strong> and <strong>Pod Disruption Budgets (PDBs)</strong> can work together to ensure applications remain stable — especially during peak hours, upgrades, and node failures.</p><p>Here’s a breakdown of my learnings and best practices — whether you’re managing production systems or just getting your hands dirty with cluster internals.</p><h3>🧠 Pod Resource Requests and Limits: The Basics</h3><p>Kubernetes allows you to define <strong>resource requests</strong> and <strong>limits</strong> for each container in a pod. These settings are essential for effective <strong>cluster scheduling</strong> and <strong>runtime resource enforcement</strong>.</p><p>resources:<br> requests:<br> memory: “256Mi”<br> cpu: “100m”<br> limits:<br> memory: “512Mi”<br> cpu: “500m”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*J0GtP3IHHbVn0Ok0_MImKg.png" /></figure><h4>🔹 What this means:</h4><ul><li>requests: The <strong>minimum guaranteed</strong> amount of CPU/memory for the pod. Kubernetes uses this to <strong>decide where to schedule</strong> the pod.</li><li>limits: The <strong>maximum amount</strong> a container can consume. If it exceeds this:</li><li><strong>CPU</strong>: It is throttled.</li><li><strong>Memory</strong>: It is terminated (OOMKilled).</li></ul><p>Resource | Request (Guaranteed) | Limit (Max Allowed) <br>Memory256 MiB512 MiBCPU0.1 core0.5 core</p><p>🔑 <strong>Key Insight:</strong> Requests ensure that Kubernetes schedules the pod on a node with enough free resources. Limits protect the node from a noisy neighbour consuming too much.</p><h3>🛡️ PodDisruptionBudget (PDB): Protecting Availability</h3><p>What happens when a node is drained for maintenance or you’re deploying an update? Kubernetes may <strong>evict pods</strong>. That’s where <strong>PDBs</strong> come in — they act as a <strong>safety net</strong> to ensure your critical application pods remain up and running.</p><p>Example:</p><p>apiVersion: policy/v1<br>kind: PodDisruptionBudget<br>metadata:<br> name: critical-service-pdb<br>spec:<br> minAvailable: 2<br> selector:<br> matchLabels:<br> app: critical-service</p><h4>🔹 What this does:</h4><p>This configuration ensures that <strong>at least 2 pods</strong> with label app=critical-service must be running at all times. Kubernetes will <strong>block any voluntary disruption</strong> (like node drain or rolling updates) if it means dropping below 2 available pods.</p><p>⚠️ <strong>Important:</strong> PDBs only apply to <strong>voluntary disruptions</strong>, not crashes or memory kills caused by resource exhaustion.</p><h3>🎯 Real-World Impact</h3><p>Let’s say you have 4 replicas of your critical-service running across the cluster. If a node hosting 3 of them is drained:</p><ul><li>Without a PDB: Kubernetes might evict all 3 pods at once, causing a <strong>temporary outage</strong>.</li><li>With a PDB (minAvailable: 2): Kubernetes will <strong>refuse to evict more than 2 pods</strong>, ensuring at least 2 stay online.</li></ul><p>It’s important to note that:</p><ul><li>PDBs work <strong>cluster-wide</strong>, not node-specific.</li><li>Kubernetes doesn’t “pick” two pods to protect — it just ensures <strong>any two are always running</strong>.</li><li>If pods are evicted, the <strong>Deployment or ReplicaSet controller</strong> will try to spin up replacements on other nodes.</li></ul><h3>🧩 Putting It All Together</h3><p>By combining <strong>Pod Resource Management</strong> with <strong>Pod Disruption Budgets</strong>, you can:</p><p>✅ Optimize scheduling and node utilization<br> ✅ Prevent resource-hogging containers<br> ✅ Ensure high availability during deployments, upgrades, and maintenance<br> ✅ Align with production-grade reliability standards</p><h3>✨ Final Thoughts</h3><p>In a world of dynamic workloads and auto-scaling clusters, you can’t afford to leave availability to chance. Setting up proper <strong>resource requests and limits</strong> ensures fair and stable resource allocation. Layering that with <strong>PodDisruptionBudgets</strong> adds an essential shield against downtime during cluster operations.</p><p>Whether you’re running 5 services or 500, these configurations make the difference between flaky deployments and rock-solid uptime.</p><p>💬 I’d love to hear your thoughts — have you had any close calls due to misconfigured PDBs or missing resource limits?</p><p>#Kubernetes #DevOps #CloudNative #SRE #SiteReliability #PodDisruptionBudget #K8sTips #LinkedInTech #MediumArticle</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ae45c430d2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ My Experience with Terraform Refactoring Across Multiple Environments]]></title>
            <link>https://dheemandas2912.medium.com/my-experience-with-terraform-refactoring-across-multiple-environments-14b5c870cffd?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/14b5c870cffd</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cicd]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Tue, 24 Jun 2025 15:27:40 GMT</pubDate>
            <atom:updated>2025-06-24T15:27:40.973Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the past few weeks, I had the opportunity to lead a <strong>Terraform refactoring</strong> process across our <strong>QA, UAT, and PROD environments</strong> — and it turned out to be a great learning experience that sharpened my understanding of infrastructure as code (IaC), environment isolation, and safe deployments at scale.</p><p>Here’s a breakdown of the journey and what I learned 👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*3dxBabn_U2R7rpFUsvkSHA.png" /></figure><h3>🔍 Why Refactor Terraform?</h3><p>As our infrastructure matured, we realized the need to <strong>clean up and modularize</strong> our Terraform codebase. Over time, the code had grown organically — with some duplication, inconsistencies between environments, and a lack of separation of concerns. It was time for a refactor that would make our infrastructure more maintainable and scalable.</p><h3>🧠 My Approach to Refactoring</h3><p>Here’s how I tackled the refactoring step-by-step:</p><h4>✅ 1. Carefully Reviewed Each Terraform Plan</h4><p>Before making any changes, I ran terraform plan to:</p><ul><li>Identify <strong>what would be created</strong></li><li>Understand <strong>which resources would be updated in-place</strong></li><li>Detect <strong>any resources that must be replaced or destroyed</strong></li></ul><p>Every change was reviewed carefully and discussed with the team to avoid unintended consequences — especially in <strong>UAT and PROD</strong>.</p><h4>🔗 2. Used terraform import to Bring Existing Resources Under Management</h4><p>For resources already existing in the portal but not managed by Terraform, I used the terraform import command to safely bring them under Terraform management <strong>without any downtime</strong>.</p><h4>🔄 3. Moved Resources Between Modules</h4><p>Some resources were moved from one module to another. I used <strong>resource blocks and Terraform’s state management</strong> to reassign resources between modules in a non-destructive way. This helped clean up the structure and improve logical grouping.</p><h4>🧪 4. Set Up Workspaces and tfvars for Each Environment</h4><p>I created and managed <strong>separate Terraform workspaces</strong> (qa, uat, prod) along with dedicated .tfvars files for environment-specific values like:</p><ul><li>Region</li><li>Resource tags</li><li>Capacity settings</li></ul><p>This ensured <strong>clear separation of environments</strong> and reduced the risk of cross-environment changes.</p><h4>🔁 5. Made Incremental Changes, Raised PRs, and Reviewed Plans</h4><p>Each change was:</p><ul><li>Committed in a branch</li><li>Peer-reviewed via Pull Request</li><li>Validated with a new terraform plan to preview the impact</li><li>Applied only after full review and approval</li></ul><p>This gave us <strong>a safe and transparent deployment process</strong>.</p><h4>🚀 6. Ran terraform apply in QA → UAT → PROD</h4><p>Once confident in the plan and having tested thoroughly, I promoted the changes <strong>sequentially from QA to UAT and finally to PROD</strong> using terraform apply. This staged rollout helped us reduce risk and confirm that the changes worked as expected in lower environments first.</p><h3>🧩 Lessons Learned</h3><ul><li><strong>Understand the plan deeply</strong> — Know exactly what Terraform wants to do before you let it touch PROD.</li><li><strong>Modular structure is powerful</strong> — Grouping resources into modules makes your codebase easier to manage and scale.</li><li><strong>Workspaces and tfvars are key</strong> — They let you manage multiple environments cleanly without duplication.</li><li><strong>Collaboration matters</strong> — Infrastructure changes are team efforts. Peer review caught things I missed.</li></ul><h3>🌱 Final Thoughts</h3><p>This refactor gave me <strong>a much deeper understanding of Terraform internals</strong> and environment management. It also reminded me how valuable <strong>small, cautious changes and strong collaboration</strong> are in infrastructure work.</p><p>If you’re managing infrastructure across multiple environments and considering a refactor, <strong>take the leap — but do it safely</strong>. The benefits in clarity, scalability, and confidence are totally worth it.</p><p>#Terraform #DevOps #InfrastructureAsCode #CloudComputing #IaC #Azure #AWS #Refactor #TerraformModules #TerraformTips #CI/CD</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14b5c870cffd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Essential Linux Commands Every DevOps Engineer Should Master]]></title>
            <link>https://dheemandas2912.medium.com/essential-linux-commands-every-devops-engineer-should-master-6821fe3ff8f0?source=rss-40a5c5bf0a8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6821fe3ff8f0</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Dheeman Das]]></dc:creator>
            <pubDate>Thu, 22 May 2025 13:48:59 GMT</pubDate>
            <atom:updated>2025-05-22T13:53:12.511Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7oguzBj4uJ9e_ADa" /></figure><h3>Table of Contents</h3><ol><li><a href="#process-monitoring">Process Monitoring</a></li><li><a href="#network-analysis">Network Analysis</a></li><li><a href="#disk-management">Disk Management</a></li><li><a href="#memory-monitoring">Memory Monitoring</a></li><li><a href="#system-logging">System Logging</a></li><li><a href="#file-system-analysis">File System Analysis</a></li><li><a href="#log-analysis">Log Analysis</a></li></ol><h3>Process Monitoring</h3><h3>top - Real-time System Monitor</h3><p>Interactive process viewer showing CPU and memory usage in real-time.</p><p><strong>Basic Usage:</strong></p><pre>bash</pre><pre>top</pre><p><strong>Key Interactive Commands:</strong></p><ul><li>q - Quit</li><li>k - Kill a process (enter PID)</li><li>M - Sort by memory usage</li><li>P - Sort by CPU usage</li><li>u - Show processes for specific user</li></ul><p><strong>Useful Options:</strong></p><pre>bash</pre><pre># Run top in batch mode (non-interactive)<br>top -b -n 1</pre><pre># Show only processes for a specific user<br>top -u nginx</pre><pre># Update every 2 seconds instead of default 3<br>top -d 2</pre><h3>htop - Enhanced Interactive Process Viewer</h3><p>A more user-friendly alternative to top with colour coding and mouse support.</p><p><strong>Installation &amp; Usage:</strong></p><pre>bash</pre><pre># Install htop (if not available)<br>sudo apt install htop   # Debian/Ubuntu<br>sudo yum install htop   # CentOS/RHEL</pre><pre># Run htop<br>htop</pre><p><strong>Key Features:</strong></p><ul><li>F2: Setup/configuration</li><li>F3: Search processes</li><li>F4: Filter processes</li><li>F5: Tree view</li><li>F6: Sort options</li><li>F9: Kill process</li><li>F10: Quit</li></ul><h3>ps - Process Status</h3><p>Display information about running processes.</p><p><strong>Common Usage Patterns:</strong></p><pre>bash</pre><pre># Show all processes for current user<br>ps</pre><pre># Show all processes with detailed info<br>ps aux</pre><pre># Show processes in tree format<br>ps auxf</pre><pre># Show processes for specific user<br>ps -u username</pre><pre># Show specific process by name<br>ps aux | grep nginx</pre><pre># Show process hierarchy<br>ps -ejH</pre><pre># Show processes with custom format<br>ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem</pre><h3>pgrep - Process Grep</h3><p>Find process IDs by name or other attributes.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Find process ID by name<br>pgrep nginx</pre><pre># Find processes with full command line matching<br>pgrep -f &quot;python.*django&quot;</pre><pre># Show process names along with PIDs<br>pgrep -l ssh</pre><pre># Find processes owned by specific user<br>pgrep -u www-data</pre><pre># Count number of processes<br>pgrep -c httpd</pre><h3>pstree - Process Tree</h3><p>Display processes in a tree format showing parent-child relationships.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Show full process tree<br>pstree</pre><pre># Show process tree for specific user<br>pstree username</pre><pre># Show process tree with PIDs<br>pstree -p</pre><pre># Show process tree with command line arguments<br>pstree -a</pre><pre># Show tree for specific process<br>pstree -p 1234</pre><h3>Network Analysis</h3><h3>netstat - Network Statistics</h3><p>Display network connections, routing tables, and interface statistics.</p><p><strong>Common Usage:</strong></p><pre>bash</pre><pre># Show all listening ports<br>netstat -tuln</pre><pre># Show all connections with process names<br>netstat -tulpn</pre><pre># Show only TCP connections<br>netstat -t</pre><pre># Show only UDP connections<br>netstat -u</pre><pre># Show routing table<br>netstat -rn</pre><pre># Show network interface statistics<br>netstat -i</pre><pre># Show connections for specific port<br>netstat -an | grep :80</pre><p><strong>Flag Meanings:</strong></p><ul><li>-t: TCP connections</li><li>-u: UDP connections</li><li>-l: Listening ports only</li><li>-n: Show numerical addresses</li><li>-p: Show process ID/name</li><li>-a: Show all connections</li></ul><h3>ss - Socket Statistics</h3><p>Modern replacement for netstat with more features and better performance.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Show all listening ports<br>ss -tuln</pre><pre># Show all connections with process info<br>ss -tulpn</pre><pre># Show only TCP connections<br>ss -t</pre><pre># Show connections in specific state<br>ss -t state established</pre><pre># Show connections to specific port<br>ss -an | grep :443</pre><pre># Show summary statistics<br>ss -s</pre><pre># Show connections with detailed info<br>ss -i</pre><pre># Filter connections by destination<br>ss dst 192.168.1.1</pre><h3>tcpdump - Packet Capture</h3><p>Capture and analyze network packets for troubleshooting.</p><p><strong>Basic Examples:</strong></p><pre>bash</pre><pre># Capture packets on specific interface<br>sudo tcpdump -i eth0</pre><pre># Capture packets to/from specific host<br>sudo tcpdump host google.com</pre><pre># Capture packets on specific port<br>sudo tcpdump port 80</pre><pre># Capture and save to file<br>sudo tcpdump -w capture.pcap</pre><pre># Read from saved file<br>tcpdump -r capture.pcap</pre><pre># Capture with timestamp and more verbose output<br>sudo tcpdump -tttt -v -i any</pre><pre># Capture HTTP traffic<br>sudo tcpdump -A -s 0 &#39;tcp port 80&#39;</pre><p><strong>Advanced Filtering:</strong></p><pre>bash</pre><pre># Capture only SYN packets<br>sudo tcpdump &#39;tcp[tcpflags] &amp; tcp-syn != 0&#39;</pre><pre># Capture traffic between two hosts<br>sudo tcpdump host 192.168.1.1 and host 192.168.1.2</pre><pre># Capture UDP DNS queries<br>sudo tcpdump -i any udp port 53</pre><h3>Network Connectivity Testing</h3><h3>ping - Test Network Connectivity</h3><p>Send ICMP echo requests to test reachability.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Basic ping<br>ping google.com</pre><pre># Ping with count limit<br>ping -c 4 google.com</pre><pre># Ping with specific interval<br>ping -i 2 google.com</pre><pre># Ping with specific packet size<br>ping -s 1024 google.com</pre><pre># IPv6 ping<br>ping6 google.com</pre><pre># Quiet mode (only summary)<br>ping -q -c 10 google.com</pre><h3>traceroute - Trace Network Path</h3><p>Show the route packets take to reach a destination.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Basic traceroute<br>traceroute google.com</pre><pre># Use UDP instead of ICMP<br>traceroute -U google.com</pre><pre># Set maximum hops<br>traceroute -m 15 google.com</pre><pre># IPv6 traceroute<br>traceroute6 google.com</pre><pre># Don&#39;t resolve hostnames<br>traceroute -n google.com</pre><h3>mtr - Network Diagnostic Tool</h3><p>Combines ping and traceroute functionality with continuous monitoring.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Interactive mode<br>mtr google.com</pre><pre># Report mode with specific count<br>mtr -r -c 10 google.com</pre><pre># No DNS resolution<br>mtr -n google.com</pre><pre># JSON output<br>mtr -j -c 5 google.com</pre><pre># CSV output<br>mtr -C -c 10 google.com</pre><h3>Disk Management</h3><h3>df - Disk Free Space</h3><p>Display filesystem disk space usage.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Show disk usage in human-readable format<br>df -h</pre><pre># Show only specific filesystem type<br>df -t ext4</pre><pre># Show inodes usage<br>df -i</pre><pre># Exclude specific filesystem types<br>df -x tmpfs -x devtmpfs</pre><pre># Show all filesystems including dummy ones<br>df -a</pre><pre># Show specific filesystem<br>df -h /var</pre><h3>du - Disk Usage</h3><p>Display directory space usage.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Show size of current directory<br>du -h</pre><pre># Show size of specific directory<br>du -h /var/log</pre><pre># Show only total size<br>du -sh /home/*</pre><pre># Show sizes sorted by size<br>du -sh /var/* | sort -hr</pre><pre># Show disk usage up to certain depth<br>du -h --max-depth=2 /var</pre><pre># Exclude specific patterns<br>du -h --exclude=&quot;*.log&quot; /var</pre><pre># Show apparent size vs disk usage<br>du -h --apparent-size /var/log</pre><h3>Memory Monitoring</h3><h3>free - Memory Usage</h3><p>Display memory and swap usage.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Basic memory info<br>free</pre><pre># Human-readable format<br>free -h</pre><pre># Show in MB<br>free -m</pre><pre># Show in GB<br>free -g</pre><pre># Continuous monitoring every 2 seconds<br>free -h -s 2</pre><pre># Show totals line<br>free -h -t</pre><h3>vmstat - Virtual Memory Statistics</h3><p>Report virtual memory statistics and system activity.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Basic vmstat<br>vmstat</pre><pre># Update every 2 seconds, 5 times<br>vmstat 2 5</pre><pre># Show in MB instead of KB<br>vmstat -S M</pre><pre># Show active/inactive memory<br>vmstat -a</pre><pre># Show disk statistics<br>vmstat -d</pre><pre># Show slab info<br>vmstat -m</pre><h3>System Logging</h3><h3>journalctl - Systemd Journal Viewer</h3><p>Query and display logs from the systemd journal.</p><p><strong>Basic Usage:</strong></p><pre>bash</pre><pre># Show all logs<br>journalctl</pre><pre># Show logs since boot<br>journalctl -b</pre><pre># Show logs for specific service<br>journalctl -u nginx</pre><pre># Follow logs in real-time<br>journalctl -f</pre><pre># Show logs from last hour<br>journalctl --since &quot;1 hour ago&quot;</pre><pre># Show logs for specific date range<br>journalctl --since &quot;2024-01-01&quot; --until &quot;2024-01-02&quot;</pre><p><strong>Advanced Examples:</strong></p><pre>bash</pre><pre># Show only error and critical messages<br>journalctl -p err</pre><pre># Show logs for specific user<br>journalctl _UID=1000</pre><pre># Show kernel messages<br>journalctl -k</pre><pre># Show logs in JSON format<br>journalctl -o json</pre><pre># Show logs with specific priority<br>journalctl -p warning..err</pre><pre># Show logs for specific executable<br>journalctl /usr/bin/ssh</pre><pre># Show logs in reverse chronological order<br>journalctl -r</pre><pre># Vacuum old logs (keep last 100MB)<br>sudo journalctl --vacuum-size=100M</pre><h3>File System Analysis</h3><h3>lsof - List Open Files</h3><p>Show which files are opened by which processes.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># List all open files<br>lsof</pre><pre># Show files opened by specific process<br>lsof -p 1234</pre><pre># Show processes using specific file<br>lsof /var/log/syslog</pre><pre># Show network connections<br>lsof -i</pre><pre># Show connections on specific port<br>lsof -i :80</pre><pre># Show files opened by specific user<br>lsof -u username</pre><pre># Show files in specific directory<br>lsof +D /var/log</pre><pre># Show processes using deleted files<br>lsof | grep deleted</pre><pre># Show IPv4 connections only<br>lsof -i4</pre><pre># Show files opened by process name<br>lsof -c nginx</pre><h3>Log Analysis</h3><h3>tail - View End of Files</h3><p>Display the last lines of files, useful for monitoring logs.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># Show last 10 lines (default)<br>tail /var/log/syslog</pre><pre># Show last 20 lines<br>tail -n 20 /var/log/syslog</pre><pre># Follow file in real-time<br>tail -f /var/log/syslog</pre><pre># Follow multiple files<br>tail -f /var/log/syslog /var/log/auth.log</pre><pre># Start from specific line number<br>tail -n +100 /var/log/syslog</pre><pre># Show last N bytes<br>tail -c 1024 /var/log/syslog</pre><h3>less - File Pager</h3><p>View file contents page by page with search capabilities.</p><p><strong>Examples:</strong></p><pre>bash</pre><pre># View file<br>less /var/log/syslog</pre><pre># View with line numbers<br>less -N /var/log/syslog</pre><pre># Case-insensitive search<br>less -i /var/log/syslog</pre><pre># Follow file like tail -f<br>less +F /var/log/syslog</pre><p><strong>Navigation Commands in </strong><strong>less:</strong></p><ul><li>/pattern - Search forward</li><li>?pattern - Search backward</li><li>n - Next match</li><li>N - Previous match</li><li>G - Go to end</li><li>g - Go to beginning</li><li>q - Quit</li></ul><h3>grep - Pattern Matching</h3><p>Search for patterns in files.</p><p><strong>Basic Examples:</strong></p><pre>bash</pre><pre># Search for pattern in file<br>grep &quot;error&quot; /var/log/syslog</pre><pre># Case-insensitive search<br>grep -i &quot;error&quot; /var/log/syslog</pre><pre># Show line numbers<br>grep -n &quot;error&quot; /var/log/syslog</pre><pre># Search recursively in directory<br>grep -r &quot;error&quot; /var/log/</pre><pre># Show context (lines before and after)<br>grep -C 3 &quot;error&quot; /var/log/syslog</pre><pre># Invert match (show lines NOT containing pattern)<br>grep -v &quot;info&quot; /var/log/syslog</pre><pre># Count matches<br>grep -c &quot;error&quot; /var/log/syslog</pre><pre># Show only filenames with matches<br>grep -l &quot;error&quot; /var/log/*</pre><p><strong>Advanced Examples:</strong></p><pre>bash</pre><pre># Use regular expressions<br>grep -E &quot;error|warning&quot; /var/log/syslog</pre><pre># Search for whole words only<br>grep -w &quot;error&quot; /var/log/syslog</pre><pre># Multiple patterns with OR<br>grep -E &quot;(failed|error|critical)&quot; /var/log/syslog</pre><pre># Search with color highlighting<br>grep --color=always &quot;error&quot; /var/log/syslog</pre><pre># Search in compressed files<br>zgrep &quot;error&quot; /var/log/syslog.gz</pre><h3>Common DevOps Scenarios</h3><h3>Monitor High CPU Usage</h3><pre>bash</pre><pre># Find processes consuming most CPU<br>top -o %CPU<br># or<br>ps aux --sort=-%cpu | head -10</pre><pre># Monitor specific process<br>top -p $(pgrep nginx)</pre><h3>Debug Network Issues</h3><pre>bash</pre><pre># Check listening services<br>ss -tulpn</pre><pre># Monitor network connections in real-time<br>watch -n 1 &#39;ss -tuln&#39;</pre><pre># Capture network traffic for analysis<br>sudo tcpdump -i any -w network_debug.pcap</pre><h3>Analyze Disk Space Issues</h3><pre>bash</pre><pre># Find largest directories<br>du -sh /var/* | sort -hr | head -10</pre><pre># Find large files<br>find /var -type f -size +100M -exec ls -lh {} \;</pre><pre># Monitor disk usage in real-time<br>watch -n 5 &#39;df -h&#39;</pre><h3>Troubleshoot Service Issues</h3><pre>bash</pre><pre># Check service status and recent logs<br>systemctl status nginx<br>journalctl -u nginx -n 50</pre><pre># Follow service logs in real-time<br>journalctl -u nginx -f</pre><pre># Check what files a service is using<br>lsof -c nginx</pre><h3>Memory Leak Investigation</h3><pre>bash</pre><pre># Monitor memory usage over time<br>while true; do free -h; sleep 5; done</pre><pre># Find memory-hungry processes<br>ps aux --sort=-%mem | head -10</pre><pre># Detailed memory analysis<br>cat /proc/meminfo</pre><p>This wiki serves as a comprehensive reference for essential Linux system administration commands used in DevOps work. Bookmark this page and refer to it when troubleshooting system issues, monitoring performance, or analyzing logs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6821fe3ff8f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>