<?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 Gadamsetti Rakesh on Medium]]></title>
        <description><![CDATA[Stories by Gadamsetti Rakesh on Medium]]></description>
        <link>https://medium.com/@gadamsettirakesh6?source=rss-994749ada411------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IxztXNY_E6oJIZ7izLeyLw.jpeg</url>
            <title>Stories by Gadamsetti Rakesh on Medium</title>
            <link>https://medium.com/@gadamsettirakesh6?source=rss-994749ada411------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:57:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gadamsettirakesh6/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[ Day 42 – Kubernetes Debugging Series]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-42-kubernetes-debugging-series-af3de184e9c5?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/af3de184e9c5</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[sre]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Thu, 03 Sep 2026 14:28:07 GMT</pubDate>
            <atom:updated>2026-09-03T14:36:36.635Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I4R-Uj81gAsFmw461-RfiQ.png" /></figure><h3>CPU Spike → Analyze Load</h3><p>A <strong>CPU spike</strong> in Kubernetes does not automatically mean that Kubernetes is broken.</p><p>It means that one or more workloads are consuming significantly more CPU than expected. The real job of a DevOps/SRE engineer is to determine:</p><blockquote><strong><em>Which workload is consuming CPU, why it is consuming CPU, whether the load is expected, and what action should be taken.</em></strong></blockquote><p>This guide starts from the basics, so someone new to Kubernetes can follow it step by step.</p><h3>1. First Understand What a CPU Spike Means</h3><p>Imagine your Kubernetes node normally looks like this:</p><pre>Normal CPU usage<br>     ↓<br>Node CPU = 25%<br>     ↓<br>Application running normally</pre><p>Suddenly:</p><pre>Traffic increases<br>      ↓<br>Application receives more requests<br>      ↓<br>CPU usage increases<br>      ↓<br>Node CPU = 95%<br>      ↓<br>Application becomes slow</pre><p>But increased traffic is <strong>only one possible cause</strong>.</p><p>A CPU spike can also happen because of:</p><ul><li>Sudden traffic increase</li><li>Application bug</li><li>Infinite loop</li><li>Inefficient code</li><li>Expensive database queries</li><li>Too many Pods on one node</li><li>CPU limits/throttling</li><li>Background jobs</li><li>Batch processing</li><li>Incorrect application configuration</li><li>Memory pressure causing unusual application behavior</li><li>A single Pod consuming excessive CPU</li></ul><p>So our objective is:</p><pre>CPU Spike<br>   ↓<br>Identify Node<br>   ↓<br>Identify Pod<br>   ↓<br>Identify Container<br>   ↓<br>Understand CPU usage<br>   ↓<br>Check application logs<br>   ↓<br>Check traffic<br>   ↓<br>Check resource requests/limits<br>   ↓<br>Check throttling<br>   ↓<br>Find root cause<br>   ↓<br>Fix<br>   ↓<br>Verify</pre><h3>2. Step 1 – Confirm That There Is Actually a CPU Spike</h3><p>Start with:</p><pre>kubectl top nodes</pre><p>Example:</p><pre>NAME       CPU(cores)   CPU%<br>worker-1   180m         9%<br>worker-2   1850m        92%<br>worker-3   210m         10%</pre><p>Here:</p><pre>worker-2 = 92%</pre><p>is suspicious.</p><h3>What does 1850m mean?</h3><p>Kubernetes CPU is commonly represented in millicores.</p><pre>1000m = 1 CPU core</pre><p>Therefore:</p><pre>1850m = 1.85 CPU cores</pre><p>So worker-2 is currently using approximately 1.85 CPU cores.</p><h3>3. Step 2 – Identify Which Node Is Under Pressure</h3><p>Run:</p><pre>kubectl get nodes</pre><p>Example:</p><pre>NAME       STATUS   ROLES<br>worker-1   Ready    &lt;none&gt;<br>worker-2   Ready    &lt;none&gt;<br>worker-3   Ready    &lt;none&gt;</pre><p>Now we know:</p><pre>worker-2<br>   ↓<br>High CPU</pre><p>But <strong>don&#39;t blame the node yet</strong>.</p><p>A Kubernetes node doesn&#39;t normally generate application CPU usage by itself.</p><p>We need to find which Pod is responsible.</p><h3>4. Step 3 – Find the Top CPU-Consuming Pods</h3><p>Run:</p><pre>kubectl top pods -A</pre><p>Example:</p><pre>NAMESPACE   NAME             CPU(cores)   MEMORY(bytes)<br>prod        frontend-7d8f    80m          120Mi<br>prod        payment-5f6d     950m         300Mi<br>prod        orders-8c9d      60m          150Mi<br>dev         test-app-123     20m          80Mi</pre><p>Here:</p><pre>payment-5f6d<br>CPU = 950m</pre><p>is consuming almost one CPU core.</p><p>Now our investigation becomes:</p><pre>Node<br> ↓<br>worker-2<br> ↓<br>Pod<br> ↓<br>payment-5f6d</pre><h3>5. Step 4 – Find the Container Consuming CPU</h3><p>A Pod can contain multiple containers.</p><p>Run:</p><pre>kubectl top pod payment-5f6d \<br>-n prod --containers</pre><p>Example:</p><pre>POD            NAME          CPU(cores)   MEMORY(bytes)<br>payment-5f6d   payment       850m         280Mi<br>payment-5f6d   sidecar       100m         50Mi</pre><p>Now we know:</p><pre>payment container<br>       ↓<br>850m CPU</pre><p>This is much more useful than simply saying:</p><blockquote><em>&quot;The node has high CPU.&quot;</em></blockquote><p>We have narrowed the problem down to a specific container.</p><h3>6. Step 5 – Check Where the Pod Is Running</h3><p>Run:</p><pre>kubectl get pod payment-5f6d \<br>-n prod -o wide</pre><p>Example:</p><pre>NAME          READY   STATUS    IP          NODE<br>payment-5f6d  1/1     Running   10.0.2.15   worker-2</pre><p>Now we have:</p><pre>worker-2<br>    ↓<br>payment-5f6d<br>    ↓<br>payment container<br>    ↓<br>850m CPU</pre><p>This confirms that the high-CPU Pod is actually running on the affected node.</p><h3>7. Step 6 – Check Whether the CPU Increase Is Expected</h3><p>This is an extremely important step.</p><p><strong>High CPU isn&#39;t necessarily an incident.</strong></p><p>Ask:</p><blockquote><em>Did traffic increase?</em></blockquote><p>For example:</p><pre>Normal traffic:<br>100 requests/sec<br><br>Current traffic:<br>500 requests/sec</pre><p>If traffic increased 5× and CPU increased accordingly, the application may simply be handling legitimate load.</p><p>Check your application monitoring system, such as:</p><ul><li>Prometheus</li><li>Grafana</li><li>CloudWatch</li><li>Application Performance Monitoring tools</li><li>Load balancer metrics</li></ul><p>Look for:</p><pre>Requests/sec<br>Latency<br>HTTP 4xx<br>HTTP 5xx<br>Active connections<br>Queue depth</pre><h3>8. Step 7 – Check Application Logs</h3><p>Now investigate what the application is doing.</p><p>Run:</p><pre>kubectl logs payment-5f6d -n prod</pre><p>For a continuously running log stream:</p><pre>kubectl logs -f payment-5f6d -n prod</pre><p>Look for patterns such as:</p><pre>Processing request<br>Retrying request<br>Database timeout<br>Connection timeout<br>Processing failed<br>Retry attempt 100</pre><h3>🚨 Interesting example</h3><p>Suppose logs show:</p><pre>Database connection timeout<br>Retrying...<br>Database connection timeout<br>Retrying...<br>Database connection timeout<br>Retrying...</pre><p>And CPU is extremely high.</p><p>That gives us a potential root cause:</p><pre>Database problem<br>      ↓<br>Application retries continuously<br>      ↓<br>CPU increases</pre><p>The CPU spike is therefore a <strong>symptom</strong>, not the original problem.</p><h3>9. Step 8 – Check for an Infinite Loop or Application Bug</h3><p>One dangerous CPU pattern is:</p><pre>CPU = 100%<br>Requests = normal</pre><p>If traffic hasn&#39;t increased but CPU suddenly reaches 100%, investigate the application itself.</p><p>Possible causes:</p><pre>Infinite loop<br>     ↓<br>Repeated calculations<br>     ↓<br>CPU continuously consumed</pre><p>For example:</p><pre>while(true) {<br>    processSomething();<br>}</pre><p>or a runaway background worker.</p><p>At this stage, Kubernetes commands alone may not reveal the complete root cause.</p><p>You may need:</p><ul><li>Application profiling</li><li>JVM profiling</li><li>Python profiling</li><li>Node.js profiling</li><li>Go profiling</li><li>APM traces</li><li>Application developer investigation</li></ul><h3>10. Step 9 – Check Pod CPU Requests and Limits</h3><p>Run:</p><pre>kubectl get pod payment-5f6d \<br>-n prod -o yaml</pre><p>Look for:</p><pre>resources:<br>  requests:<br>    cpu: &quot;250m&quot;<br>    memory: &quot;256Mi&quot;<br><br>  limits:<br>    cpu: &quot;1000m&quot;<br>    memory: &quot;512Mi&quot;</pre><p>Understand the difference:</p><h3>CPU request</h3><p>The CPU amount Kubernetes uses for scheduling decisions.</p><pre>request = 250m</pre><p>means the Pod requests 0.25 CPU.</p><h3>CPU limit</h3><p>The maximum CPU the container is allowed to consume.</p><pre>limit = 1000m<br></pre><p>means approximately 1 CPU core.</p><h3>11. Step 10 — Understand CPU Throttling</h3><p>This is an important production concept.</p><p>Suppose:</p><pre>CPU request = 500m<br>CPU limit   = 500m</pre><p>The application suddenly needs:</p><pre>900m</pre><p>But the limit is:</p><pre>500m</pre><p>The container can be CPU throttled.</p><p>Conceptually:</p><pre>Application wants 900m<br>        ↓<br>CPU limit = 500m<br>        ↓<br>Container throttled<br>        ↓<br>Application becomes slower</pre><p>Therefore:</p><blockquote><strong><em>High CPU + poor application performance does not always mean “give it more CPU.”</em></strong></blockquote><p>You need to determine whether the application is actually CPU-bound or being throttled.</p><p>For detailed CPU throttling analysis, use your monitoring system’s container CPU throttling metrics, such as Prometheus/cAdvisor metrics.</p><h3>12. Step 11 — Check the Deployment Configuration</h3><p>Instead of inspecting only the Pod, inspect the Deployment:</p><pre>kubectl get deployment payment \<br>-n prod -o yaml</pre><p>Check:</p><pre>resources:<br>  requests:<br>    cpu: &quot;250m&quot;<br>  limits:<br>    cpu: &quot;1000m&quot;</pre><p>Also check:</p><ul><li>Number of replicas</li><li>HPA</li><li>Deployment strategy</li><li>Container configuration</li><li>Environment variables</li></ul><h3>13. Step 12 — Check Whether HPA Is Working</h3><p>If your application is expected to scale automatically, check:</p><pre>kubectl get hpa -n prod</pre><p>Example:</p><pre>NAME      TARGETS    MINPODS   MAXPODS   REPLICAS<br>payment   85%/60%    2         10        2</pre><p>Here:</p><pre>Current = 85%<br>Target  = 60%</pre><p>The workload is above its target.</p><p>If replicas remain low, investigate HPA.</p><p>Run:</p><pre>kubectl describe hpa payment -n prod</pre><p>Check:</p><pre>Metrics<br>Conditions<br>Events</pre><h3>14. Step 13 — Check Metrics Availability</h3><p>Run:</p><pre>kubectl top pods -n prod</pre><p>If you get:</p><pre>Metrics API not available</pre><p>then your CPU analysis is already affected by a metrics problem.</p><p>Check:</p><pre>kubectl get pods -n kube-system | grep metrics-server</pre><p>Then:</p><pre>kubectl logs -n kube-system deployment/metrics-server</pre><p>This connects directly with your <strong>Day 40/41 troubleshooting topics</strong>:</p><pre>CPU spike<br>    ↓<br>Need CPU metrics<br>    ↓<br>Metrics Server<br>    ↓<br>HPA</pre><h3>15. Step 14 — Check the Node’s Allocatable CPU</h3><p>Run:</p><pre>kubectl describe node worker-2</pre><p>Look for:</p><pre>Capacity:<br>  cpu: 4</pre><pre>Allocatable:<br>  cpu: 3800m</pre><p>Then compare:</p><pre>Node capacity<br>      ↓<br>Node allocatable<br>      ↓<br>Pod requests<br>      ↓<br>Actual CPU consumption</pre><p>You need to understand whether the node is simply busy or genuinely overloaded.</p><h3>16. Step 15 — Check All Pods on the Node</h3><p>Run:</p><pre>kubectl get pods -A -o wide \<br>--field-selector spec.nodeName=worker-2</pre><p>This gives you the Pods running on the affected node.</p><p>Then:</p><pre>kubectl top pods -A</pre><p>Identify which workloads are consuming the CPU.</p><p>You may discover:</p><pre>worker-2<br> ├── payment       900m<br> ├── frontend      700m<br> ├── monitoring    200m<br> └── logging       150m</pre><p>Now the issue might not be one bad Pod.</p><p>It may be <strong>node-level workload concentration</strong>.</p><h3>17. Step 16 — Check Kubernetes Events</h3><p>Run:</p><pre>kubectl get events -A \<br>--sort-by=.metadata.creationTimestamp</pre><p>Look for:</p><pre>FailedScheduling<br>Evicted<br>BackOff<br>Unhealthy<br>Killing</pre><p>CPU pressure can sometimes be part of a larger node resource problem.</p><h3>18. Step 17 — Determine the Root Cause</h3><p>At this stage, classify the CPU spike.</p><h3>Scenario A — Traffic increased</h3><pre>Traffic ↑<br>   ↓<br>Requests ↑<br>   ↓<br>CPU ↑</pre><p>Possible solution:</p><pre>HPA<br>more replicas<br>capacity planning</pre><h3>Scenario B — Application bug</h3><pre>Traffic normal<br>   ↓<br>CPU suddenly ↑<br>   ↓<br>Application processing abnormal</pre><p>Possible solution:</p><pre>Code optimization<br>Bug fix<br>Application restart as temporary mitigation</pre><h3>Scenario C — CPU throttling</h3><pre>CPU demand ↑<br>   ↓<br>CPU limit reached<br>   ↓<br>Throttling<br>   ↓<br>Application latency ↑</pre><p>Possible solution:</p><pre>Review CPU limits<br>Review requests<br>Optimize application<br>Scale horizontally</pre><h3>Scenario D — Too many Pods on one node</h3><pre>Multiple workloads<br>       ↓<br>Same node<br>       ↓<br>Node CPU ↑</pre><p>Possible solution:</p><pre>Better scheduling<br>More nodes<br>Node autoscaling<br>Pod distribution</pre><h3>Scenario E — Background job</h3><pre>Scheduled job<br>     ↓<br>Heavy processing<br>     ↓<br>CPU spike</pre><p>Possible solution:</p><pre>Optimize job<br>Schedule during appropriate window<br>Use dedicated workers<br>Set appropriate resources</pre><h3>19. Step 18 — Apply the Correct Fix</h3><p>Don’t use the same solution for every CPU spike.</p><h3>If traffic is genuinely high:</h3><p>Use HPA:</p><pre>More traffic<br>     ↓<br>More CPU<br>     ↓<br>HPA<br>     ↓<br>More replicas</pre><h3>If the application is inefficient:</h3><p>Optimize the application.</p><h3>If CPU limits are too restrictive:</h3><p>Review resource configuration carefully.</p><h3>If the node is overloaded:</h3><p>Consider:</p><ul><li>More worker nodes</li><li>Cluster Autoscaler / Karpenter where appropriate</li><li>Better workload distribution</li><li>Pod anti-affinity</li><li>Topology spread constraints</li></ul><h3>If a runaway Pod is causing an incident:</h3><p>A restart can be a <strong>temporary mitigation</strong>, but it should not be considered the root-cause fix.</p><h3>20. Step 19 — Verify the Fix</h3><p>After making a change, don’t immediately close the incident.</p><p>Monitor:</p><pre>kubectl top nodes</pre><pre>kubectl top pods -A</pre><pre>kubectl get pods -A</pre><p>If HPA is involved:</p><pre>kubectl get hpa -A</pre><p>And:</p><pre>kubectl get hpa -A -w</pre><p>You want to see:</p><pre>CPU returns to normal<br>       ↓<br>Application latency improves<br>       ↓<br>Error rate decreases<br>       ↓<br>Pods remain healthy<br>       ↓<br>HPA behaves as expected</pre><h3>🧠 Complete CPU Spike Troubleshooting Flow</h3><pre>🚨 CPU SPIKE<br>                    │<br>                    ▼<br>           kubectl top nodes<br>                    │<br>                    ▼<br>        Identify high-CPU node<br>                    │<br>                    ▼<br>          kubectl top pods -A<br>                    │<br>                    ▼<br>        Identify high-CPU Pod<br>                    │<br>                    ▼<br>       kubectl top pod --containers<br>                    │<br>                    ▼<br>       Identify high-CPU container<br>                    │<br>          ┌─────────┴─────────┐<br>          ▼                   ▼<br>    Traffic increased?     Traffic normal?<br>          │                   │<br>         YES                  ▼<br>          │            Check application<br>          ▼                 logs<br>     Check HPA                 │<br>          │                    ▼<br>          ▼              Application bug?<br>   More replicas?          /        \<br>          │               YES        NO<br>          │                │          │<br>          ▼                ▼          ▼<br>    Check HPA         Fix code    Check limits<br>    configuration                  &amp; throttling<br>          │                           │<br>          └────────────┬──────────────┘<br>                       ▼<br>                Check node load<br>                       │<br>                       ▼<br>                 Apply fix<br>                       │<br>                       ▼<br>                  Monitor<br>                       │<br>                       ▼<br>                 Verify CPU<br>                       │<br>                       ▼<br>                  ✅ Resolved</pre><h3>🔥 Production Troubleshooting Checklist</h3><p>Use this checklist whenever you receive a CPU alert:</p><pre># 1. Check nodes<br>kubectl top nodes</pre><pre># 2. Check all Pods<br>kubectl top pods -A</pre><pre># 3. Check individual containers<br>kubectl top pod &lt;pod&gt; -n &lt;namespace&gt; --containers</pre><pre># 4. Find Pod location<br>kubectl get pod &lt;pod&gt; -n &lt;namespace&gt; -o wide</pre><pre># 5. Check logs<br>kubectl logs &lt;pod&gt; -n &lt;namespace&gt;</pre><pre># 6. Check previous container logs if it restarted<br>kubectl logs &lt;pod&gt; -n &lt;namespace&gt; --previous</pre><pre># 7. Check resource configuration<br>kubectl get pod &lt;pod&gt; -n &lt;namespace&gt; -o yaml</pre><pre># 8. Check Deployment<br>kubectl get deployment &lt;deployment&gt; -n &lt;namespace&gt; -o yaml</pre><pre># 9. Check HPA<br>kubectl get hpa -n &lt;namespace&gt;<br>kubectl describe hpa &lt;hpa&gt; -n &lt;namespace&gt;</pre><pre># 10. Check node<br>kubectl describe node &lt;node&gt;</pre><pre># 11. Check Pods running on node<br>kubectl get pods -A -o wide \<br>  --field-selector spec.nodeName=&lt;node&gt;</pre><pre># 12. Check events<br>kubectl get events -A \<br>  --sort-by=.metadata.creationTimestamp</pre><h3>🎯 The Most Important Lesson</h3><p>When someone tells you:</p><blockquote><strong><em>“CPU is high.”</em></strong></blockquote><p>Don’t immediately say:</p><blockquote><em>“Increase the CPU.”</em></blockquote><p>Instead ask:</p><pre>WHO?<br> ↓<br>Which node?<br> ↓<br>Which Pod?<br> ↓<br>Which container?</pre><pre>WHY?<br> ↓<br>Traffic?<br> ↓<br>Application bug?<br> ↓<br>Background job?<br> ↓<br>CPU throttling?<br> ↓<br>Too many workloads?</pre><pre>WHAT NEXT?<br> ↓<br>Scale?<br> ↓<br>Optimize?<br> ↓<br>Change resources?<br> ↓<br>Add nodes?</pre><p>That’s the difference between <strong>monitoring a CPU spike</strong> and actually <strong>troubleshooting the root cause</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af3de184e9c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 41 — Metrics Server Issue → Debug & Reinstall]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-41-metrics-server-issue-debug-reinstall-505ef5f34969?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/505ef5f34969</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 08:10:54 GMT</pubDate>
            <atom:updated>2026-08-31T08:10:54.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4b7zXQZ0kg-d6NE8MLm0w.png" /></figure><h3>🎯 Scenario</h3><p>Your Kubernetes cluster is running, but resource metrics are unavailable:</p><pre>kubectl top nodes</pre><p>Output:</p><pre>error: Metrics API not available</pre><p>And:</p><pre>kubectl top pods -A</pre><p>returns:</p><pre>error: Metrics API not available</pre><p>This can impact <strong>HPA</strong>, resource monitoring, and commands such as kubectl top.</p><h3>🔍 Step 1 — Confirm the Problem</h3><p>First, check whether Metrics Server is installed.</p><pre>kubectl get deployment metrics-server -n kube-system</pre><p>If it exists:</p><pre>kubectl get pods -n kube-system | grep metrics-server</pre><p>Example:</p><pre>metrics-server-7f8c7d6f8d-x7k2m   0/1   CrashLoopBackOff</pre><p>or:</p><pre>metrics-server-7f8c7d6f8d-x7k2m   1/1   Running</pre><p>Even if the pod is Running, the Metrics API can still be unhealthy.</p><h3>🔎 Step 2 — Check Metrics Server Logs</h3><p>Check the logs:</p><pre>kubectl logs -n kube-system deployment/metrics-server</pre><p>Look for errors such as:</p><pre>unable to fully scrape metrics</pre><p>or:</p><pre>x509: cannot validate certificate</pre><p>or:</p><pre>context deadline exceeded</pre><p>These errors help determine whether the problem is with:</p><ul><li>Kubelet connectivity</li><li>TLS certificates</li><li>Network connectivity</li><li>Metrics Server configuration</li><li>API aggregation</li></ul><h3>🔎 Step 3 — Describe the Pod</h3><pre>kubectl describe pod -n kube-system -l k8s-app=metrics-server</pre><p>Check:</p><pre>Events:</pre><p>Look for:</p><pre>Failed<br>Back-off restarting container<br>Unhealthy<br>Readiness probe failed</pre><p>This is important because logs show application-level errors, while describe can reveal Kubernetes-level problems.</p><h3>🔎 Step 4 — Check the Metrics API</h3><p>Run:</p><pre>kubectl get apiservice | grep metrics</pre><p>Expected:</p><pre>v1beta1.metrics.k8s.io   kube-system/metrics-server   True</pre><p>If you see:</p><pre>False</pre><p>then the Metrics API is not healthy.</p><p>Get more details:</p><pre>kubectl describe apiservice v1beta1.metrics.k8s.io</pre><p>Pay special attention to:</p><pre>Status:<br>  Conditions:</pre><p>For example:</p><pre>Reason: FailedDiscoveryCheck</pre><p>This indicates an API aggregation/discovery problem.</p><h3>🔎 Step 5 — Check Metrics Server Service</h3><pre>kubectl get svc -n kube-system metrics-server</pre><p>Then:</p><pre>kubectl get endpoints -n kube-system metrics-server</pre><p>You should see endpoints associated with the Metrics Server pod.</p><p>If there are <strong>no endpoints</strong>, investigate the Service selector and pod labels.</p><pre>kubectl describe svc metrics-server -n kube-system</pre><h3>🔎 Step 6 — Check the Deployment Configuration</h3><pre>kubectl get deployment metrics-server -n kube-system -o yaml</pre><p>Check the container arguments:</p><pre>args:<br>  - --cert-dir=/tmp<br>  - --secure-port=10250<br>  - --kubelet-preferred-address-types=InternalIP,Hostname,ExternalIP</pre><p>A common lab/cluster troubleshooting option when kubelet certificate validation causes scraping failures is:</p><pre>- --kubelet-insecure-tls</pre><p>⚠️ <strong>Important:</strong> Don’t blindly add --kubelet-insecure-tls in production. It disables kubelet certificate verification and should be treated as a troubleshooting/workaround option. Prefer fixing the underlying certificate configuration when possible.</p><h3>🔎 Step 7 — Check Node/Kubelet Health</h3><p>Metrics Server collects resource information from kubelets.</p><p>Check nodes:</p><pre>kubectl get nodes -o wide</pre><p>Then:</p><pre>kubectl describe node &lt;node-name&gt;</pre><p>Check whether the node is:</p><pre>Ready</pre><p>Also verify that kubelet is healthy on the node.</p><p>For systems using systemd:</p><pre>systemctl status kubelet</pre><p>And:</p><pre>journalctl -u kubelet --since &quot;30 min ago&quot;</pre><h3>🛠️ Step 8 — If Metrics Server Is Broken, Reinstall It</h3><p>Before reinstalling, capture the existing configuration if this is a production cluster.</p><p>Remove the existing Metrics Server:</p><pre>kubectl delete deployment metrics-server -n kube-system</pre><p>You may also need to remove its Service/APIService depending on how it was installed.</p><p>Check:</p><pre>kubectl get all -n kube-system | grep metrics-server</pre><p>Then install a version compatible with your Kubernetes version.</p><p>For example, using the official Metrics Server installation manifest:</p><pre>kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml</pre><p><strong>For production, pin a tested Metrics Server release rather than using </strong><strong>latest.</strong></p><h3>🔎 Step 9 — Verify the New Deployment</h3><pre>kubectl get pods -n kube-system | grep metrics-server</pre><p>Expected:</p><pre>metrics-server-xxxxx   1/1   Running</pre><p>Then:</p><pre>kubectl get deployment metrics-server -n kube-system</pre><p>Expected:</p><pre>READY   UP-TO-DATE   AVAILABLE<br>1/1     1            1</pre><h3>🔎 Step 10 — Verify the APIService</h3><pre>kubectl get apiservice v1beta1.metrics.k8s.io</pre><p>Expected:</p><pre>True</pre><p>You can also check:</p><pre>kubectl describe apiservice v1beta1.metrics.k8s.io</pre><p>Make sure there are no discovery errors.</p><h3>🧪 Step 11 — Test kubectl top</h3><p>Now run:</p><pre>kubectl top nodes</pre><p>Expected:</p><pre>NAME            CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%<br>worker-node-1   120m         6%     1200Mi          30%<br>worker-node-2   90m          4%     980Mi           24%</pre><p>Then:</p><pre>kubectl top pods -A</pre><p>You should now receive CPU and memory metrics.</p><h3>🚀 Step 12 — Verify HPA</h3><p>Metrics Server is commonly required for CPU/memory-based HPA.</p><p>Check:</p><pre>kubectl get hpa -A</pre><p>Then:</p><pre>kubectl describe hpa &lt;hpa-name&gt; -n &lt;namespace&gt;</pre><p>Look for:</p><pre>Metrics:<br>  Resource memory on pods:</pre><p>If metrics are available, HPA should be able to evaluate resource utilization.</p><h3>🧠 Troubleshooting Flow</h3><pre>kubectl top nodes<br>                       │<br>                       ▼<br>              Metrics unavailable?<br>                       │<br>                       ▼<br>          Check Metrics Server Pod<br>                       │<br>          ┌────────────┴────────────┐<br>          ▼                         ▼<br>      Pod failed                 Pod Running<br>          │                         │<br>          ▼                         ▼<br>     Check logs             Check APIService<br>          │                         │<br>          ▼                         ▼<br>   Check configuration       True / False?<br>          │                         │<br>          ▼                         ▼<br>    Check kubelet             Check Service<br>                                    │<br>                                    ▼<br>                              Check Endpoints<br>                                    │<br>                                    ▼<br>                           Check kubelet/TLS<br>                                    │<br>                                    ▼<br>                         Reinstall if necessary<br>                                    │<br>                                    ▼<br>                           kubectl top nodes<br>                                    │<br>                                    ▼<br>                               SUCCESS</pre><h3>⚠️ Common Root Causes</h3><p>SymptomPossible CauseMetrics API not availableMetrics Server/APIService problemMetrics Server CrashLoopBackOffConfiguration/runtime issuex509 errorsKubelet TLS/certificate issuecontext deadline exceededNetwork/connectivity problemAPIService FalseAPI aggregation/discovery problemNo Service endpointsSelector/pod-label mismatchMetrics Server Running but no metricsKubelet scraping issueHPA shows &lt;unknown&gt;Metrics unavailablekubectl top works after reinstallBroken/outdated Metrics Server installation</p><h3>🎯 Key Takeaway</h3><p><strong>Don’t immediately reinstall Metrics Server.</strong></p><p>A better Kubernetes troubleshooting approach is:</p><p><strong>Symptom → Pod → Logs → APIService → Service → Endpoints → Kubelet → Configuration → Reinstall → Verify</strong></p><p>That demonstrates actual production troubleshooting skills rather than simply knowing the installation command.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=505ef5f34969" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Day 40 — Kubernetes Debugging Series]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-40-kubernetes-debugging-series-c8b104da12ba?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8b104da12ba</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 07:27:21 GMT</pubDate>
            <atom:updated>2026-08-31T07:45:34.102Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hznnxfAa35cNcvUH4KwbDA.png" /></figure><h3>HPA Not Scaling → Metrics Missing</h3><p>A very common Kubernetes production issue:</p><blockquote><strong><em>Application load increases, but HPA does not increase the number of Pods.</em></strong></blockquote><p>As a Kubernetes/DevOps engineer, I would <strong>not immediately modify the HPA or restart Pods</strong>. First, I would identify whether the problem is with <strong>metrics collection, HPA configuration, or the workload itself</strong>.</p><h3>🎯 Production Scenario</h3><p>Suppose we have:</p><pre>Deployment: webapp<br>Min Replicas: 2<br>Max Replicas: 10<br>CPU Target: 50%</pre><p>But:</p><pre>kubectl get hpa</pre><p>shows:</p><pre>NAME     TARGETS         MINPODS   MAXPODS   REPLICAS<br>webapp   &lt;unknown&gt;/50%   2         10        2</pre><p>The important clue is:</p><pre>&lt;unknown&gt;/50%</pre><p>This usually means the HPA cannot obtain the required resource metrics.</p><h3>🔍 Troubleshooting Flow</h3><p>Use this production troubleshooting sequence:</p><pre>HPA Not Scaling<br>      ↓<br>Check HPA<br>      ↓<br>Check HPA Events<br>      ↓<br>kubectl top pods<br>      ↓<br>Metrics API<br>      ↓<br>Metrics Server<br>      ↓<br>Metrics Server Logs<br>      ↓<br>Kubelet Connectivity<br>      ↓<br>Pod Resource Requests<br>      ↓<br>HPA Configuration<br>      ↓<br>Generate Load<br>      ↓<br>Verify Scaling</pre><h3>1️⃣ Check the HPA</h3><p>Start with:</p><pre>kubectl get hpa</pre><p>Example:</p><pre>NAME     TARGETS         MINPODS   MAXPODS   REPLICAS<br>webapp   &lt;unknown&gt;/50%   2         10        2</pre><h3>🚨 Problem</h3><pre>&lt;unknown&gt;/50%</pre><p>The HPA wants to use 50% CPU, but it cannot currently obtain the CPU metric.</p><h3>2️⃣ Describe the HPA</h3><p>Run:</p><pre>kubectl describe hpa webapp</pre><p>Pay close attention to:</p><pre>Metrics:<br>Conditions:<br>Events:</pre><p>You may find:</p><pre>Warning  FailedGetResourceMetric<br>unable to get metrics for resource cpu</pre><p>or:</p><pre>FailedGetResourceMetric<br>failed to get cpu utilization</pre><p>This tells us that the HPA is having trouble obtaining the metric.</p><h3>🔑 Senior-level approach</h3><p>Don’t stop here.</p><p>Now move <strong>down the metrics pipeline</strong>.</p><h3>3️⃣ Check kubectl top</h3><p>Run:</p><pre>kubectl top pods</pre><p>And:</p><pre>kubectl top nodes</pre><h3>Healthy example</h3><pre>NAME       CPU(cores)   MEMORY(bytes)<br>webapp-1   35m          80Mi<br>webapp-2   42m          85Mi</pre><h3>Problem example</h3><pre>error: Metrics API not available</pre><p>If kubectl top cannot retrieve metrics, the HPA cannot reliably use those resource metrics either.</p><h3>4️⃣ Check the Metrics API</h3><p>Run:</p><pre>kubectl get apiservice | grep metrics</pre><p>You should find:</p><pre>v1beta1.metrics.k8s.io</pre><p>Now inspect it:</p><pre>kubectl describe apiservice v1beta1.metrics.k8s.io</pre><p>Look for:</p><pre>Available: True</pre><h3>🚨 If you find:</h3><pre>Available: False</pre><p>the Metrics API is unhealthy or unavailable.</p><p>At this point, investigate the Metrics Server.</p><h3>5️⃣ Check Metrics Server</h3><p>Run:</p><pre>kubectl get pods -n kube-system | grep metrics-server</pre><p>Healthy:</p><pre>metrics-server-xxxxx   1/1   Running</pre><p>Possible problems:</p><pre>CrashLoopBackOff<br>ImagePullBackOff<br>Pending<br>Error<br>0/1</pre><p>If the Metrics Server isn’t healthy, HPA resource metrics can fail.</p><h3>6️⃣ Describe the Metrics Server Pod</h3><p>Run:</p><pre>kubectl describe pod -n kube-system &lt;metrics-server-pod&gt;</pre><p>Check the <strong>Events</strong> section.</p><p>Look for:</p><pre>FailedScheduling<br>Readiness probe failed<br>Liveness probe failed<br>Back-off restarting container<br>Failed to pull image</pre><p>This helps determine whether the problem is:</p><ul><li>Pod scheduling</li><li>Container startup</li><li>Image</li><li>Readiness</li><li>Configuration</li></ul><h3>7️⃣ Check Metrics Server Logs</h3><p>This is one of the most important debugging steps.</p><pre>kubectl logs -n kube-system deployment/metrics-server</pre><p>Look for errors such as:</p><pre>Failed to scrape node</pre><pre>x509: certificate signed by unknown authority</pre><pre>connection refused</pre><pre>context deadline exceeded</pre><pre>i/o timeout</pre><p>These errors can point toward:</p><ul><li>Kubelet connectivity</li><li>TLS/certificate problems</li><li>Network problems</li><li>Node issues</li><li>Metrics Server configuration problems</li></ul><h3>8️⃣ Check Metrics Server Service</h3><p>Run:</p><pre>kubectl get svc -n kube-system metrics-server</pre><p>Then:</p><pre>kubectl describe svc -n kube-system metrics-server</pre><p>Check:</p><pre>Selector<br>Port<br>TargetPort<br>Endpoints</pre><p>Also verify endpoints:</p><pre>kubectl get endpoints -n kube-system metrics-server</pre><p>If there are no valid endpoints, investigate the Metrics Server Pod and Service selector.</p><h3>9️⃣ Test the Metrics API Directly</h3><p>Run:</p><pre>kubectl get --raw &quot;/apis/metrics.k8s.io/v1beta1/nodes&quot;</pre><p>And:</p><pre>kubectl get --raw &quot;/apis/metrics.k8s.io/v1beta1/pods&quot;</pre><h3>Healthy</h3><p>You should receive JSON containing metrics.</p><h3>Failure</h3><p>You may receive:</p><pre>the server is currently unable to handle the request</pre><p>or:</p><pre>metrics API not available</pre><p>This confirms the problem is below the HPA layer.</p><h3>🔟 Check Node Health</h3><p>Run:</p><pre>kubectl get nodes</pre><p>Expected:</p><pre>NAME       STATUS   ROLES<br>worker-1   Ready    &lt;none&gt;<br>worker-2   Ready    &lt;none&gt;</pre><p>If nodes are NotReady, investigate them.</p><p>Run:</p><pre>kubectl describe node &lt;node-name&gt;</pre><p>Check conditions such as:</p><pre>MemoryPressure<br>DiskPressure<br>PIDPressure<br>NetworkUnavailable</pre><p>A node/kubelet problem can prevent metrics from being collected correctly.</p><h3>1️⃣1️⃣ Check Kubelet Metrics</h3><p>Metrics Server obtains resource metrics from kubelets.</p><p>Conceptually:</p><pre>Pod<br> ↓<br>Container Runtime<br> ↓<br>Kubelet<br> ↓<br>Metrics Server<br> ↓<br>Metrics API<br> ↓<br>HPA</pre><p>For a specific node, you can investigate the kubelet resource metrics endpoint:</p><pre>kubectl get --raw &quot;/api/v1/nodes/&lt;NODE_NAME&gt;/proxy/metrics/resource&quot;</pre><p>For example:</p><pre>kubectl get --raw &quot;/api/v1/nodes/worker-1/proxy/metrics/resource&quot;</pre><p>If this fails for a node, investigate the kubelet/node rather than changing the HPA.</p><h3>1️⃣2️⃣ Check Metrics Server → Kubelet Connectivity</h3><p>Metrics Server must communicate with the kubelets.</p><p>Investigate:</p><pre>Metrics Server<br>       ↓<br>    Kubelet<br>       ↓<br>      Node</pre><p>Possible causes:</p><ul><li>Network connectivity</li><li>Firewall/security rules</li><li>Incorrect node address</li><li>TLS/certificate problem</li><li>Kubelet unavailable</li><li>Network policy</li></ul><p>For AWS/EKS environments, also investigate the relevant networking/security configuration.</p><p><strong>Don’t blindly open ports or change security groups. First confirm the error from Metrics Server logs.</strong></p><h3>1️⃣3️⃣ Check Pod CPU Requests</h3><p>This is an important HPA check that is often missed.</p><p>Run:</p><pre>kubectl get deployment webapp -o yaml</pre><p>Look for:</p><pre>resources:<br>  requests:<br>    cpu: &quot;100m&quot;<br>    memory: &quot;128Mi&quot;</pre><p>For a CPU utilization target, HPA uses CPU usage relative to the requested CPU.</p><p>Example:</p><pre>CPU request = 100m<br>Current CPU = 80m</pre><pre>Utilization = 80%</pre><p>If HPA target is:</p><pre>50%</pre><p>then the workload is above the target.</p><h3>⚠️ Important</h3><p>If you’re using CPU utilization-based HPA, make sure the relevant containers have appropriate CPU requests.</p><h3>1️⃣4️⃣ Verify HPA Configuration</h3><p>Run:</p><pre>kubectl get hpa webapp -o yaml</pre><p>Example:</p><pre>apiVersion: autoscaling/v2<br>kind: HorizontalPodAutoscaler<br>metadata:<br>  name: webapp<br>spec:<br>  scaleTargetRef:<br>    apiVersion: apps/v1<br>    kind: Deployment<br>    name: webapp</pre><pre>  minReplicas: 2<br>  maxReplicas: 10</pre><pre>  metrics:<br>  - type: Resource<br>    resource:<br>      name: cpu<br>      target:<br>        type: Utilization<br>        averageUtilization: 50</pre><p>Verify:</p><pre>scaleTargetRef<br>minReplicas<br>maxReplicas<br>metrics<br>target</pre><h3>1️⃣5️⃣ Verify the HPA Target</h3><p>Make sure the HPA is targeting the correct Deployment.</p><pre>kubectl describe hpa webapp</pre><p>Check:</p><pre>Reference:</pre><p>It should point to:</p><pre>Deployment/webapp</pre><p>Then:</p><pre>kubectl get deployment webapp</pre><p>Make sure the Deployment exists and its Pods are healthy.</p><h3>1️⃣6️⃣ Check HPA Events</h3><p>Run again:</p><pre>kubectl describe hpa webapp</pre><p>Look at:</p><pre>Events:</pre><p>Common messages include:</p><pre>FailedGetResourceMetric</pre><pre>FailedComputeMetricsReplicas</pre><pre>FailedGetPodsMetric</pre><p>These messages help identify whether the failure is related to:</p><pre>Metric collection<br>      ↓<br>Metric calculation<br>      ↓<br>Pod selection<br>      ↓<br>Scaling decision</pre><h3>1️⃣7️⃣ Generate Controlled Load</h3><p>Once the metrics pipeline is healthy, test scaling.</p><p>For example:</p><pre>kubectl run load-generator \<br>  --image=busybox \<br>  --restart=Never \<br>  -- /bin/sh -c \<br>  &quot;while true; do wget -q -O- http://webapp; done&quot;</pre><p>Then watch:</p><pre>kubectl get hpa -w</pre><p>And:</p><pre>kubectl get pods -w</pre><p>Also:</p><pre>kubectl top pods</pre><p>You should see:</p><pre>CPU increases<br>     ↓<br>Metrics Server collects metrics<br>     ↓<br>HPA reads metrics<br>     ↓<br>HPA calculates desired replicas<br>     ↓<br>Deployment scales</pre><h3>1️⃣8️⃣ Verify Scaling</h3><p>Run:</p><pre>kubectl get hpa</pre><p>Before:</p><pre>TARGETS<br>&lt;unknown&gt;/50%</pre><p>After metrics become available:</p><pre>TARGETS<br>75%/50%</pre><p>You may then see:</p><pre>REPLICAS<br>4</pre><p>instead of:</p><pre>2</pre><p>Check:</p><pre>kubectl get deployment webapp</pre><p>and:</p><pre>kubectl get pods</pre><h3>🚨 Important: HPA Not Scaling Doesn’t Always Mean HPA Is Broken</h3><p>Consider:</p><pre>Current CPU = 35%<br>HPA Target  = 50%</pre><p>The HPA may correctly remain at:</p><pre>2 replicas</pre><p>That’s expected behavior.</p><p>So always distinguish between:</p><h3>Case 1 — Metrics missing</h3><pre>&lt;unknown&gt;/50%</pre><p>➡️ Investigate Metrics API/Metrics Server.</p><h3>Case 2 — Metrics available but below target</h3><pre>35%/50%</pre><p>➡️ HPA may be working correctly.</p><h3>Case 3 — Metrics available and above target</h3><pre>80%/50%</pre><p>but replicas don’t increase.</p><p>➡️ Investigate HPA configuration, target workload, scaling conditions, and HPA events.</p><h3>🧠 Senior DevOps Root-Cause Matrix</h3><p>SymptomInvestigation&lt;unknown&gt;/50%Metrics unavailablekubectl top failsMetrics API/Metrics ServerMetrics Server not RunningMetrics Server PodAPIService Available: FalseMetrics API/aggregationFailed to scrape nodeKubelet connectivityx509 errorTLS/certificatetimeoutNetwork/connectivityNo Metrics Server endpointsService/Pod configurationMetrics available but no scaleHPA configuration/loadCPU below targetScaling may not be requiredMissing CPU requestsFix workload resource configuration</p><h3>🔥 Complete Troubleshooting Flow</h3><pre>HPA NOT SCALING<br>                    │<br>                    ▼<br>            kubectl get hpa<br>                    │<br>                    ▼<br>          TARGET = &lt;unknown&gt;?<br>             /            \<br>           YES             NO<br>            │               │<br>            ▼               ▼<br>     Check Metrics API   Check HPA target<br>            │               │<br>            ▼               ▼<br>   Check Metrics Server  Check CPU/load<br>            │               │<br>            ▼               ▼<br>       Check logs       Check Deployment<br>            │<br>            ▼<br>       Check APIService<br>            │<br>            ▼<br>       Check Kubelets<br>            │<br>            ▼<br>     Check Network/TLS<br>            │<br>            ▼<br>    Check Resource Requests<br>            │<br>            ▼<br>      Fix root cause<br>            │<br>            ▼<br>       kubectl top<br>            │<br>            ▼<br>        HPA receives<br>          metrics<br>            │<br>            ▼<br>       Generate load<br>            │<br>            ▼<br>      HPA calculates<br>        replicas<br>            │<br>            ▼<br>     Deployment scales<br>            │<br>            ▼<br>         Pods ↑</pre><h3>🛠️ Quick Command Checklist</h3><p>Keep this section for your production troubleshooting notes:</p><pre># HPA<br>kubectl get hpa<br>kubectl describe hpa &lt;hpa-name&gt;<br>kubectl get hpa &lt;hpa-name&gt; -o yaml</pre><pre># Metrics<br>kubectl top pods<br>kubectl top nodes</pre><pre># Metrics Server<br>kubectl get pods -n kube-system | grep metrics-server<br>kubectl describe pod -n kube-system &lt;metrics-server-pod&gt;<br>kubectl logs -n kube-system deployment/metrics-server</pre><pre># Metrics API<br>kubectl get apiservice | grep metrics<br>kubectl describe apiservice v1beta1.metrics.k8s.io</pre><pre># Raw Metrics API<br>kubectl get --raw &quot;/apis/metrics.k8s.io/v1beta1/nodes&quot;<br>kubectl get --raw &quot;/apis/metrics.k8s.io/v1beta1/pods&quot;</pre><pre># Nodes<br>kubectl get nodes<br>kubectl describe node &lt;node-name&gt;</pre><pre># Events<br>kubectl get events -A \<br>  --sort-by=.metadata.creationTimestamp</pre><pre># Workload<br>kubectl get deployment &lt;deployment-name&gt; -o yaml</pre><h3>🎯 Production Best Practices</h3><h3>✅ 1. Don’t restart everything</h3><p>First collect evidence.</p><pre>Observe → Identify → Diagnose → Fix → Verify</pre><h3>✅ 2. Don’t reinstall Metrics Server immediately</h3><p>First check:</p><pre>Pod<br>Logs<br>APIService<br>Kubelet<br>Network<br>TLS<br>Configuration<br>Version compatibility</pre><h3>✅ 3. Always check kubectl top</h3><p>It’s one of the quickest ways to determine whether resource metrics are available.</p><h3>✅ 4. Define resource requests</h3><p>For CPU-based utilization HPA, resource requests are particularly important.</p><h3>✅ 5. Test HPA before production</h3><p>Generate controlled load in a test environment and verify:</p><pre>Metrics → HPA → Deployment → Pods</pre><h3>💡 Senior DevOps Interview Answer</h3><p>If an interviewer asks:</p><p><strong>“HPA is not scaling. How will you troubleshoot it?”</strong></p><p>You can answer:</p><blockquote><em>“First, I would check </em><em>kubectl get hpa and </em><em>kubectl describe hpa to determine whether the target metric is available and inspect HPA events. If the target shows </em><em>&lt;unknown&gt;, I would check </em><em>kubectl top pods and </em><em>kubectl top nodes to verify resource metrics. If metrics are unavailable, I would investigate the Metrics Server Pod, its logs, the </em><em>metrics.k8s.io APIService, Service endpoints, and Metrics Server connectivity to the kubelets. I would then verify the node and kubelet health, including network and TLS issues. After the metrics pipeline is healthy, I would check the HPA configuration, target Deployment, and CPU resource requests. Finally, I would generate controlled load and monitor the HPA and Deployment to confirm that replicas increase as expected.&quot;</em></blockquote><p>That’s a much stronger answer than simply saying <strong>“I will restart Metrics Server.”</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8b104da12ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Day 39 — Kubernetes Debugging Series]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-39-kubernetes-debugging-series-fa092adb2791?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa092adb2791</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 03:28:15 GMT</pubDate>
            <atom:updated>2026-08-19T03:28:15.958Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fzmUB0YHvA3s-_D5gguPKA.png" /></figure><h3>StatefulSet Restart → Storage Issue</h3><h3>📌 Production Scenario</h3><p>A database application is running as a Kubernetes StatefulSet.</p><p>For example:</p><pre>mysql-0<br>mysql-1<br>mysql-2</pre><p>The application was working normally.</p><p>After a Pod restart, node restart, deployment change, or maintenance activity, the Pod gets stuck:</p><pre>kubectl get pods</pre><p>Output:</p><pre>NAME      READY   STATUS              RESTARTS<br>mysql-0   0/1     ContainerCreating   0<br>mysql-1   1/1     Running             0<br>mysql-2   1/1     Running             0</pre><p>You suspect:</p><blockquote><em>“The application restarted, but the storage was not mounted correctly.”</em></blockquote><p>This needs to be investigated carefully because <strong>StatefulSet storage contains persistent application data</strong>.</p><h3>🧠 Understand StatefulSet Storage First</h3><p>A typical StatefulSet architecture looks like:</p><pre>StatefulSet<br>                     │<br>        ┌────────────┼────────────┐<br>        ↓            ↓            ↓<br>      mysql-0      mysql-1      mysql-2<br>        │            │            │<br>       PVC          PVC          PVC<br>        │            │            │<br>       PV           PV           PV<br>        │            │            │<br>        └────────────┼────────────┘<br>                     ↓<br>              Cloud Storage<br>               EBS / Disk</pre><p>The important concept is:</p><blockquote><strong><em>Each StatefulSet Pod normally gets stable identity and persistent storage.</em></strong></blockquote><p>For example:</p><pre>mysql-0 → mysql-0 storage<br>mysql-1 → mysql-1 storage<br>mysql-2 → mysql-2 storage</pre><p>Therefore, when mysql-0 restarts, Kubernetes should normally reconnect it to its persistent storage.</p><h3>🔎 Step 1 — Identify the Problem</h3><p>Start with:</p><pre>kubectl get pods</pre><p>Example:</p><pre>NAME      READY   STATUS              RESTARTS<br>mysql-0   0/1     ContainerCreating   0<br>mysql-1   1/1     Running             0<br>mysql-2   1/1     Running             0</pre><p>The Pod is stuck in:</p><pre>ContainerCreating</pre><p>This often means the container cannot start because Kubernetes is still performing some prerequisite operation such as:</p><ul><li>Volume attachment</li><li>Volume mounting</li><li>Image operation</li><li>Network setup</li><li>Secret/configuration setup</li></ul><p>So don’t immediately assume storage is the problem.</p><h3>🔎 Step 2 — Describe the Pod</h3><p>This is usually the most important first troubleshooting command.</p><pre>kubectl describe pod mysql-0</pre><p>Scroll to:</p><pre>Events:</pre><p>Look for messages such as:</p><pre>FailedMount<br>FailedAttachVolume<br>Unable to attach or mount volumes<br>MountVolume.SetUp failed<br>Multi-Attach error</pre><p>Example:</p><pre>Warning  FailedMount  kubelet<br>MountVolume.SetUp failed for volume &quot;mysql-data&quot;</pre><p>🚨 This gives us the first strong indication that storage is involved.</p><h3>🔎 Step 3 — Check the StatefulSet</h3><p>Run:</p><pre>kubectl get statefulset</pre><p>Then:</p><pre>kubectl describe statefulset mysql</pre><p>Check:</p><pre>Replicas<br>Current Replicas<br>Ready Replicas<br>Volume Claims<br>Events</pre><p>Also inspect the YAML:</p><pre>kubectl get statefulset mysql -o yaml</pre><p>Look for:</p><pre>volumeClaimTemplates:</pre><p>For example:</p><pre>volumeClaimTemplates:<br>  - metadata:<br>      name: mysql-data<br>    spec:<br>      accessModes:<br>        - ReadWriteOnce<br>      storageClassName: gp3<br>      resources:<br>        requests:<br>          storage: 20Gi</pre><p>This tells us how StatefulSet storage is created.</p><h3>🔎 Step 4 — Check the PVC</h3><p>Run:</p><pre>kubectl get pvc</pre><p>Example:</p><pre>NAME                   STATUS   VOLUME<br>mysql-data-mysql-0     Bound    pvc-1234<br>mysql-data-mysql-1     Bound    pvc-5678<br>mysql-data-mysql-2     Bound    pvc-9012</pre><p>For the affected Pod:</p><pre>kubectl describe pvc mysql-data-mysql-0</pre><p>Expected:</p><pre>Status: Bound</pre><h3>🚨 Important distinction</h3><p>If the PVC is:</p><pre>Bound</pre><p>that means the PVC is successfully associated with a PV.</p><p>It does <strong>not</strong> necessarily mean that the volume has successfully attached and mounted to the node.</p><p>So:</p><pre>PVC Bound<br>    ≠<br>Volume Mounted</pre><h3>🔎 Step 5 — Check the PV</h3><p>Find the PV:</p><pre>kubectl get pvc mysql-data-mysql-0</pre><p>Then:</p><pre>kubectl get pv &lt;pv-name&gt;</pre><p>Expected:</p><pre>STATUS   Bound</pre><p>Describe it:</p><pre>kubectl describe pv &lt;pv-name&gt;</pre><p>Check:</p><pre>StorageClass<br>Capacity<br>Access Modes<br>VolumeHandle<br>Claim<br>Node Affinity<br>CSI Driver</pre><p>For AWS EBS, you may find:</p><pre>VolumeHandle:<br>vol-0123456789abcdef</pre><h3>🔎 Step 6 — Check the StorageClass</h3><p>Run:</p><pre>kubectl get storageclass</pre><p>Then:</p><pre>kubectl describe storageclass gp3</pre><p>Verify:</p><pre>Provisioner: ebs.csi.aws.com</pre><p>Also check:</p><pre>ReclaimPolicy<br>VolumeBindingMode</pre><p>For example:</p><pre>Provisioner: ebs.csi.aws.com<br>ReclaimPolicy: Delete<br>VolumeBindingMode: WaitForFirstConsumer</pre><p>The StorageClass determines how dynamic storage provisioning is handled.</p><h3>🔎 Step 7 — Check the CSI Driver</h3><p>For AWS EKS, check the EBS CSI components:</p><pre>kubectl get pods -n kube-system</pre><p>Filter if necessary:</p><pre>kubectl get pods -n kube-system | grep ebs-csi</pre><p>You should normally see components such as:</p><pre>ebs-csi-controller<br>ebs-csi-node</pre><p>Check their status.</p><p>Expected:</p><pre>Running</pre><p>If the CSI components are unhealthy, investigate them before making changes to the StatefulSet.</p><h3>🔎 Step 8 — Check CSI Controller Logs</h3><p>For the controller:</p><pre>kubectl logs -n kube-system deployment/ebs-csi-controller</pre><p>Look for errors such as:</p><pre>UnauthorizedOperation<br>Volume not found<br>FailedAttachVolume<br>Multi-Attach error<br>Timeout</pre><p>For the node component, identify the appropriate CSI node Pod and inspect its logs:</p><pre>kubectl get pods -n kube-system -o wide | grep ebs-csi-node</pre><p>Then:</p><pre>kubectl logs -n kube-system &lt;ebs-csi-node-pod&gt;</pre><h3>🔎 Step 9 — Check Which Node the Pod Is On</h3><p>Run:</p><pre>kubectl get pod mysql-0 -o wide</pre><p>Example:</p><pre>NAME      STATUS              NODE<br>mysql-0   ContainerCreating   worker-node-02</pre><p>Now inspect the node:</p><pre>kubectl get node worker-node-02</pre><p>Expected:</p><pre>Ready</pre><p>Then:</p><pre>kubectl describe node worker-node-02</pre><p>Check for:</p><pre>DiskPressure<br>MemoryPressure<br>NetworkUnavailable</pre><h3>🔎 Step 10 — Check Volume Attachment</h3><p>Kubernetes has a VolumeAttachment resource for CSI-managed volume attachment.</p><p>Run:</p><pre>kubectl get volumeattachment</pre><p>Then:</p><pre>kubectl describe volumeattachment &lt;volumeattachment-name&gt;</pre><p>Look for:</p><pre>Attached: true</pre><p>If you see:</p><pre>Attached: false</pre><p>the volume has not successfully attached to the node.</p><p>This is an important clue.</p><h3>🔎 Step 11 — Check for Multi-Attach Errors</h3><p>AWS EBS volumes commonly use:</p><pre>ReadWriteOnce</pre><p>which generally means the volume is intended to be mounted read-write by one node at a time.</p><p>Check Pod events:</p><pre>kubectl describe pod mysql-0</pre><p>You might see:</p><pre>Multi-Attach error for volume</pre><p>Possible scenario:</p><pre>Old Node<br>   │<br>   └── EBS volume still attached<br>             │<br>             X<br>             │<br>New Node<br>   │<br>   └── mysql-0 wants same volume</pre><p>Kubernetes/CSI needs the volume to be available for the new attachment.</p><h3>🔎 Step 12 — Check AWS EBS Volume</h3><p>If you’re using EKS + EBS, identify the volume ID from the PV.</p><p>Then check AWS:</p><pre>AWS Console<br>   ↓<br>EC2<br>   ↓<br>Elastic Block Store<br>   ↓<br>Volumes</pre><p>Verify:</p><pre>Volume ID<br>State<br>Availability Zone<br>Attachment<br>Size</pre><p>Possible states:</p><pre>Available<br>In-use</pre><p>If the volume is attached to an unexpected node, investigate why.</p><h3>🔎 Step 13 — Check Availability Zone</h3><p>AWS EBS volumes are associated with a specific Availability Zone.</p><p>For example:</p><pre>EBS Volume:<br>us-east-1a</pre><p>Worker node:</p><pre>us-east-1b</pre><p>Depending on the storage configuration, this can prevent the volume from being attached.</p><p>Check the node’s AZ.</p><p>For example:</p><pre>kubectl get node worker-node-02 \<br>  -o jsonpath=&#39;{.metadata.labels.topology\.kubernetes\.io/zone}&#39;</pre><p>Compare it with the volume’s AZ in AWS.</p><h3>🚨 Important</h3><p>Don’t manually move an EBS volume between Availability Zones as a routine fix.</p><p>Investigate the Kubernetes scheduling and storage topology configuration.</p><h3>🔎 Step 14 — Check Node Affinity on the PV</h3><p>Run:</p><pre>kubectl describe pv &lt;pv-name&gt;</pre><p>Look for:</p><pre>Node Affinity</pre><p>You may see:</p><pre>topology.kubernetes.io/zone</pre><p>This tells Kubernetes where the volume can be used.</p><p>A topology mismatch can cause scheduling or attachment problems.</p><h3>🔎 Step 15 — Check the PVC Events</h3><p>Run:</p><pre>kubectl describe pvc mysql-data-mysql-0</pre><p>Look at:</p><pre>Events:</pre><p>Possible messages:</p><pre>FailedBinding<br>ProvisioningFailed<br>VolumeMismatch</pre><p>Remember:</p><pre>PVC Problem<br>      ↓<br>PV Problem<br>      ↓<br>Attachment Problem<br>      ↓<br>Mount Problem</pre><p>We need to identify which layer is actually failing.</p><h3>🔎 Step 16 — Check Mount Errors</h3><p>If the volume is attached but the Pod still isn’t starting, the problem may have moved from <strong>attach</strong> to <strong>mount</strong>.</p><p>Check:</p><pre>kubectl describe pod mysql-0</pre><p>Look for:</p><pre>FailedMount<br>MountVolume.SetUp failed<br>permission denied<br>filesystem error<br>wrong filesystem</pre><p>Example:</p><pre>MountVolume.SetUp failed for volume</pre><p>This means:</p><pre>Volume Provisioned     ✅<br>Volume Attached        ✅<br>Volume Mounted         ❌</pre><p>Now the investigation should focus on the mount layer.</p><h3>🔎 Step 17 — Check File Permissions</h3><p>If the volume mounts successfully but the application fails after restart, check application logs:</p><pre>kubectl logs mysql-0</pre><p>You may see:</p><pre>Permission denied<br>Cannot write to /var/lib/mysql</pre><p>Then inspect the container:</p><pre>kubectl exec -it mysql-0 -- sh</pre><p>Check:</p><pre>id</pre><p>and:</p><pre>ls -ld /var/lib/mysql</pre><p>You may discover:</p><pre>Volume:<br>root:root</pre><pre>Application:<br>uid=1001<br>gid=1001</pre><p>Now the problem is no longer volume attachment.</p><p>It is a <strong>Linux filesystem permission problem</strong>.</p><p>This is where a suitable securityContext, fsGroup, or application-specific ownership strategy may be required.</p><h3>🔎 Step 18 — Check the Application Logs</h3><p>Once the Pod starts, it may still fail because the application cannot read its previous data.</p><p>Run:</p><pre>kubectl logs mysql-0</pre><p>For a database, possible messages might indicate:</p><pre>Permission denied<br>Data directory is not writable<br>Database files are corrupted<br>Database initialization failed</pre><p>At this stage:</p><p>🚨 <strong>Do not delete the PVC or PV just because the application cannot start.</strong></p><p>The existing data may be exactly what you need to preserve.</p><h3>🔎 Step 19 — Check Whether the PVC Was Recreated</h3><p>This is a critical StatefulSet concept.</p><p>Check:</p><pre>kubectl get pvc</pre><p>Compare the affected PVC with the expected StatefulSet claim.</p><p>For example:</p><pre>mysql-data-mysql-0</pre><p>The StatefulSet normally expects stable claim identity.</p><p>If someone manually deleted the PVC, Kubernetes may create or attempt to recreate storage depending on the StatefulSet configuration and lifecycle.</p><p>That can be extremely dangerous for stateful applications.</p><h3>Production Rule</h3><blockquote><strong><em>Never delete a StatefulSet PVC as a troubleshooting shortcut.</em></strong></blockquote><h3>🔎 Step 20 — Check StatefulSet Pod Identity</h3><p>Run:</p><pre>kubectl get pods -l app=mysql</pre><p>You should see stable names:</p><pre>mysql-0<br>mysql-1<br>mysql-2</pre><p>A key StatefulSet property is that Pod identity is stable.</p><p>For example:</p><pre>mysql-0<br>   ↓<br>mysql-data-mysql-0</pre><p>This stable relationship is important for stateful applications.</p><h3>🧩 Step 21 — Identify the Exact Failure Layer</h3><p>At this point, classify the problem.</p><h3>Case 1 — PVC Pending</h3><pre>Pod<br> ↓<br>PVC Pending</pre><p>Investigate:</p><ul><li>StorageClass</li><li>CSI provisioner</li><li>Capacity</li><li>Provisioning</li><li>IAM</li></ul><h3>Case 2 — PVC Bound but Attach Failed</h3><pre>PVC Bound<br>   ↓<br>PV Bound<br>   ↓<br>Attach Failed</pre><p>Investigate:</p><ul><li>CSI driver</li><li>IAM</li><li>VolumeAttachment</li><li>Multi-Attach</li><li>Node</li><li>Cloud provider</li><li>Availability Zone</li></ul><h3>Case 3 — Attached but Mount Failed</h3><pre>PVC Bound<br>   ↓<br>PV Bound<br>   ↓<br>Attached<br>   ↓<br>Mount Failed</pre><p>Investigate:</p><ul><li>Filesystem</li><li>Mount configuration</li><li>Permissions</li><li>CSI node plugin</li><li>Node health</li></ul><h3>Case 4 — Mounted but Application Failed</h3><pre>Volume Mounted<br>       ↓<br>Application Failed</pre><p>Investigate:</p><ul><li>File ownership</li><li>UID/GID</li><li>fsGroup</li><li>Application configuration</li><li>Existing data</li><li>Database recovery</li></ul><h3>🔄 Complete Troubleshooting Flow</h3><pre>StatefulSet Pod Restart<br>          │<br>          ▼<br>    Pod ContainerCreating<br>          │<br>          ▼<br>    kubectl describe pod<br>          │<br>          ▼<br>       Check Events<br>          │<br>          ▼<br>      Check StatefulSet<br>          │<br>          ▼<br>        Check PVC<br>          │<br>     ┌────┴────┐<br>     ▼         ▼<br>  Pending     Bound<br>     │         │<br>     ▼         ▼<br> StorageClass  Check PV<br> CSI Driver      │<br>                 ▼<br>          Check VolumeAttachment<br>                 │<br>                 ▼<br>           Check CSI Driver<br>                 │<br>                 ▼<br>           Check Cloud Volume<br>                 │<br>                 ▼<br>         Check Node / AZ<br>                 │<br>                 ▼<br>             Attach?<br>            /       \<br>          No         Yes<br>          │           │<br>          ▼           ▼<br>     Fix Attach    Check Mount<br>                      │<br>                      ▼<br>                 Check Permissions<br>                      │<br>                      ▼<br>                Check Application<br>                      │<br>                      ▼<br>                 Pod Running ✅</pre><h3>🛠️ Common Root Causes</h3><p>SymptomLikely AreaPVC PendingStorageClass / CSI provisioningPVC Bound, Pod ContainerCreatingAttach or mountFailedAttachVolumeCloud/CSI attachmentMulti-Attach errorVolume already attachedFailedMountMount/filesystem issuePermission deniedUID/GID/fsGroupAZ mismatchStorage topologyUnauthorizedOperationIAMVolume not foundCloud volume/resource issueCSI Pod not runningCSI driverApplication cannot read old dataPermissions/data/application issue</p><h3>🚨 What NOT to Do</h3><p>When troubleshooting StatefulSet storage, avoid these shortcuts:</p><pre>kubectl delete pvc mysql-data-mysql-0</pre><p>❌ Don’t delete the PVC just to make the Pod restart.</p><pre>kubectl delete pv &lt;pv-name&gt;</pre><p>❌ Don’t delete the PV to “recreate” the storage.</p><pre>kubectl delete pod mysql-0</pre><p>Deleting the Pod itself is generally safe because the StatefulSet controller can recreate it, but <strong>do this only after understanding the storage issue</strong>.</p><p>Most importantly:</p><blockquote><strong><em>Never delete persistent storage as a first troubleshooting step.</em></strong></blockquote><h3>🧪 Useful Commands Cheat Sheet</h3><h3>StatefulSet</h3><pre>kubectl get statefulset<br>kubectl describe statefulset &lt;name&gt;<br>kubectl get statefulset &lt;name&gt; -o yaml</pre><h3>Pods</h3><pre>kubectl get pods -o wide<br>kubectl describe pod &lt;pod&gt;<br>kubectl logs &lt;pod&gt;</pre><h3>PVC</h3><pre>kubectl get pvc<br>kubectl describe pvc &lt;pvc&gt;</pre><h3>PV</h3><pre>kubectl get pv<br>kubectl describe pv &lt;pv&gt;</pre><h3>StorageClass</h3><pre>kubectl get storageclass<br>kubectl describe storageclass &lt;storageclass&gt;</pre><h3>VolumeAttachment</h3><pre>kubectl get volumeattachment<br>kubectl describe volumeattachment &lt;name&gt;</pre><h3>CSI Driver</h3><pre>kubectl get pods -n kube-system | grep csi</pre><h3>Events</h3><pre>kubectl get events -A \<br>  --sort-by=.metadata.creationTimestamp</pre><h3>Node</h3><pre>kubectl get nodes<br>kubectl describe node &lt;node&gt;</pre><h3>🎯 Interview Question</h3><h3>Interviewer:</h3><p><strong>“A StatefulSet Pod restarted and is stuck in ContainerCreating. The PVC is Bound. What will you check?”</strong></p><h3>Strong Senior-Level Answer:</h3><blockquote><em>“I would first describe the Pod and inspect its Events to determine whether the issue is related to volume attachment or mounting. Since the PVC is already Bound, I would verify the corresponding PV, StorageClass, CSI driver health, VolumeAttachment status, and the node where the Pod is scheduled. For cloud storage such as AWS EBS, I would check the volume attachment state, IAM permissions, Availability Zone and topology constraints, and possible Multi-Attach errors. If the volume is attached but mounting fails, I would investigate filesystem and permission issues. If the volume mounts successfully but the application fails, I would check UID/GID, fsGroup, application logs, and the existing data. I would avoid deleting the PVC or PV because this is a StatefulSet and the persistent data must be protected.”</em></blockquote><h3>🛡️ Production Best Practices</h3><h3>1. Never treat StatefulSet storage like stateless Pod storage</h3><p>Stateful workloads often contain critical data.</p><h3>2. Monitor PVC/PV health</h3><p>Monitor:</p><pre>PVC Pending<br>PV Released<br>VolumeAttachment failures<br>CSI errors</pre><h3>3. Monitor CSI drivers</h3><p>The CSI layer is critical for cloud storage.</p><h3>4. Use backups</h3><p>For databases and critical stateful applications:</p><pre>Application Data<br>       ↓<br>Backup / Snapshot<br>       ↓<br>Recovery Testing</pre><h3>5. Understand topology</h3><p>For zonal cloud volumes:</p><pre>Pod<br> ↓<br>Node<br> ↓<br>Availability Zone<br> ↓<br>Cloud Volume</pre><p>These relationships matter.</p><h3>6. Don’t delete PVCs during troubleshooting</h3><p>First determine the actual failure.</p><h3>7. Use alerts</h3><p>Useful alerts include:</p><pre>PVC Pending<br>VolumeAttachment Failed<br>DiskPressure<br>CSI Driver errors<br>Pod stuck in ContainerCreating</pre><h3>🧠 Senior DevOps Takeaway</h3><p>When a StatefulSet Pod restarts and gets stuck, don’t immediately restart the Pod again.</p><p>Follow the storage chain:</p><pre>StatefulSet<br>    ↓<br>Pod<br>    ↓<br>PVC<br>    ↓<br>PV<br>    ↓<br>StorageClass<br>    ↓<br>CSI Driver<br>    ↓<br>VolumeAttachment<br>    ↓<br>Cloud Volume<br>    ↓<br>Node<br>    ↓<br>Mount<br>    ↓<br>Application</pre><p>Find the <strong>first layer that is failing</strong>.</p><p>That is the key to efficient Kubernetes troubleshooting.</p><h3>🔥 Final LinkedIn Takeaway</h3><p><strong>A StatefulSet restart should not mean data loss.</strong></p><p>When a StatefulSet Pod is stuck after a restart:</p><blockquote><strong><em>Don’t delete the PVC/PV blindly.</em></strong></blockquote><p>Instead:</p><pre>Check Pod Events<br>      ↓<br>Check PVC/PV<br>      ↓<br>Check CSI Driver<br>      ↓<br>Check VolumeAttachment<br>      ↓<br>Check Cloud Volume<br>      ↓<br>Check Node/AZ<br>      ↓<br>Check Mount<br>      ↓<br>Check Permissions<br>      ↓<br>Check Application</pre><p><strong>The goal is not simply to make the Pod Running.</strong></p><p>The goal is to restore the Pod <strong>while preserving the state and integrity of the application’s data.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa092adb2791" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Day 38 — Kubernetes Debugging Series]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-38-kubernetes-debugging-series-a13ec76b21ae?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/a13ec76b21ae</guid>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 03:27:53 GMT</pubDate>
            <atom:updated>2026-08-19T03:27:53.063Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2x071Ez0-RFeOl_qRNURg.png" /></figure><h3>🗑️ Unused Volumes → Delete Safely</h3><h3>📌 Production Scenario</h3><p>Your Kubernetes cluster has been running for months.</p><p>During a storage audit, you discover many PersistentVolumes and cloud disks that appear to be unused.</p><p>You might see:</p><pre>kubectl get pv</pre><p>Example:</p><pre>NAME                                       STATUS      CAPACITY   CLAIM<br>pvc-11111111-aaaa-bbbb-cccc-111111111111   Bound       20Gi       prod/mysql-pvc<br>pvc-22222222-aaaa-bbbb-cccc-222222222222   Released    50Gi       -<br>pvc-33333333-aaaa-bbbb-cccc-333333333333   Available   100Gi      -</pre><p>At first glance, you may think:</p><blockquote><em>“These volumes are unused. Let’s delete them.”</em></blockquote><p>🚨 <strong>Don’t do that immediately.</strong></p><p>A volume can contain important data even when no Pod is currently using it.</p><p>The correct approach is:</p><pre>Find Volume<br>     ↓<br>Identify Owner<br>     ↓<br>Check PVC<br>     ↓<br>Check PV<br>     ↓<br>Check Reclaim Policy<br>     ↓<br>Check Application<br>     ↓<br>Confirm Data Is Not Required<br>     ↓<br>Backup / Approval<br>     ↓<br>Delete Safely<br>     ↓<br>Verify Cloud Storage</pre><h3>🧠 First Understand Kubernetes Storage</h3><p>The relationship normally looks like:</p><pre>Pod<br> ↓<br>PVC<br> ↓<br>PV<br> ↓<br>StorageClass<br> ↓<br>CSI Driver<br> ↓<br>Cloud Volume</pre><p>For example, in AWS EKS:</p><pre>Pod<br> ↓<br>PVC<br> ↓<br>PV<br> ↓<br>EBS CSI Driver<br> ↓<br>AWS EBS Volume</pre><p>Deleting one resource does not necessarily mean that every underlying storage resource will immediately disappear.</p><p>This is why we need to understand the <strong>PV reclaim policy</strong> before deleting anything.</p><h3>🔎 Step 1 — List PersistentVolumes</h3><p>Start with:</p><pre>kubectl get pv</pre><p>Example:</p><pre>NAME       STATUS      CAPACITY   ACCESS MODES   RECLAIM POLICY<br>pv-app1    Bound       20Gi       RWO            Delete<br>pv-app2    Released    50Gi       RWO            Retain<br>pv-app3    Available   100Gi      RWO            Delete</pre><p>Pay particular attention to:</p><pre>STATUS<br>RECLAIM POLICY<br>CLAIM</pre><h3>🔎 Step 2 — Understand PV Status</h3><p>There are several important PV states.</p><h3>🟢 Bound</h3><pre>Bound</pre><p>The PV is currently associated with a PVC.</p><p>🚨 <strong>Do not consider this an unused volume.</strong></p><h3>🟡 Released</h3><pre>Released</pre><p>The PVC that previously claimed the PV has been deleted.</p><p>However, the underlying storage may still exist.</p><p>This is an important cleanup candidate, but it is <strong>not automatically safe to delete</strong>.</p><h3>🔵 Available</h3><pre>Available</pre><p>The PV is not currently bound to a PVC.</p><p>It may be unused, but you still need to verify its origin and whether it contains data.</p><h3>🔎 Step 3 — Check All PVCs</h3><p>Run:</p><pre>kubectl get pvc -A</pre><p>Example:</p><pre>NAMESPACE   NAME          STATUS   VOLUME<br>prod        mysql-pvc     Bound    pv-app1<br>dev         test-pvc      Bound    pv-app4</pre><p>Now compare the PVCs with the PV list.</p><p>Your goal is to understand:</p><pre>PV<br> ↓<br>Is it referenced by a PVC?<br> ↓<br>Is that PVC used by an application?</pre><h3>🔎 Step 4 — Inspect the PV</h3><p>For a suspicious PV:</p><pre>kubectl describe pv pv-app2</pre><p>Look for:</p><pre>Status<br>Claim<br>Reclaim Policy<br>StorageClass<br>Source<br>Annotations<br>CSI Driver<br>VolumeHandle</pre><p>For an EBS-backed PV, you may see a CSI volume handle such as:</p><pre>VolumeHandle:<br>vol-0123456789abcdef</pre><p>This gives you the cloud volume identity.</p><h3>🔎 Step 5 — Check the Reclaim Policy</h3><p>This is one of the most important checks.</p><p>Run:</p><pre>kubectl get pv pv-app2 -o jsonpath=&#39;{.spec.persistentVolumeReclaimPolicy}&#39;</pre><p>Possible values include:</p><pre>Delete</pre><p>or:</p><pre>Retain</pre><h3>🟢 Reclaim Policy: Delete</h3><p>With:</p><pre>Delete</pre><p>the storage backend can be deleted when the PV is deleted, depending on the CSI driver’s behavior and resource lifecycle.</p><p>For example:</p><pre>PVC deleted<br>    ↓<br>PV lifecycle<br>    ↓<br>Cloud volume may be deleted</pre><p>Therefore, be extremely careful.</p><h3>🟡 Reclaim Policy: Retain</h3><p>With:</p><pre>Retain</pre><p>the underlying storage is retained after the claim/PV lifecycle ends.</p><p>This is useful when preserving data is more important than automatic cleanup.</p><p>Example:</p><pre>PVC deleted<br>     ↓<br>PV released<br>     ↓<br>EBS volume remains<br>     ↓<br>Manual review required</pre><p>This is a common situation where storage can accumulate over time.</p><h3>🔎 Step 6 — Find the StorageClass</h3><p>Check:</p><pre>kubectl get storageclass</pre><p>Then:</p><pre>kubectl describe storageclass &lt;storage-class&gt;</pre><p>Look at:</p><pre>Provisioner<br>ReclaimPolicy<br>VolumeBindingMode</pre><p>Example:</p><pre>NAME   PROVISIONER      RECLAIMPOLICY<br>gp3    ebs.csi.aws.com  Delete</pre><p>The StorageClass configuration helps explain how dynamically provisioned storage is managed.</p><h3>🔎 Step 7 — Identify the Application Owner</h3><p>Before deleting a volume, determine what application previously used it.</p><p>Check:</p><pre>kubectl describe pv &lt;pv-name&gt;</pre><p>Look at the claim:</p><pre>Claim:<br>prod/mysql-pvc</pre><p>Then:</p><pre>kubectl get pvc mysql-pvc -n prod</pre><p>Next identify workloads in that namespace:</p><pre>kubectl get deploy,statefulset -n prod</pre><p>Also check Pods:</p><pre>kubectl get pods -n prod</pre><p>For StatefulSets, pay particular attention to:</p><pre>volumeClaimTemplates</pre><p>because StatefulSet storage is often intentionally persistent.</p><h3>🔎 Step 8 — Check Whether the Volume Is Actually Mounted</h3><p>Don’t assume that a volume is unused just because you don’t immediately see an active Pod.</p><p>Find Pods in the relevant namespace:</p><pre>kubectl get pods -n prod -o wide</pre><p>Then inspect the workload:</p><pre>kubectl describe pod &lt;pod-name&gt; -n prod</pre><p>Look under:</p><pre>Volumes:<br>Mounts:</pre><p>You want to determine:</p><pre>PV<br> ↓<br>PVC<br> ↓<br>Pod<br> ↓<br>Application</pre><p>If this chain is active:</p><p>🚨 <strong>Do not delete the volume.</strong></p><h3>🔎 Step 9 — Check Cloud Storage</h3><p>If you’re running Kubernetes on AWS EKS, identify the EBS volume.</p><p>For example:</p><pre>PV<br> ↓<br>VolumeHandle<br> ↓<br>vol-0123456789abcdef</pre><p>Then inspect the EBS volume in AWS.</p><p>Check:</p><ul><li>Volume ID</li><li>Size</li><li>State</li><li>Availability Zone</li><li>Attachments</li><li>Creation date</li><li>Tags</li><li>Encryption</li><li>Snapshot information</li></ul><p>Example:</p><pre>Volume ID: vol-0123456789<br>State: Available<br>Size: 50 GiB<br>AZ: us-east-1a</pre><p>An EBS volume in Available state is not currently attached to an EC2 instance, but that <strong>does not automatically mean its data is disposable</strong>.</p><h3>🔎 Step 10 — Check AWS Tags and Metadata</h3><p>Before deleting an orphaned cloud volume, check its tags.</p><p>Useful tags may contain:</p><pre>Environment: production<br>Application: payments<br>Owner: platform-team<br>Project: database<br>Backup: enabled</pre><p>This can reveal that a supposedly “unused” volume belongs to an important system.</p><h3>Senior Engineer Rule</h3><blockquote><strong><em>If ownership is unknown, don’t delete it.</em></strong></blockquote><p>Unknown ownership means:</p><pre>Unknown ≠ Unused</pre><h3>🔎 Step 11 — Check Snapshots / Backups</h3><p>Before deleting production storage, verify whether a valid backup exists.</p><p>For AWS EBS, check:</p><pre>Snapshots<br>AWS Backup<br>Application-level backups<br>Database backups</pre><p>You want to establish:</p><pre>Data exists<br>     ↓<br>Backup exists<br>     ↓<br>Backup is recent<br>     ↓<br>Backup is restorable<br>     ↓<br>Deletion approved</pre><p>A backup that has never been tested for restoration should not automatically be considered a reliable recovery mechanism.</p><h3>🔎 Step 12 — Check for Released PVs</h3><p>This is a very common cleanup scenario.</p><p>Run:</p><pre>kubectl get pv</pre><p>Look for:</p><pre>Released</pre><p>Example:</p><pre>NAME       STATUS     CAPACITY   RECLAIM POLICY<br>pv-old-db  Released   100Gi      Retain</pre><p>This usually means:</p><pre>PVC existed<br>     ↓<br>PVC was deleted<br>     ↓<br>PV became Released<br>     ↓<br>Storage may still exist</pre><p>Now investigate whether the data is still required.</p><h3>🔎 Step 13 — Check Kubernetes Events</h3><p>Run:</p><pre>kubectl get events -A --sort-by=.metadata.creationTimestamp</pre><p>Look for storage-related events.</p><p>This can help determine whether a volume is still involved with active workloads.</p><p>Also check:</p><pre>kubectl get pods -A</pre><p>for:</p><pre>Pending<br>ContainerCreating<br>CrashLoopBackOff</pre><p>A storage cleanup should never accidentally create a new incident.</p><h3>🧩 Step 14 — Classify the Volume</h3><p>At this point, classify each volume.</p><h3>🟢 Category 1 — Active</h3><pre>PV → PVC → Pod → Application</pre><p>Action:</p><pre>DO NOT DELETE</pre><h3>🟡 Category 2 — Released</h3><pre>PVC deleted<br>PV remains<br>Cloud volume remains</pre><p>Action:</p><pre>Investigate ownership + data + backup</pre><h3>🔵 Category 3 — Available</h3><pre>PV not bound</pre><p>Action:</p><pre>Investigate before deletion</pre><h3>🔴 Category 4 — Orphaned Cloud Volume</h3><pre>No Kubernetes resource<br>No active attachment<br>No known owner</pre><p>Action:</p><pre>Tag → Verify → Backup → Approval → Delete</pre><h3>🔎 Step 15 — Check PV Finalizers</h3><p>Before manually editing or deleting PV resources, inspect them:</p><pre>kubectl get pv &lt;pv-name&gt; -o yaml</pre><p>Look for:</p><pre>metadata:<br>  finalizers:</pre><p>CSI-managed storage may have protection/finalizer behavior to help prevent accidental premature cleanup.</p><h3>Important</h3><p>Do <strong>not</strong> remove finalizers simply because deletion is stuck.</p><p>First determine why Kubernetes is protecting the resource.</p><h3>🛠️ Step 16 — Safe Kubernetes Cleanup</h3><p>If you have confirmed that a PV is genuinely obsolete and deletion is approved, delete the appropriate Kubernetes resource.</p><p>For example:</p><pre>kubectl delete pv &lt;pv-name&gt;</pre><p>But remember:</p><h3>⚠️ The result depends on the reclaim policy and storage implementation.</h3><p>If the PV uses:</p><pre>Delete</pre><p>the underlying dynamically provisioned storage may also be deleted.</p><p>If it uses:</p><pre>Retain</pre><p>the underlying storage may remain and require separate cleanup.</p><p>Therefore, <strong>always verify what will happen before deleting the PV</strong>.</p><h3>🛠️ Step 17 — Delete the Cloud Volume Only After Verification</h3><p>If an orphaned EBS volume remains after Kubernetes resources have been cleaned up, verify it again in AWS.</p><p>Example:</p><pre>Volume:<br>vol-0123456789</pre><pre>State:<br>Available</pre><pre>Kubernetes reference:<br>None</pre><pre>Application owner:<br>None</pre><pre>Backup:<br>Confirmed</pre><pre>Approval:<br>Confirmed</pre><p>Only after those checks should the cloud volume be considered for deletion according to your organization’s change-management process.</p><h3>🚨 Step 18 — Never Use Blind Cleanup</h3><p>Avoid commands or scripts such as:</p><pre>kubectl delete pv --all</pre><p>or:</p><pre>aws ec2 delete-volume --volume-id &lt;id&gt;</pre><p>without identifying exactly what the volume contains and who owns it.</p><p>Especially avoid:</p><pre>Delete everything with Status=Released</pre><p>because a Released volume may contain valuable historical data.</p><h3>🔎 Step 19 — Verify After Cleanup</h3><p>After removing an approved unused PV:</p><pre>kubectl get pv</pre><p>Check:</p><pre>kubectl get pvc -A</pre><p>Then verify the cloud side.</p><p>For EBS:</p><pre>EC2<br> ↓<br>EBS<br> ↓<br>Volumes</pre><p>Confirm that the intended volume was removed and unrelated volumes remain untouched.</p><h3>🔎 Step 20 — Verify Applications</h3><p>Finally:</p><pre>kubectl get pods -A</pre><p>Check that important workloads are:</p><pre>Running</pre><p>and not:</p><pre>Pending<br>ContainerCreating<br>CrashLoopBackOff</pre><p>For production workloads, verify application health as well.</p><h3>🔄 Complete Production Troubleshooting Flow</h3><pre>Storage Audit<br>                  │<br>                  ▼<br>             kubectl get pv<br>                  │<br>                  ▼<br>          Check PV Status<br>                  │<br>       ┌──────────┼───────────┐<br>       ▼          ▼           ▼<br>     Bound     Released    Available<br>       │          │           │<br>       ▼          └─────┬─────┘<br>   DO NOT DELETE         ▼<br>                    Check PVC<br>                         │<br>                         ▼<br>                 Check Application<br>                         │<br>                         ▼<br>                 Check Reclaim Policy<br>                         │<br>                         ▼<br>                  Identify Cloud Volume<br>                         │<br>                         ▼<br>                    Check Owner<br>                         │<br>                         ▼<br>                   Check Backups<br>                         │<br>                         ▼<br>                 Confirm Data Needed?<br>                    │           │<br>                   YES          NO<br>                    │           │<br>                    ▼           ▼<br>                  KEEP       Approval<br>                                │<br>                                ▼<br>                         Safe Cleanup<br>                                │<br>                                ▼<br>                         Verify Kubernetes<br>                                │<br>                                ▼<br>                           Verify Cloud<br>                                │<br>                                ▼<br>                           Monitor Apps</pre><h3>🎯 Interview Question</h3><h3>Interviewer:</h3><p><strong>“You find several Released PersistentVolumes and unused EBS volumes in an EKS cluster. How would you clean them up safely?”</strong></p><h3>Strong Senior-Level Answer:</h3><blockquote><em>“I wouldn’t delete them immediately. First I would identify the PV status, associated PVC, StorageClass, reclaim policy, and CSI volume handle. I would determine whether the volume is still referenced by any workload, especially StatefulSets and databases. Then I would identify the corresponding cloud volume, check its attachment state, tags, owner, environment, and creation history. Before deleting production storage, I would verify that an appropriate backup or snapshot exists and confirm that the data is no longer required. After the required approval, I would delete the Kubernetes resource according to the reclaim policy and verify whether the underlying cloud volume is automatically removed or needs separate cleanup. Finally, I would verify Kubernetes workloads and the cloud storage inventory to make sure the cleanup didn’t affect active applications.”</em></blockquote><h3>🛡️ Production Best Practices</h3><h3>✅ 1. Use appropriate reclaim policies</h3><p>Understand when to use:</p><pre>Delete<br>Retain</pre><p>before deploying storage.</p><h3>✅ 2. Tag cloud volumes</h3><p>Use tags such as:</p><pre>Application<br>Environment<br>Owner<br>CostCenter<br>Backup</pre><h3>✅ 3. Monitor orphaned resources</h3><p>Create regular storage audits for:</p><pre>Released PVs<br>Unattached EBS volumes<br>Unused snapshots<br>Old PVCs</pre><h3>✅ 4. Protect production data</h3><p>Before deleting storage:</p><pre>Backup<br> ↓<br>Verify<br> ↓<br>Approval<br> ↓<br>Delete</pre><h3>✅ 5. Be careful with StatefulSets</h3><p>Stateful workloads often intentionally retain storage.</p><p>Never assume:</p><pre>No Pod = No Data Needed</pre><h3>✅ 6. Automate carefully</h3><p>Automation is useful for cleanup, but production deletion should have:</p><ul><li>Clear ownership</li><li>Age thresholds</li><li>Environment checks</li><li>Backup verification</li><li>Approval controls</li><li>Dry-run/reporting capability</li></ul><h3>🧠 Senior DevOps Takeaway</h3><p>The biggest mistake in storage cleanup is:</p><blockquote><strong><em>“The volume is not attached, so it must be unused.”</em></strong></blockquote><p>That’s not necessarily true.</p><p>A safer approach is:</p><pre>Unused-looking<br>      ↓<br>Identify owner<br>      ↓<br>Check Kubernetes references<br>      ↓<br>Check application<br>      ↓<br>Check reclaim policy<br>      ↓<br>Check cloud volume<br>      ↓<br>Check backup<br>      ↓<br>Get approval<br>      ↓<br>Delete<br>      ↓<br>Verify</pre><h3>Remember:</h3><blockquote><strong><em>Released does not mean </em></strong><strong><em>safe to delete.</em></strong></blockquote><blockquote><strong><em>Available does not mean </em></strong><strong><em>data is worthless.</em></strong></blockquote><blockquote><strong><em>Unattached does not mean </em></strong><strong><em>unused.</em></strong></blockquote><p>The goal of storage cleanup is not simply to reduce cloud cost.</p><p>The goal is:</p><p><strong>Reduce waste without causing data loss or application downtime.</strong></p><h3>🔥 Final LinkedIn Takeaway</h3><p><strong>Before deleting an “unused” Kubernetes volume, trace the complete lifecycle:</strong></p><pre>PVC → PV → StorageClass → CSI Driver → Cloud Volume</pre><p>Then verify:</p><pre>Owner<br>+<br>Application<br>+<br>Reclaim Policy<br>+<br>Backup<br>+<br>Approval</pre><p>Only then should you delete it.</p><p><strong>In production, safe cleanup is more important than fast cleanup.</strong></p><p>#️⃣ #Kubernetes #DevOps #AWS #EKS #KubernetesStorage #PersistentVolume #PVC #PV #CloudComputing #SRE #DevOpsEngineer #100DaysOfKubernetes #AWSDevOps #CloudEngineering</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a13ec76b21ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Day 37 — Kubernetes Debugging Series]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-37-kubernetes-debugging-series-1afd8b0fb86f?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/1afd8b0fb86f</guid>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 14:38:34 GMT</pubDate>
            <atom:updated>2026-08-10T14:38:34.965Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ODal6I9zLGVsCuO73ikN1Q.png" /></figure><h3>🔴 Disk Pressure → Cleanup Node</h3><h3>📌 Production Scenario</h3><p>A production Kubernetes application suddenly starts showing scheduling and workload problems.</p><p>You check the nodes:</p><pre>kubectl get nodes</pre><p>and see:</p><pre>NAME              STATUS<br>worker-node-01    Ready<br>worker-node-02    Ready<br>worker-node-03    Ready,SchedulingDisabled</pre><p>Or you may see:</p><pre>worker-node-03    NotReady</pre><p>Now check the node conditions:</p><pre>kubectl describe node worker-node-03</pre><p>You discover:</p><pre>Conditions:</pre><pre>DiskPressure   True</pre><p>🚨 <strong>DiskPressure = True</strong> means the node is running low on local disk resources and Kubernetes is under pressure to reclaim storage.</p><p>This can lead to:</p><ul><li>Pods being evicted</li><li>New Pods failing to schedule</li><li>Image pulls failing</li><li>Containers crashing</li><li>Evicted Pod status</li><li>Node becoming NotReady</li><li>Application outages</li></ul><h3>🧠 First Understand the Problem</h3><p>Kubernetes workloads consume node storage in several ways:</p><pre>Worker Node<br>                         │<br>       ┌─────────────────┼─────────────────┐<br>       ↓                 ↓                 ↓<br> Container Images    Container Logs    Writable Layers<br>       │                 │                 │<br>       └─────────────────┼─────────────────┘<br>                         ↓<br>                  Ephemeral Storage<br>                         │<br>                         ↓<br>                    Node Disk</pre><p>Other consumers can include:</p><pre>/var/log<br>/var/lib/containerd<br>/var/lib/kubelet<br>/var/log/journal</pre><p>The exact paths depend on your operating system and container runtime.</p><h3>🔎 Step 1 — Identify the Affected Node</h3><p>Start from Kubernetes.</p><pre>kubectl get nodes</pre><p>Then inspect the node:</p><pre>kubectl describe node worker-node-03</pre><p>Look for:</p><pre>Conditions:</pre><pre>DiskPressure   True</pre><p>Also check:</p><pre>Events:</pre><p>You may find eviction-related messages.</p><h3>🚨 Important</h3><p>Don’t immediately SSH into the node and start deleting files.</p><p>First determine <strong>what is consuming the disk</strong>.</p><h3>🔎 Step 2 — Check Node Conditions</h3><p>Run:</p><pre>kubectl get nodes</pre><p>Then:</p><pre>kubectl describe node worker-node-03</pre><p>You may see:</p><pre>MemoryPressure   False<br>DiskPressure     True<br>PIDPressure      False<br>Ready            True</pre><p>This tells us:</p><pre>Memory → Healthy<br>PID     → Healthy<br>Disk    → Under Pressure</pre><p>So our investigation should focus on storage.</p><h3>🔎 Step 3 — Check Node Allocatable Storage</h3><p>Run:</p><pre>kubectl describe node worker-node-03</pre><p>Look for:</p><pre>Capacity:<br>  ephemeral-storage:</pre><pre>Allocatable:<br>  ephemeral-storage:</pre><p>You can also inspect Pods running on the node:</p><pre>kubectl get pods -A -o wide | grep worker-node-03</pre><p>This helps identify which workloads are using that node.</p><h3>🔎 Step 4 — Login to the Worker Node</h3><p>If your environment allows SSH:</p><pre>ssh ec2-user@&lt;node-ip&gt;</pre><p>For Ubuntu:</p><pre>ssh ubuntu@&lt;node-ip&gt;</pre><p>Once inside the node, <strong>do not delete anything yet</strong>.</p><p>First measure disk usage.</p><h3>🔎 Step 5 — Check Disk Capacity</h3><p>Run:</p><pre>df -h</pre><p>Example:</p><pre>Filesystem      Size  Used Avail Use%<br>/dev/nvme0n1    50G   48G   2G   96%</pre><p>🚨 Now we know the node’s root filesystem is almost full.</p><p>A simple interpretation:</p><pre>&lt; 70%     → Usually healthy<br>70–85%    → Monitor<br>85–90%    → Investigate<br>90%+      → High risk</pre><p>The exact eviction thresholds depend on your kubelet configuration and distribution.</p><h3>🔎 Step 6 — Check Inode Usage</h3><p>A disk can have free space but still be unable to create files because all inodes are consumed.</p><p>Run:</p><pre>df -i</pre><p>Example:</p><pre>Filesystem      Inodes   IUsed   IFree IUse%<br>/dev/nvme0n1    3.2M     3.2M    0     100%</pre><p>This means:</p><pre>Disk Capacity → Maybe available<br>Inodes        → Exhausted</pre><p>🚨 This is an important distinction.</p><p>Therefore always check both:</p><pre>df -h<br>df -i</pre><h3>🔎 Step 7 — Find the Largest Directories</h3><p>Start at the root filesystem:</p><pre>sudo du -xhd1 / 2&gt;/dev/null | sort -h</pre><p>Example:</p><pre>2G    /usr<br>5G    /var<br>38G   /var/lib<br>48G   /</pre><p>Now we know:</p><pre>/var/lib</pre><p>is consuming significant space.</p><p>Continue deeper:</p><pre>sudo du -xhd1 /var/lib 2&gt;/dev/null | sort -h</pre><p>You may find:</p><pre>30G    /var/lib/containerd<br>7G     /var/lib/kubelet</pre><p>Now investigate those directories further.</p><h3>🔎 Step 8 — Check Container Runtime Usage</h3><p>If your Kubernetes nodes use <strong>containerd</strong>, inspect it using the runtime’s supported tools.</p><p>For example:</p><pre>sudo crictl images</pre><p>and:</p><pre>sudo crictl ps -a</pre><p>You can also check:</p><pre>sudo crictl info</pre><p>Look for:</p><ul><li>Large unused images</li><li>Old containers</li><li>Containers that are no longer needed</li><li>Unexpected image growth</li></ul><h3>⚠️ Important</h3><p>Don’t manually delete files from:</p><pre>/var/lib/containerd</pre><p>or:</p><pre>/var/lib/kubelet</pre><p>while the runtime or kubelet is using them.</p><p>These directories contain runtime-managed state.</p><p>Use the container runtime’s supported cleanup mechanisms.</p><h3>🔎 Step 9 — Check Container Images</h3><p>List images:</p><pre>sudo crictl images</pre><p>You may discover many old images:</p><pre>REPOSITORY        TAG       SIZE<br>application-a     old       2.1GB<br>application-b     old       1.8GB<br>application-c     old       2.5GB</pre><p>In environments where image garbage collection is not keeping up, unused images can consume significant disk space.</p><h3>Production Principle</h3><p>Don’t blindly delete images.</p><p>First determine:</p><ul><li>Are they currently being used?</li><li>Is the node managed by an autoscaling group?</li><li>Is image garbage collection configured correctly?</li><li>Is the container runtime responsible for the storage?</li></ul><h3>🔎 Step 10 — Check Container Logs</h3><p>Logs are another common source of disk pressure.</p><p>Check:</p><pre>sudo du -sh /var/log/*</pre><p>Also investigate:</p><pre>sudo du -xhd1 /var/log 2&gt;/dev/null | sort -h</pre><p>You may find:</p><pre>15G /var/log</pre><p>or large system journal usage.</p><p>For systemd journal:</p><pre>sudo journalctl --disk-usage</pre><p>Example:</p><pre>Archived and active journals take up 8.0G in the file system.</pre><p>Now we have another potential source.</p><h3>🔎 Step 11 — Check for Large Individual Files</h3><p>Use:</p><pre>sudo find /var -xdev -type f -size +1G -ls 2&gt;/dev/null</pre><p>This can reveal unexpectedly large files.</p><p>For example:</p><pre>/var/log/application.log</pre><p>could be several gigabytes.</p><h3>Senior Engineer Mindset</h3><p>Don’t immediately delete the file.</p><p>Ask:</p><blockquote><em>Why did this file become so large?</em></blockquote><p>Possible root causes:</p><ul><li>Application logging too much</li><li>Missing log rotation</li><li>Debug logging enabled in production</li><li>Broken log rotation configuration</li><li>Repeated application errors</li></ul><p>Fixing only the symptom will cause the problem to return.</p><h3>🔎 Step 12 — Check for Deleted Files Still Consuming Disk</h3><p>This is a very useful Linux troubleshooting technique.</p><p>Sometimes a process has a file open even after the file was deleted.</p><p>Run:</p><pre>sudo lsof +L1</pre><p>You may see:</p><pre>process     PID     SIZE/OFF<br>java        1234    8G</pre><p>This means a deleted file is still being held open by the process.</p><p>The disk space will not be released until the process closes the file.</p><h3>Possible Resolution</h3><p>Restart the affected service/application in a controlled manner.</p><p>Don’t randomly kill production processes.</p><h3>🔎 Step 13 — Check Kubernetes Ephemeral Storage Usage</h3><p>Kubernetes workloads can consume local ephemeral storage through:</p><ul><li>Container writable layers</li><li>Container logs</li><li>emptyDir</li><li>Temporary application files</li></ul><p>Check Pods:</p><pre>kubectl get pods -A -o wide</pre><p>For supported environments, inspect resource usage:</p><pre>kubectl top pods -A</pre><p>Also inspect Pod definitions for:</p><pre>resources:<br>  requests:<br>    ephemeral-storage: 1Gi<br>  limits:<br>    ephemeral-storage: 2Gi</pre><p>This allows Kubernetes to understand the workload’s expected ephemeral-storage usage.</p><h3>🔎 Step 14 — Look for Evicted Pods</h3><p>Run:</p><pre>kubectl get pods -A | grep Evicted</pre><p>You may see:</p><pre>application-abc   0/1   Evicted<br>application-xyz   0/1   Evicted</pre><p>Describe one:</p><pre>kubectl describe pod application-abc -n default</pre><p>You may see:</p><pre>Reason: Evicted</pre><pre>The node was low on resource: ephemeral-storage.</pre><p>Now we have confirmation that disk pressure is affecting workloads.</p><h3>🔎 Step 15 — Check Node Events</h3><p>Run:</p><pre>kubectl get events -A --sort-by=.metadata.creationTimestamp</pre><p>Look for messages related to:</p><pre>DiskPressure<br>Eviction<br>ephemeral-storage<br>ImageGC<br>NodeHasDiskPressure</pre><p>This helps determine <strong>when the issue started</strong> and what Kubernetes did in response.</p><h3>🧩 Step 16 — Determine the Root Cause</h3><p>At this point, categorize the problem.</p><p>AreaWhat to CheckNode Diskdf -hInodesdf -iLarge directoriesduContainer imagescrictl imagesContainerscrictl ps -aLogs/var/logJournaljournalctl --disk-usageDeleted fileslsof +L1KubernetesEvicted PodsEphemeral storagePod resource configurationWorkloademptyDir / temporary files</p><p>Possible root causes:</p><h3>1. Too many container images</h3><pre>Old images accumulated on the node.</pre><h3>2. Large application logs</h3><pre>Application generates excessive logs.</pre><h3>3. emptyDir consuming disk</h3><pre>Application stores temporary data locally.</pre><h3>4. Deleted-but-open files</h3><pre>File was deleted but process still holds it open.</pre><h3>5. Inode exhaustion</h3><pre>Millions of small files consumed all inodes.</pre><h3>6. Node disk is simply too small</h3><pre>Workload legitimately requires more local storage.</pre><h3>🛠️ Step 17 — Perform Safe Cleanup</h3><p>Now that the root cause is known, clean the correct resource.</p><h3>Option 1 — Remove Unused Resources</h3><p>Remove obsolete workloads or files according to your operational procedures.</p><p>For container images, use the runtime’s supported cleanup mechanism rather than manually deleting runtime directories.</p><h3>Option 2 — Clean Excessive Logs</h3><p>If logs are the problem:</p><ul><li>Fix log rotation</li><li>Reduce unnecessary logging</li><li>Ship logs to centralized logging</li><li>Remove/archive old logs according to retention policy</li></ul><p>For systemd journal, use your organization’s approved retention policy.</p><p>Example:</p><pre>sudo journalctl --vacuum-time=7d</pre><p>This removes journal entries older than the specified retention period.</p><p>⚠️ Only use a retention period that complies with your organization’s logging and audit requirements.</p><h3>Option 3 — Clean Application Temporary Data</h3><p>If an application is filling:</p><pre>emptyDir</pre><p>or another temporary location, identify why.</p><p>Don’t delete application data blindly.</p><p>Instead:</p><ol><li>Confirm the data is temporary.</li><li>Check application behavior.</li><li>Clean it safely.</li><li>Add appropriate limits/retention.</li></ol><h3>Option 4 — Increase Node Disk</h3><p>If the workload genuinely requires more local storage, consider:</p><pre>Larger node disk<br>        OR<br>Different node instance type<br>        OR<br>Dedicated storage</pre><p>For AWS environments, this could mean increasing the root EBS volume or choosing an appropriate node configuration.</p><h3>🚨 Step 18 — Be Careful With /var/lib/kubelet and /var/lib/containerd</h3><p>This is extremely important in production.</p><p>Never do this blindly:</p><pre>rm -rf /var/lib/kubelet/*</pre><p>or:</p><pre>rm -rf /var/lib/containerd/*</pre><p>❌ This can corrupt node/runtime state and create a much bigger incident.</p><p>Similarly, don’t manually delete Kubernetes-managed files simply because du shows them as large.</p><p>First understand which component owns the data.</p><h3>🔄 Step 19 — Drain the Node When Required</h3><p>If the node requires maintenance or extensive cleanup, consider safely draining it.</p><p>First:</p><pre>kubectl cordon worker-node-03</pre><p>This prevents new workloads from being scheduled there.</p><p>Then, depending on your workload and disruption policies:</p><pre>kubectl drain worker-node-03 \<br>  --ignore-daemonsets \<br>  --delete-emptydir-data</pre><h3>⚠️ Important</h3><p>--delete-emptydir-data means data stored in emptyDir volumes can be deleted.</p><p>Therefore, understand the workload before using this option.</p><p>Also check:</p><ul><li>PodDisruptionBudgets</li><li>Stateful workloads</li><li>Local storage</li><li>DaemonSets</li><li>Critical workloads</li></ul><p>In a production environment, draining a node is an operational decision — not just a command to run automatically.</p><h3>🔎 Step 20 — Verify Disk Recovery</h3><p>After cleanup:</p><pre>df -h</pre><p>You should see available capacity increase.</p><p>Also:</p><pre>df -i</pre><p>Verify inode pressure is resolved.</p><p>Then check Kubernetes:</p><pre>kubectl describe node worker-node-03</pre><p>The node should no longer report:</p><pre>DiskPressure: True</pre><h3>🔎 Step 21 — Verify Workloads</h3><p>Check:</p><pre>kubectl get pods -A</pre><p>Look for:</p><pre>Evicted<br>ContainerCreating<br>CrashLoopBackOff</pre><p>Then verify the affected applications.</p><pre>kubectl get pods -o wide</pre><p>The node should return to normal operation.</p><h3>🟢 Step 22 — Uncordon the Node</h3><p>If you previously cordoned the node and maintenance is complete:</p><pre>kubectl uncordon worker-node-03</pre><p>Verify:</p><pre>kubectl get nodes</pre><p>Expected:</p><pre>worker-node-03   Ready</pre><h3>🔄 Complete Production Troubleshooting Flow</h3><pre>DiskPressure = True<br>                     │<br>                     ▼<br>              Describe Node<br>                     │<br>                     ▼<br>              Check Events<br>                     │<br>                     ▼<br>              SSH to Node<br>                     │<br>          ┌──────────┴──────────┐<br>          ▼                     ▼<br>       df -h                  df -i<br>          │                     │<br>          ▼                     ▼<br>   Disk Capacity          Inode Capacity<br>          │                     │<br>          └──────────┬──────────┘<br>                     ▼<br>              Find Large Data<br>                     │<br>          ┌──────────┼──────────┐<br>          ▼          ▼          ▼<br>        Logs      Images    Kubelet/<br>                             Runtime<br>          │          │          │<br>          └──────────┼──────────┘<br>                     ▼<br>              Identify Root Cause<br>                     │<br>                     ▼<br>              Safe Cleanup<br>                     │<br>                     ▼<br>          Verify Disk + Inodes<br>                     │<br>                     ▼<br>             Check Node Status<br>                     │<br>                     ▼<br>            Verify Workloads<br>                     │<br>                     ▼<br>             Node Healthy ✅</pre><h3>🎯 Interview Question</h3><h3>Interviewer:</h3><p><strong>“A Kubernetes node has DiskPressure=True. How would you troubleshoot it?”</strong></p><h3>Strong Senior-Level Answer:</h3><blockquote><em>“I would first confirm the node condition using </em><em>kubectl describe node and inspect the node events for eviction or disk-pressure messages. Then I would access the node and check both filesystem capacity and inode usage using </em><em>df -h and </em><em>df -i. Next, I would identify the largest directories with </em><em>du and investigate container images, container logs, system journals, kubelet data, temporary files, and deleted-but-open files. On the Kubernetes side, I would check for Evicted Pods and ephemeral-storage consumption. Once I identify the root cause, I would perform controlled cleanup using the appropriate runtime or operating-system mechanism rather than manually deleting Kubernetes or container-runtime directories. If the node requires maintenance, I would cordon and, where appropriate, drain it while considering PodDisruptionBudgets and local storage. Finally, I would verify disk and inode recovery, confirm that DiskPressure is cleared, and validate that workloads are healthy.&quot;</em></blockquote><h3>🛡️ Production Best Practices</h3><h3>1. Monitor disk utilization</h3><p>Don’t wait until the node reaches 95–100%.</p><p>Monitor:</p><pre>Disk utilization<br>Inode utilization<br>Ephemeral storage<br>Container runtime storage<br>Log growth</pre><h3>2. Configure log rotation</h3><p>Applications should not generate unlimited local logs.</p><h3>3. Configure ephemeral-storage requests and limits</h3><p>Example:</p><pre>resources:<br>  requests:<br>    ephemeral-storage: &quot;1Gi&quot;<br>  limits:<br>    ephemeral-storage: &quot;2Gi&quot;</pre><h3>4. Monitor container image growth</h3><p>Large images increase node storage consumption.</p><h3>5. Use centralized logging</h3><p>Avoid keeping unlimited application logs on worker nodes.</p><h3>6. Size node disks correctly</h3><p>A node running many workloads needs enough local storage.</p><h3>7. Monitor inode usage</h3><p>A node can experience storage problems even when df -h shows free space.</p><h3>8. Understand kubelet eviction behavior</h3><p>Kubernetes can evict Pods when node storage crosses configured eviction thresholds.</p><h3>🧠 Senior DevOps Takeaway</h3><p><strong>DiskPressure is a symptom, not the root cause.</strong></p><p>Don’t simply run:</p><pre>rm -rf /some/directory</pre><p>Instead follow the investigation:</p><pre>DiskPressure<br>     ↓<br>What is full?<br>     ↓<br>Disk space or inodes?<br>     ↓<br>Which directory?<br>     ↓<br>Which component owns the data?<br>     ↓<br>Why did it grow?<br>     ↓<br>Can it be safely cleaned?<br>     ↓<br>Prevent it from happening again</pre><p>The real production goal is not just:</p><blockquote><strong><em>“Free some disk space.”</em></strong></blockquote><p>It is:</p><blockquote><strong><em>“Identify why the node ran out of storage, recover safely, and prevent the same failure from happening again.”</em></strong></blockquote><h3>🚀 Final Takeaway</h3><blockquote><strong><em>When </em></strong><strong><em>DiskPressure=True, don&#39;t immediately delete files. First determine whether the problem is disk capacity, inode exhaustion, container images, logs, ephemeral storage, or another workload. Clean the correct resource safely, verify the node recovers, and then address the underlying cause.</em></strong></blockquote><h3>Useful Commands</h3><pre>kubectl get nodes</pre><pre>kubectl describe node &lt;node-name&gt;</pre><pre>kubectl get events -A --sort-by=.metadata.creationTimestamp</pre><pre>df -h</pre><pre>df -i</pre><pre>sudo du -xhd1 / 2&gt;/dev/null | sort -h</pre><pre>sudo du -xhd1 /var 2&gt;/dev/null | sort -h</pre><pre>sudo journalctl --disk-usage</pre><pre>sudo lsof +L1</pre><pre>kubectl get pods -A | grep Evicted</pre><pre>kubectl get pods -A -o wide</pre><pre>kubectl cordon &lt;node-name&gt;</pre><pre>kubectl drain &lt;node-name&gt; --ignore-daemonsets --delete-emptydir-data</pre><pre>kubectl uncordon &lt;node-name&gt;</pre><p><strong>“DiskPressure is not a cleanup command — it is a troubleshooting signal. Find what consumed the node’s storage, clean it safely, and fix the root cause before the node starts evicting workloads.”</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1afd8b0fb86f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Day 36 — Kubernetes Debugging Series]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-36-kubernetes-debugging-series-0b08f6f31728?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b08f6f31728</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 14:27:23 GMT</pubDate>
            <atom:updated>2026-08-10T14:27:23.510Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rScQgrf3LO90omSpsuzCyA.png" /></figure><h3>🔴 Disk Attach Failure → Cloud Storage Issue</h3><h3>📌 Production Scenario</h3><p>A developer reports:</p><blockquote><em>“My application is not starting. The Pod has been stuck in </em><em>ContainerCreating for several minutes.&quot;</em></blockquote><p>You check the storage:</p><pre>kubectl get pvc</pre><p>and see:</p><pre>NAME        STATUS   VOLUME      CAPACITY<br>mysql-pvc   Bound    pvc-12345   20Gi</pre><p>The PVC is <strong>Bound</strong>, so it may look like storage is healthy.</p><p>But the Pod is still:</p><pre>ContainerCreating</pre><p>This is where we need to distinguish between:</p><pre>PVC Provisioning<br>        ↓<br>Volume Attachment<br>        ↓<br>Volume Mount<br>        ↓<br>Container Start</pre><p>The failure in this scenario is during <strong>volume attachment</strong>.</p><h3>🏗️ Understand the Architecture First</h3><p>For an AWS EKS environment, the storage path looks approximately like this:</p><pre>Application<br>     ↓<br>Pod<br>     ↓<br>PVC<br>     ↓<br>PV<br>     ↓<br>AWS EBS CSI Driver<br>     ↓<br>AWS EBS API<br>     ↓<br>EBS Volume<br>     ↓<br>Worker Node</pre><p>If the EBS volume cannot be attached to the selected worker node, Kubernetes cannot mount it into the Pod.</p><p>Therefore:</p><pre>Pod → ContainerCreating<br>PVC → Bound<br>PV  → Bound<br>Volume → Attach Failed</pre><h3>🔎 Step 1 — Check the Pod Status</h3><p>Start with the Pod.</p><pre>kubectl get pods</pre><p>Example:</p><pre>NAME      READY   STATUS              RESTARTS<br>mysql-0   0/1     ContainerCreating   0</pre><p>Don’t immediately restart the Pod.</p><p>First determine <strong>why</strong> it is stuck.</p><h3>🔎 Step 2 — Describe the Pod</h3><p>This is usually the most important first diagnostic step.</p><pre>kubectl describe pod mysql-0</pre><p>Go to the <strong>Events</strong> section.</p><p>You may see:</p><pre>Warning  FailedAttachVolume</pre><pre>AttachVolume.Attach failed</pre><p>or:</p><pre>Warning  FailedMount</pre><pre>Unable to attach or mount volumes</pre><p>Another possible error:</p><pre>Multi-Attach error</pre><h3>🚨 Important</h3><p>If you see:</p><pre>FailedAttachVolume</pre><p>you should investigate the <strong>volume attachment layer</strong> before troubleshooting the application container.</p><h3>🔎 Step 3 — Check the PVC</h3><pre>kubectl get pvc</pre><p>Example:</p><pre>NAME        STATUS   VOLUME       CAPACITY<br>mysql-pvc   Bound    pvc-12345    20Gi</pre><p>The PVC is:</p><pre>Bound ✅</pre><p>This tells us that Kubernetes successfully associated the claim with a PV.</p><p>But it does <strong>not</strong> prove that the disk is attached to the worker node.</p><h3>🔎 Step 4 — Check the PV</h3><pre>kubectl get pv</pre><p>Example:</p><pre>NAME         STATUS   CAPACITY   CLAIM<br>pvc-12345    Bound    20Gi       default/mysql-pvc</pre><p>PV:</p><pre>Bound ✅</pre><p>At this point:</p><pre>PVC → Bound<br>PV  → Bound</pre><p>So provisioning is probably not the problem.</p><p>Now move to the attachment layer.</p><h3>🔎 Step 5 — Check the StorageClass</h3><pre>kubectl get storageclass</pre><p>Then:</p><pre>kubectl describe storageclass gp3</pre><p>For modern EKS environments, verify that the provisioner is appropriate for your cluster, commonly:</p><pre>ebs.csi.aws.com</pre><p>Also check:</p><pre>VolumeBindingMode</pre><p>For topology-aware provisioning, you may see:</p><pre>WaitForFirstConsumer</pre><p>This is useful because Kubernetes can consider the Pod’s scheduling location before provisioning topology-constrained storage.</p><h3>🔎 Step 6 — Find Which Node the Pod Is Using</h3><p>Run:</p><pre>kubectl get pod mysql-0 -o wide</pre><p>Example:</p><pre>NAME      STATUS              NODE<br>mysql-0   ContainerCreating   ip-10-0-1-55</pre><p>Now inspect the node:</p><pre>kubectl get node ip-10-0-1-55 -o wide</pre><p>Also verify:</p><pre>kubectl get nodes</pre><p>Expected:</p><pre>STATUS<br>Ready</pre><p>If the node is unhealthy, investigate the node before blaming the disk.</p><h3>🔎 Step 7 — Check the EBS CSI Driver</h3><p>In EKS, the <strong>AWS EBS CSI Driver</strong> is responsible for communicating with AWS to provision, attach, detach, and mount EBS volumes.</p><p>Check CSI components:</p><pre>kubectl get pods -n kube-system</pre><p>Look for components such as:</p><pre>ebs-csi-controller<br>ebs-csi-node</pre><p>They should normally be:</p><pre>Running</pre><p>For example:</p><pre>ebs-csi-controller   6/6   Running<br>ebs-csi-node         3/3   Running</pre><p>If the CSI controller or node plugin is unhealthy, attachment operations can fail.</p><h3>🔎 Step 8 — Check CSI Controller Logs</h3><p>Now inspect the CSI controller logs.</p><pre>kubectl logs -n kube-system deployment/ebs-csi-controller</pre><p>Depending on the deployment/version, you may need to inspect the relevant controller container.</p><p>Look for errors such as:</p><pre>UnauthorizedOperation</pre><pre>AccessDenied</pre><pre>Volume not found</pre><pre>AttachVolume failed</pre><pre>Request timeout</pre><pre>Multi-Attach error</pre><p>The exact error is extremely important.</p><p>Don’t fix something based only on the message:</p><pre>FailedAttachVolume</pre><p>Find the underlying reason.</p><h3>🔎 Step 9 — Check IAM Permissions</h3><p>For EKS, the EBS CSI Driver needs appropriate AWS permissions to perform operations against EBS.</p><p>Check the IAM role associated with the CSI Driver.</p><p>A commonly used AWS-managed policy is:</p><pre>AmazonEBSCSIDriverPolicy</pre><p>If permissions are missing, CSI logs may show errors such as:</p><pre>UnauthorizedOperation</pre><p>or:</p><pre>AccessDenied</pre><h3>Root Cause Example</h3><pre>Kubernetes<br>    ↓<br>EBS CSI Driver<br>    ↓<br>AWS API<br>    ↓<br>AccessDenied ❌</pre><p>In this case, Kubernetes configuration may be correct.</p><p>The problem is the <strong>AWS IAM layer</strong>.</p><h3>🔎 Step 10 — Check the EBS Volume in AWS</h3><p>For EKS + EBS, inspect the volume in AWS.</p><p>Check:</p><ul><li>Does the volume exist?</li><li>Is it available?</li><li>Is it already attached?</li><li>Which instance is it attached to?</li><li>Which Availability Zone is it in?</li></ul><p>For example:</p><pre>Volume ID:<br>vol-0123456789</pre><pre>State:<br>in-use</pre><pre>Availability Zone:<br>us-east-1a</pre><p>Now compare it with the worker node.</p><h3>🔎 Step 11 — Check Availability Zone</h3><p>This is an important EBS troubleshooting point.</p><p>Suppose:</p><pre>Worker Node<br>AZ: us-east-1a</pre><p>but:</p><pre>EBS Volume<br>AZ: us-east-1b</pre><p>That can cause an attachment failure because an EBS volume is tied to a specific Availability Zone.</p><p>Visualize it:</p><pre>EBS Volume<br>        us-east-1b<br>             ❌<br>             │<br>             │ cannot attach<br>             │<br>        us-east-1a<br>        Worker Node</pre><h3>Important Production Note</h3><p>Don’t manually move an EBS volume between Availability Zones as your first fix.</p><p>First understand <strong>why the Pod was scheduled there</strong> and whether the StorageClass/PV topology is configured correctly.</p><h3>🔎 Step 12 — Check for Multi-Attach</h3><p>Another common production problem is:</p><pre>Multi-Attach error</pre><p>Example:</p><pre>Volume is already exclusively attached<br>to another node</pre><p>This commonly happens when a volume with a single-node attachment capability is being requested by another node.</p><p>Check where the volume is attached in AWS.</p><p>You may discover:</p><pre>EBS Volume<br>     ↓<br>Worker Node A</pre><p>while Kubernetes is trying to use:</p><pre>Worker Node B</pre><h3>Troubleshooting</h3><p>Check:</p><pre>kubectl get pod -o wide</pre><p>and inspect the PV:</p><pre>kubectl describe pv &lt;pv-name&gt;</pre><p>Then investigate the corresponding cloud volume attachment.</p><h3>🔎 Step 13 — Check Kubernetes Events</h3><p>Events provide valuable information.</p><pre>kubectl get events --sort-by=.metadata.creationTimestamp</pre><p>Look for:</p><pre>FailedAttachVolume</pre><pre>FailedMount</pre><pre>Multi-Attach error</pre><pre>AttachVolume.Attach failed</pre><p>Events help establish the timeline:</p><pre>Pod scheduled<br>      ↓<br>Volume attachment requested<br>      ↓<br>Cloud API called<br>      ↓<br>Attachment failed<br>      ↓<br>Kubernetes retries</pre><h3>🔎 Step 14 — Identify the Root Cause</h3><p>At this stage, categorize the problem.</p><p>LayerWhat to CheckPodContainerCreatingPVCBoundPVBoundStorageClassCorrect CSI provisionerNodeReadyCSI DriverHealthyIAMRequired permissionsCloud VolumeExists / correct stateAZNode and volume topologyAttachmentAlready attached?Cloud APIErrors/timeouts</p><p>Possible root causes:</p><h3>1. IAM Permission Problem</h3><pre>AccessDenied<br>UnauthorizedOperation</pre><h3>2. Multi-Attach Problem</h3><pre>Volume already attached</pre><h3>3. Availability Zone Problem</h3><pre>Node: us-east-1a<br>Volume: us-east-1b</pre><h3>4. CSI Driver Problem</h3><p>CSI controller or node plugin is unhealthy.</p><h3>5. Cloud Provider Problem</h3><p>AWS API request fails or times out.</p><h3>6. Node Problem</h3><p>The target worker node is unhealthy or unavailable.</p><h3>🛠️ Step 15 — Apply the Correct Fix</h3><p>Don’t use one fix for every FailedAttachVolume error.</p><p>The fix depends on the root cause.</p><h3>If IAM is the problem</h3><p>Correct the IAM role/policy used by the EBS CSI Driver.</p><h3>If the CSI Driver is unhealthy</h3><p>After confirming the issue, restart the controller if appropriate:</p><pre>kubectl rollout restart deployment ebs-csi-controller -n kube-system</pre><p>Then monitor:</p><pre>kubectl get pods -n kube-system</pre><h3>If there is a stale attachment</h3><p>Investigate the existing attachment first.</p><p>Do <strong>not</strong> blindly force-detach a disk that may still be actively used.</p><p>For databases, forced detachment can potentially cause filesystem or application-level problems.</p><h3>If there is a topology/AZ issue</h3><p>Review:</p><ul><li>StorageClass</li><li>PV topology</li><li>Pod scheduling</li><li>Node labels</li><li>Availability Zones</li></ul><p>Then correct the scheduling/storage configuration rather than manually moving resources without understanding the topology.</p><h3>🔎 Step 16 — Verify the Fix</h3><p>After fixing the actual root cause:</p><pre>kubectl get pods</pre><p>Expected:</p><pre>NAME      READY   STATUS<br>mysql-0   1/1     Running</pre><p>Then:</p><pre>kubectl describe pod mysql-0</pre><p>Look for successful volume events.</p><p>You may see something similar to:</p><pre>Successfully attached volume</pre><p>Finally verify the application:</p><pre>kubectl logs mysql-0</pre><p>The application should start successfully.</p><h3>🔄 Complete Production Troubleshooting Flow</h3><pre>Pod stuck in ContainerCreating<br>              │<br>              ▼<br>     kubectl describe pod<br>              │<br>              ▼<br>      Check Pod Events<br>              │<br>              ▼<br>     FailedAttachVolume?<br>              │<br>              ▼<br>        Check PVC/PV<br>              │<br>              ▼<br>      Check StorageClass<br>              │<br>              ▼<br>       Identify Node<br>              │<br>              ▼<br>      Check Node Health<br>              │<br>              ▼<br>      Check CSI Driver<br>              │<br>              ▼<br>       Check CSI Logs<br>              │<br>              ▼<br>       Check IAM<br>              │<br>              ▼<br>      Check Cloud Volume<br>              │<br>              ▼<br>       Check Volume AZ<br>              │<br>              ▼<br>      Check Multi-Attach<br>              │<br>              ▼<br>       Identify Root Cause<br>              │<br>              ▼<br>        Apply Correct Fix<br>              │<br>              ▼<br>       Verify Attachment<br>              │<br>              ▼<br>          Pod Running</pre><h3>🧠 Senior DevOps Engineer Mindset</h3><p>One of the biggest mistakes is seeing:</p><pre>PVC = Bound</pre><p>and concluding:</p><blockquote><em>“Storage is working.”</em></blockquote><p>That’s incomplete.</p><p>Think of Kubernetes storage as multiple stages:</p><pre>1. Provisioning<br>      ↓<br>2. Binding<br>      ↓<br>3. Attachment<br>      ↓<br>4. Mounting<br>      ↓<br>5. Application Access</pre><p>A failure can occur at any stage.</p><p>For this Day 36 scenario, the important distinction is:</p><pre>PVC Bound ✅</pre><pre>BUT</pre><pre>Disk Attach Failed ❌</pre><p>Therefore, focus your investigation on:</p><pre>CSI Driver<br>      ↓<br>IAM<br>      ↓<br>Cloud API<br>      ↓<br>Cloud Disk<br>      ↓<br>Node<br>      ↓<br>Topology</pre><h3>🎯 Interview Question</h3><h3>Interviewer:</h3><p><strong>“Your PVC is Bound, but the Pod is stuck in ContainerCreating with a FailedAttachVolume error. How would you troubleshoot it?”</strong></p><h3>Strong Senior-Level Answer:</h3><blockquote><em>“First, I would describe the Pod and inspect the Events section to confirm that the failure is actually occurring during volume attachment. Then I would verify the PVC and PV are Bound and inspect the StorageClass and CSI provisioner. Next, I would identify the worker node where the Pod is scheduled and verify that the node is Ready. Since this is an EKS environment, I would check the EBS CSI controller and node components and review their logs for errors such as AccessDenied, UnauthorizedOperation, Multi-Attach, or timeout errors. I would then verify the IAM permissions used by the EBS CSI Driver, inspect the corresponding EBS volume in AWS, check its attachment state and Availability Zone, and investigate any topology or multi-attach issue. Once I identify the actual root cause, I would apply the targeted fix and verify that the volume attaches successfully and the Pod transitions from ContainerCreating to Running.”</em></blockquote><h3>🚨 Production Best Practices</h3><p>✅ Check kubectl describe pod and Events first.</p><p>✅ Distinguish <strong>provisioning</strong>, <strong>attachment</strong>, and <strong>mounting</strong> failures.</p><p>✅ Monitor the EBS CSI Driver.</p><p>✅ Verify IAM permissions.</p><p>✅ Check cloud volume state before taking corrective action.</p><p>✅ Consider Availability Zone/topology constraints.</p><p>✅ Investigate Multi-Attach errors carefully.</p><p>✅ Never force-detach a production database volume without understanding the consequences.</p><p>✅ After fixing the issue, verify both the Kubernetes events and the application.</p><h3>💡 Key Takeaway</h3><blockquote><strong><em>A Bound PVC does not guarantee that the volume is attached to the worker node.</em></strong></blockquote><p>When a Pod is stuck in ContainerCreating with FailedAttachVolume, troubleshoot the complete path:</p><pre>Pod<br> ↓<br>PVC<br><br>↓<br>PV<br> ↓<br>StorageClass<br> ↓<br>CSI Driver<br> ↓<br>IAM<br> ↓<br>Cloud API<br> ↓<br>Cloud Volume<br> ↓<br>Worker Node</pre><p><strong>Don’t just restart the Pod. Find the layer where the attachment is failing.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b08f6f31728" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Day 34 — Kubernetes Debugging Series Data Loss → No Persistence]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-34-kubernetes-debugging-series-data-loss-no-persistence-3fd9e01f493c?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fd9e01f493c</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 14:01:30 GMT</pubDate>
            <atom:updated>2026-08-03T14:01:30.820Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4lg8jzIzT1OIktepn5V74A.png" /></figure><h3>📌 Scenario</h3><p>A developer reports:</p><blockquote><em>“My application was working fine yesterday. After the Pod restarted, all uploaded files and database data disappeared.”</em></blockquote><p>Symptoms:</p><ul><li>✅ Pod restarts successfully</li><li>✅ Application starts normally</li><li>❌ Previously saved data is missing</li><li>❌ Files disappear after Pod recreation</li><li>❌ Database resets after restart</li></ul><p>This is one of the most common production mistakes in Kubernetes.</p><p>In most cases, the application stores data <strong>inside the container filesystem instead of using Persistent Storage (PersistentVolume/PersistentVolumeClaim).</strong></p><p>As an experienced DevOps Engineer, never assume Kubernetes deleted the data. Follow a systematic troubleshooting process.</p><h3>Understanding the Problem</h3><p>A Kubernetes Pod is <strong>ephemeral</strong>.</p><p>When a Pod is deleted or recreated:</p><ul><li>The container filesystem is destroyed.</li><li>Any data stored inside the container is permanently lost.</li><li>Only data stored on a PersistentVolume survives Pod recreation.</li></ul><h3>Storage Flow</h3><pre>Application<br>      │<br>      ▼<br>Container Filesystem<br>      │<br>      ▼<br>volumeMount<br>      │<br>      ▼<br>PVC<br>      │<br>      ▼<br>PV<br>      │<br>      ▼<br>Storage Backend (EBS / Azure Disk / NFS / Ceph)</pre><p>If the application writes data directly to the container filesystem instead of a mounted volume, the data disappears whenever the Pod is recreated.</p><h3>Step 1 — Identify the Problem</h3><p>Developer reports:</p><blockquote><em>“Data disappeared after restarting the Pod.”</em></blockquote><p>Check the Pod.</p><pre>kubectl get pods</pre><p>Example:</p><pre>NAME          READY   STATUS<br>mysql-0       1/1     Running</pre><p>The Pod is healthy.</p><p>So the issue isn’t Pod availability.</p><h3>Step 2 — Verify Application Behavior</h3><p>Create a test file.</p><pre>kubectl exec -it mysql-0 -- sh</pre><p>Inside the container:</p><pre>echo &quot;Hello Kubernetes&quot; &gt; /app/data/test.txt</pre><p>Verify.</p><pre>cat /app/data/test.txt</pre><p>Output</p><pre>Hello Kubernetes</pre><p>Everything appears normal.</p><h3>Step 3 — Restart the Pod</h3><p>Delete the Pod.</p><pre>kubectl delete pod mysql-0</pre><p>Wait for Kubernetes to recreate it.</p><p>Check the Pod.</p><pre>kubectl get pods</pre><h3>Step 4 — Verify the Data</h3><p>Access the Pod again.</p><pre>kubectl exec -it mysql-0 -- sh</pre><p>Check the file.</p><pre>cat /app/data/test.txt</pre><p>Output</p><pre>No such file or directory</pre><p>The data has disappeared.</p><p>This confirms the issue.</p><h3>Step 5 — Check Whether a PVC Exists</h3><pre>kubectl get pvc</pre><p>Possible Output</p><pre>No resources found</pre><p>Immediately notice:</p><p>No PersistentVolumeClaim exists.</p><p>This is a major clue.</p><h3>Step 6 — Verify the Deployment YAML</h3><p>Inspect the Deployment.</p><pre>kubectl get deployment myapp -o yaml</pre><p>Look for:</p><pre>volumes:</pre><p>and</p><pre>volumeMounts:</pre><p>Example</p><pre>containers:</pre><pre>- name: app</pre><pre>image: myapp:latest</pre><pre>volumeMounts: []</pre><pre>volumes: []</pre><p>No volume is configured.</p><h3>Step 7 — Verify the Container Filesystem</h3><p>Access the container.</p><pre>kubectl exec -it myapp-pod -- sh</pre><p>Run</p><pre>mount</pre><p>Look for:</p><pre>/app/data</pre><p>No mounted volume exists.</p><p>Everything is stored inside the container layer.</p><h3>Step 8 — Verify Mounted Volumes</h3><p>Describe the Pod.</p><pre>kubectl describe pod myapp-pod</pre><p>Example</p><pre>Volumes:</pre><pre>default-token</pre><p>No PersistentVolume is mounted.</p><h3>Step 9 — Identify the Root Cause</h3><p>Let’s summarize.</p><p>ComponentStatusPodRunningPVC❌ MissingPV❌ MissingvolumeMount❌ MissingStorageContainer Filesystem</p><p>Root Cause</p><p>The application stores data inside the container filesystem.</p><p>Since containers are ephemeral, all data is lost when the Pod is recreated.</p><h3>Step 10 — Fix the Issue</h3><p>Create a PersistentVolumeClaim.</p><p>Example:</p><pre>apiVersion: v1<br>kind: PersistentVolumeClaim</pre><pre>metadata:</pre><pre>  name: app-pvc</pre><pre>spec:</pre><pre>  accessModes:</pre><pre>  - ReadWriteOnce</pre><pre>  resources:</pre><pre>    requests:</pre><pre>      storage: 10Gi</pre><p>Apply it.</p><pre>kubectl apply -f pvc.yaml</pre><h3>Step 11 — Mount the PVC</h3><p>Update the Deployment.</p><pre>volumes:</pre><pre>- name: app-storage</pre><pre>  persistentVolumeClaim:</pre><pre>    claimName: app-pvc</pre><pre>containers:</pre><pre>- name: app</pre><pre>volumeMounts:</pre><pre>- name: app-storage</pre><pre>  mountPath: /app/data</pre><p>Apply.</p><pre>kubectl apply -f deployment.yaml</pre><p>Restart.</p><pre>kubectl rollout restart deployment myapp</pre><h3>Step 12 — Verify Persistence</h3><p>Create a file.</p><pre>echo &quot;Persistent Data&quot; &gt; /app/data/test.txt</pre><p>Restart the Pod.</p><pre>kubectl delete pod myapp-pod</pre><p>After recreation:</p><pre>kubectl exec -it myapp-pod -- cat /app/data/test.txt</pre><p>Expected Output</p><pre>Persistent Data</pre><p>The data remains available.</p><p>Persistence is now working correctly.</p><h3>Step 13 — Validate the Entire Storage Stack</h3><p>Verify all storage resources.</p><pre>kubectl get pvc</pre><p>Expected</p><pre>NAME</pre><pre>STATUS</pre><pre>app-pvc</pre><pre>Bound</pre><p>Verify PV.</p><pre>kubectl get pv</pre><p>Expected</p><pre>STATUS</pre><pre>Bound</pre><p>Describe the Pod.</p><pre>kubectl describe pod myapp-pod</pre><p>Verify:</p><ul><li>PVC mounted</li><li>Mount path correct</li><li>No volume-related errors</li></ul><h3>Production Troubleshooting Flow</h3><pre>Application Reports Data Loss<br>            │<br>            ▼<br>Check Pod Status<br>            │<br>            ▼<br>Verify Data Exists<br>            │<br>            ▼<br>Restart Pod<br>            │<br>            ▼<br>Check Data Again<br>            │<br>            ▼<br>Check PVC<br>            │<br>            ▼<br>Check PV<br>            │<br>            ▼<br>Inspect Deployment YAML<br>            │<br>            ▼<br>Verify volumeMounts<br>            │<br>            ▼<br>Mount PVC<br>            │<br>            ▼<br>Restart Application<br>            │<br>            ▼<br>Verify Data Persistence</pre><h3>Common Root Causes</h3><h3>No PersistentVolumeClaim</h3><p>The application stores data inside the container.</p><h3>Missing volumeMount</h3><p>PVC exists but isn’t mounted.</p><h3>Wrong mountPath</h3><p>Application writes data to a different directory.</p><h3>Using emptyDir</h3><p>Example:</p><pre>volumes:</pre><pre>- name: cache</pre><pre>  emptyDir: {}</pre><p>emptyDir survives only while the Pod is running.</p><p>All data is deleted when the Pod is removed.</p><h3>Incorrect Application Configuration</h3><p>Application stores files in:</p><pre>/tmp</pre><p>instead of</p><pre>/app/data</pre><h3>Stateful Application Using Deployment</h3><p>Databases should generally use <strong>StatefulSets</strong> with persistent storage rather than Deployments when stable storage and identity are required.</p><h3>Essential Commands Every DevOps Engineer Should Know</h3><pre>kubectl get pods</pre><pre>kubectl describe pod &lt;pod&gt;</pre><pre>kubectl exec -it &lt;pod&gt; -- sh</pre><pre>kubectl get pvc</pre><pre>kubectl describe pvc &lt;pvc&gt;</pre><pre>kubectl get pv</pre><pre>kubectl describe pv &lt;pv&gt;</pre><pre>kubectl get deployment -o yaml</pre><pre>kubectl rollout restart deployment &lt;deployment&gt;</pre><pre>mount</pre><pre>df -h</pre><h3>Interview Question</h3><p><strong>Interviewer:</strong></p><p><em>“Your application loses all data whenever the Pod restarts. How would you troubleshoot it?”</em></p><h3>Strong Answer</h3><blockquote><em>“I would first verify that the Pod is healthy and reproduce the issue by creating a test file and restarting the Pod. If the file disappears, I’d inspect whether the application is using persistent storage by checking for a PersistentVolumeClaim, PersistentVolume, and configured volumeMounts. I’d review the Deployment YAML to confirm the application writes data to the mounted directory rather than the container filesystem. If persistent storage is missing, I’d create a PVC, mount it into the Pod, redeploy the application, and verify that data survives Pod recreation.”</em></blockquote><h3>Key Takeaway</h3><p>A container’s filesystem is <strong>temporary</strong>. Any data written inside the container is lost when the Pod is recreated. For production workloads that need to retain data — such as databases, uploaded files, or application state — always use <strong>PersistentVolumes (PV)</strong> and <strong>PersistentVolumeClaims (PVC)</strong>, and ensure the application writes data to the mounted persistent path rather than the container’s local filesystem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fd9e01f493c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Day 33 — Kubernetes Debugging Series]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-33-kubernetes-debugging-series-9f14634b2e67?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f14634b2e67</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[sre]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 13:55:35 GMT</pubDate>
            <atom:updated>2026-08-03T13:55:35.681Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C2OQPb93JbulbnBCJemiiA.png" /></figure><h3>Volume Mount Failure → Incorrect Mount Path</h3><h3>📌 Scenario</h3><p>A developer deploys an application that uses a PersistentVolumeClaim (PVC) for persistent storage.</p><p>The Pod starts, but the application fails because the volume isn’t mounted at the expected location.</p><p>Common symptoms include:</p><ul><li>✅ PVC is <strong>Bound</strong></li><li>✅ PersistentVolume (PV) is <strong>Bound</strong></li><li>✅ Pod is <strong>Running</strong> or repeatedly restarting</li><li>❌ Application cannot read or write files</li><li>❌ Logs show <strong>“No such file or directory”</strong>, <strong>“Permission denied”</strong>, or <strong>“Path not found”</strong></li></ul><p>In many production environments, the root cause is an <strong>incorrect </strong><strong>mountPath</strong> in the Pod specification.</p><p>As an experienced DevOps Engineer, don’t assume it’s a storage issue. Follow a structured troubleshooting process.</p><h3>Understanding the Volume Mount Flow</h3><pre>Application<br>      │<br>      ▼<br>Container<br>      │<br>      ▼<br>volumeMounts.mountPath<br>      │<br>      ▼<br>Volume<br>      │<br>      ▼<br>PersistentVolumeClaim (PVC)<br>      │<br>      ▼<br>PersistentVolume (PV)<br>      │<br>      ▼<br>Storage Backend</pre><p>If the mountPath is incorrect, Kubernetes successfully attaches the storage, but the application cannot access it.</p><h3>Step 1 — Understand the Problem</h3><p>Developer reports:</p><blockquote><em>“The application starts, but it cannot access its data directory.”</em></blockquote><p>Start by checking the Pod.</p><pre>kubectl get pods</pre><p>Example:</p><pre>NAME        READY   STATUS             RESTARTS<br>mysql-0     0/1     CrashLoopBackOff   5</pre><p>or</p><pre>NAME        READY   STATUS<br>mysql-0     1/1     Running</pre><p>Even if the Pod is Running, the application can still fail because the volume is mounted to the wrong location.</p><h3>Step 2 — Check the Application Logs</h3><p>Logs usually reveal the first clue.</p><pre>kubectl logs mysql-0</pre><p>Example:</p><pre>Error opening /var/lib/mysql/data</pre><pre>No such file or directory</pre><p>or</p><pre>Failed to access /app/uploads</pre><h3>Why?</h3><p>The application is searching for data in a directory that doesn’t exist or isn’t mounted correctly.</p><h3>Step 3 — Describe the Pod</h3><p>Inspect the Pod configuration.</p><pre>kubectl describe pod mysql-0</pre><p>Verify:</p><ul><li>Mounted Volumes</li><li>PVC Name</li><li>Events</li></ul><p>Example:</p><pre>Mounts:</pre><pre>/data</pre><pre>from mysql-storage</pre><p>Events:</p><pre>Successfully mounted volume</pre><h3>Why?</h3><p>This confirms Kubernetes successfully mounted the volume.</p><p>The issue may be where the application expects the data.</p><h3>Step 4 — Verify PVC Status</h3><pre>kubectl get pvc</pre><p>Example:</p><pre>NAME         STATUS</pre><pre>mysql-pvc    Bound</pre><h3>Why?</h3><p>If the PVC is Bound, storage provisioning isn’t the issue.</p><h3>Step 5 — Verify PV Status</h3><pre>kubectl get pv</pre><p>Example:</p><pre>NAME         STATUS</pre><pre>pv01         Bound</pre><h3>Why?</h3><p>This confirms the storage backend is healthy.</p><h3>Step 6 — Inspect the Deployment or Pod YAML</h3><p>View the configuration.</p><pre>kubectl get deployment mysql -o yaml</pre><p>or</p><pre>kubectl edit deployment mysql</pre><p>Check the volumeMounts section.</p><p>Example:</p><pre>volumeMounts:<br>- name: mysql-storage<br>  mountPath: /data</pre><p>Now compare it with the application’s expected path.</p><p>Suppose the application expects:</p><pre>/var/lib/mysql</pre><p>But the YAML mounts:</p><pre>/data</pre><h3>Root Cause</h3><p>The storage is mounted successfully, but the application is looking in a different directory.</p><h3>Step 7 — Verify Inside the Container</h3><p>Access the running container.</p><pre>kubectl exec -it mysql-0 -- sh</pre><p>List the directories.</p><pre>ls -l /</pre><p>Check the mounted path.</p><pre>ls -l /data</pre><p>Now verify the expected application path.</p><pre>ls -l /var/lib/mysql</pre><p>Example:</p><pre>ls: cannot access &#39;/var/lib/mysql&#39;</pre><pre>No such file or directory</pre><h3>Why?</h3><p>This confirms the application is looking in a location where the volume is not mounted.</p><h3>Step 8 — Verify the Volume Mount</h3><p>Run:</p><pre>mount | grep data</pre><p>Example:</p><pre>/dev/sdb on /data type ext4</pre><h3>Why?</h3><p>This proves the volume is mounted correctly, just at the wrong location.</p><h3>Step 9 — Compare Configuration</h3><p>Current YAML:</p><pre>volumeMounts:<br>- name: mysql-storage<br>  mountPath: /data</pre><p>Application expects:</p><pre>/var/lib/mysql</pre><p>Correct configuration:</p><pre>volumeMounts:<br>- name: mysql-storage<br>  mountPath: /var/lib/mysql</pre><p>This is the exact configuration mismatch.</p><h3>Step 10 — Identify the Root Cause</h3><p>Let’s summarize.</p><p>ComponentStatusPodRunning / CrashLoopBackOffPVCBoundPVBoundVolumeMountedApplicationFailingmountPath❌ Incorrect</p><h3>Root Cause</h3><p>The volume is successfully attached, but it’s mounted to the wrong directory.</p><p>The application cannot find its required files.</p><h3>Step 11 — Fix the Issue</h3><p>Update the Deployment.</p><p>Correct:</p><pre>volumeMounts:<br>- name: mysql-storage<br>  mountPath: /var/lib/mysql</pre><p>Apply the updated manifest.</p><pre>kubectl apply -f deployment.yaml</pre><p>Restart the Deployment if required.</p><pre>kubectl rollout restart deployment mysql</pre><h3>Step 12 — Verify the Fix</h3><p>Check the Pod.</p><pre>kubectl get pods</pre><p>Expected:</p><pre>NAME        READY   STATUS</pre><pre>mysql-0     1/1     Running</pre><p>Verify the mount.</p><pre>kubectl exec -it mysql-0 -- df -h</pre><p>Check the directory.</p><pre>ls -l /var/lib/mysql</pre><p>Expected:</p><pre>ibdata1</pre><pre>mysql/</pre><pre>performance_schema/</pre><p>The application should now read and write data successfully.</p><h3>Production Troubleshooting Flow</h3><pre>Application Error<br>        │<br>        ▼<br>Check Pod Status<br>        │<br>        ▼<br>Review Application Logs<br>        │<br>        ▼<br>Describe Pod<br>        │<br>        ▼<br>Verify PVC<br>        │<br>        ▼<br>Verify PV<br>        │<br>        ▼<br>Inspect volumeMounts<br>        │<br>        ▼<br>Access Container<br>        │<br>        ▼<br>Compare mountPath with Application Path<br>        │<br>        ▼<br>Update Deployment<br>        │<br>        ▼<br>Restart Pod<br>        │<br>        ▼<br>Verify Application</pre><h3>Common Root Causes</h3><h3>Incorrect mountPath</h3><p>The application expects /var/lib/mysql, but the volume is mounted at /data.</p><h3>Typographical Errors</h3><p>Example:</p><pre>/var/lib/mysql</pre><p>Configured as:</p><pre>/var/lib/mysq1</pre><p>A single incorrect character prevents the application from finding its data.</p><h3>Wrong Container</h3><p>In a multi-container Pod, the volume may be mounted into one container but the application runs in another.</p><h3>Incorrect subPath</h3><p>The subPath points to a directory that doesn&#39;t exist inside the volume.</p><h3>Read-Only Volume</h3><p>The volume is mounted using:</p><pre>readOnly: true</pre><p>The application requires write access and fails.</p><h3>File Permissions</h3><p>The mount path exists, but the application user lacks permission to access it.</p><h3>Essential Commands Every DevOps Engineer Should Know</h3><pre>kubectl get pods</pre><pre>kubectl logs &lt;pod-name&gt;</pre><pre>kubectl describe pod &lt;pod-name&gt;</pre><pre>kubectl get pvc</pre><pre>kubectl get pv</pre><pre>kubectl exec -it &lt;pod-name&gt; -- sh</pre><pre>mount</pre><pre>df -h</pre><pre>ls -l</pre><pre>kubectl get deployment -o yaml</pre><pre>kubectl rollout restart deployment &lt;deployment-name&gt;</pre><h3>Interview Question</h3><p><strong>Interviewer:</strong></p><p><em>“Your Pod is running, the PVC is Bound, but the application still cannot access its files. How would you troubleshoot it?”</em></p><h3>Strong Answer</h3><blockquote><em>“I would first verify the Pod status and review the application logs to understand the failure. Next, I’d confirm that the PVC and PV are both in the Bound state, indicating storage is available. I’d describe the Pod to verify the mounted volumes, then inspect the Deployment YAML to compare the configured </em><em>mountPath with the application&#39;s expected directory. If necessary, I&#39;d access the container using </em><em>kubectl exec to verify the mounted directories and file system. After correcting the </em><em>mountPath, I&#39;d redeploy the application and confirm that the application can successfully read and write data.&quot;</em></blockquote><h3>Key Takeaway</h3><p>A <strong>Volume Mount Failure</strong> isn’t always a storage problem. When the <strong>PVC</strong> and <strong>PV</strong> are both <strong>Bound</strong>, the issue often lies in the <strong>mountPath configuration</strong>. Always verify that the application&#39;s expected directory matches the configured mount path before investigating the storage backend. A structured troubleshooting approach helps identify configuration issues quickly and minimizes downtime in production Kubernetes environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f14634b2e67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Day 32 — Kubernetes Debugging Series]]></title>
            <link>https://medium.com/@gadamsettirakesh6/day-32-kubernetes-debugging-series-162f601d7e85?source=rss-994749ada411------2</link>
            <guid isPermaLink="false">https://medium.com/p/162f601d7e85</guid>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Gadamsetti Rakesh]]></dc:creator>
            <pubDate>Thu, 30 Jul 2026 02:30:23 GMT</pubDate>
            <atom:updated>2026-07-30T02:30:23.472Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NcssnP8FPTLCau1c0SedxA.png" /></figure><h3>StorageClass Issue → Wrong Provisioner</h3><h3>📌 Scenario</h3><p>A developer creates a <strong>PersistentVolumeClaim (PVC)</strong> expecting Kubernetes to dynamically provision storage.</p><p>However:</p><ul><li>❌ PVC remains in <strong>Pending</strong></li><li>❌ Pod remains in <strong>Pending</strong></li><li>❌ No PersistentVolume (PV) is created automatically</li></ul><p>This issue commonly occurs when the <strong>StorageClass is configured with the wrong provisioner</strong> or the required <strong>CSI Driver</strong> is not installed.</p><p>As an experienced DevOps Engineer, don’t immediately blame Kubernetes. Follow a structured troubleshooting approach to identify the exact root cause.</p><h3>Understanding the Storage Provisioning Flow</h3><p>Before troubleshooting, understand how dynamic provisioning works.</p><pre>Application<br>      │<br>      ▼<br>Deployment<br>      │<br>      ▼<br>Pod<br>      │<br>      ▼<br>PersistentVolumeClaim (PVC)<br>      │<br>      ▼<br>StorageClass<br>      │<br>      ▼<br>Provisioner (CSI Driver)<br>      │<br>      ▼<br>PersistentVolume (Automatically Created)<br>      │<br>      ▼<br>Storage Backend (AWS EBS / Azure Disk / GCE PD)</pre><p>If the StorageClass points to the wrong provisioner, Kubernetes cannot create a PersistentVolume, causing the PVC to remain in the <strong>Pending</strong> state.</p><h3>Step 1 — Identify the Problem</h3><p>A developer reports:</p><blockquote><em>“My application is stuck in Pending, and no storage is being created.”</em></blockquote><p>Start by checking the Pod status.</p><pre>kubectl get pods</pre><p>Example:</p><pre>NAME         READY   STATUS    AGE<br>mysql-0      0/1     Pending   5m</pre><h3>Why?</h3><p>A Pending Pod often indicates that one of its required resources, such as storage, is unavailable.</p><h3>Step 2 — Describe the Pod</h3><p>Inspect the Pod events.</p><pre>kubectl describe pod mysql-0</pre><p>Example:</p><pre>Warning  FailedScheduling</pre><pre>pod has unbound immediate PersistentVolumeClaims</pre><h3>Why?</h3><p>The Pod cannot start because the requested PersistentVolumeClaim is not yet bound.</p><h3>Step 3 — Check the PVC</h3><p>Verify the PVC status.</p><pre>kubectl get pvc</pre><p>Example:</p><pre>NAME         STATUS     VOLUME<br>mysql-pvc    Pending</pre><h3>Why?</h3><p>A PVC in the Pending state confirms that storage has not been provisioned.</p><h3>Step 4 — Describe the PVC</h3><p>This is one of the most important troubleshooting steps.</p><pre>kubectl describe pvc mysql-pvc</pre><p>Example:</p><pre>Status: Pending</pre><pre>StorageClass: gp3</pre><pre>Events:</pre><pre>waiting for a volume to be created by external provisioner</pre><p>or</p><pre>Provisioning failed</pre><h3>Why?</h3><p>The Events section often tells you whether the StorageClass or provisioner is causing the issue.</p><h3>Step 5 — Verify the StorageClass</h3><p>List all StorageClasses.</p><pre>kubectl get storageclass</pre><p>Example:</p><pre>NAME     PROVISIONER</pre><pre>gp3      ebs.csi.aws.com</pre><p>Describe the StorageClass.</p><pre>kubectl describe storageclass gp3</pre><p>Example:</p><pre>Provisioner:</pre><pre>ebs.csi.aws.com</pre><h3>Why?</h3><p>Confirm that the StorageClass references the correct provisioner for your environment.</p><h3>Step 6 — Compare the Provisioner</h3><p>Example of an incorrect configuration:</p><pre>provisioner: kubernetes.io/aws-ebs</pre><p>Example of the correct configuration for modern Amazon EKS clusters:</p><pre>provisioner: ebs.csi.aws.com</pre><h3>Why?</h3><p>The in-tree AWS EBS provisioner has been replaced by the Amazon EBS CSI Driver in newer Kubernetes versions. Using an outdated provisioner prevents dynamic volume provisioning.</p><h3>Step 7 — Verify the CSI Driver</h3><p>Check whether the CSI Driver is installed.</p><pre>kubectl get pods -n kube-system</pre><p>Example:</p><pre>ebs-csi-controller-xxxxx</pre><pre>Running</pre><pre>ebs-csi-node-xxxxx</pre><pre>Running</pre><h3>Why?</h3><p>If the CSI Driver Pods are missing or unhealthy, Kubernetes cannot provision storage.</p><h3>Step 8 — Inspect the CSI Driver Logs</h3><p>If the CSI Pods are running but provisioning still fails, inspect the logs.</p><pre>kubectl logs -n kube-system deployment/ebs-csi-controller</pre><p>Possible errors:</p><pre>failed to provision volume</pre><pre>could not find provisioner</pre><pre>access denied</pre><pre>driver not registered</pre><h3>Why?</h3><p>The logs provide detailed information about why the provisioning request failed.</p><h3>Step 9 — Verify IAM Permissions (AWS)</h3><p>For Amazon EKS, ensure the CSI Driver has the required IAM permissions.</p><p>Example:</p><pre>AmazonEBSCSIDriverPolicy</pre><h3>Why?</h3><p>Without the appropriate IAM policy, the CSI Driver cannot create EBS volumes.</p><h3>Step 10 — Check Cluster Events</h3><p>View recent events.</p><pre>kubectl get events --sort-by=.metadata.creationTimestamp</pre><p>Example:</p><pre>ProvisioningFailed</pre><pre>storageclass.storage.k8s.io &quot;gp3&quot; not found</pre><p>or</p><pre>no matches for provisioner</pre><h3>Why?</h3><p>Events often identify the exact reason dynamic provisioning failed.</p><h3>Step 11 — Identify the Root Cause</h3><p>Review your findings.</p><p>ComponentStatusPodPendingPVCPendingStorageClassPresentProvisioner❌ IncorrectCSI DriverRunning</p><h3>Root Cause</h3><p>The StorageClass is configured with an incorrect or unsupported provisioner.</p><p>Because Kubernetes cannot locate the specified provisioner, it cannot dynamically create a PersistentVolume.</p><h3>Step 12 — Fix the Issue</h3><p>Update the StorageClass with the correct provisioner.</p><p>Incorrect:</p><pre>provisioner: kubernetes.io/aws-ebs</pre><p>Correct:</p><pre>provisioner: ebs.csi.aws.com</pre><p>Apply the updated manifest.</p><pre>kubectl apply -f storageclass.yaml</pre><p>If required, recreate the PVC so that provisioning is retried.</p><h3>Step 13 — Verify the Fix</h3><p>Check the PVC.</p><pre>kubectl get pvc</pre><p>Expected:</p><pre>NAME         STATUS</pre><pre>mysql-pvc    Bound</pre><p>Check the PV.</p><pre>kubectl get pv</pre><p>Expected:</p><pre>NAME         STATUS</pre><pre>pvc-xxxx     Bound</pre><p>Finally, verify the Pod.</p><pre>kubectl get pods</pre><p>Expected:</p><pre>NAME        READY   STATUS</pre><pre>mysql-0     1/1     Running</pre><h3>Production Troubleshooting Flow</h3><pre>Application Pending<br>        │<br>        ▼<br>Check Pod<br>        │<br>        ▼<br>Describe Pod<br>        │<br>        ▼<br>Check PVC<br>        │<br>        ▼<br>Describe PVC<br>        │<br>        ▼<br>Check StorageClass<br>        │<br>        ▼<br>Verify Provisioner<br>        │<br>        ▼<br>Check CSI Driver<br>        │<br>        ▼<br>Review CSI Logs<br>        │<br>        ▼<br>Verify IAM Permissions<br>        │<br>        ▼<br>Fix Provisioner<br>        │<br>        ▼<br>PVC Bound<br>        │<br>        ▼<br>Pod Running</pre><h3>Common Root Causes</h3><h3>Wrong Provisioner</h3><p>StorageClass points to an unsupported or outdated provisioner.</p><h3>CSI Driver Not Installed</h3><p>No controller is available to provision storage.</p><h3>CSI Driver Not Running</h3><p>Controller Pods are in CrashLoopBackOff or Error.</p><h3>Missing IAM Permissions</h3><p>The CSI Driver cannot create cloud storage resources.</p><h3>Incorrect StorageClass Name</h3><p>PVC references a StorageClass that does not exist.</p><h3>Default StorageClass Missing</h3><p>Dynamic provisioning cannot occur if no appropriate StorageClass is available.</p><h3>Essential Commands Every DevOps Engineer Should Know</h3><pre>kubectl get pods</pre><pre>kubectl describe pod &lt;pod-name&gt;</pre><pre>kubectl get pvc</pre><pre>kubectl describe pvc &lt;pvc-name&gt;</pre><pre>kubectl get storageclass</pre><pre>kubectl describe storageclass &lt;storageclass-name&gt;</pre><pre>kubectl get pv</pre><pre>kubectl get pods -n kube-system</pre><pre>kubectl logs -n kube-system deployment/ebs-csi-controller</pre><pre>kubectl get events --sort-by=.metadata.creationTimestamp</pre><h3>Interview Question</h3><p><strong>Interviewer:</strong></p><p><em>“Your PersistentVolumeClaim is stuck in Pending because of a StorageClass issue. How would you troubleshoot it?”</em></p><h3>Strong Answer</h3><blockquote><em>“I would first confirm that the Pod is waiting for a PersistentVolumeClaim by describing the Pod and reviewing its events. Next, I’d inspect the PVC status and events to determine whether dynamic provisioning is failing. Then I’d verify that the referenced StorageClass exists and uses the correct provisioner. I’d confirm that the CSI Driver is installed and healthy, inspect its logs for provisioning errors, and verify any required cloud permissions such as IAM roles in Amazon EKS. Once the incorrect provisioner or configuration issue is corrected, I’d verify that the PVC transitions to Bound, the PV is created, and the Pod moves to the Running state.”</em></blockquote><h3>Key Takeaway</h3><p>A <strong>Pending PVC</strong> caused by a <strong>wrong StorageClass provisioner</strong> is typically a configuration issue rather than a Kubernetes failure. Effective troubleshooting involves validating the entire provisioning path — from the Pod and PVC through the StorageClass, provisioner, CSI Driver, and cloud permissions. Following this structured approach helps identify the root cause quickly and ensures reliable storage provisioning in production Kubernetes environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=162f601d7e85" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>