<?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 Vrishabh Agamya on Medium]]></title>
        <description><![CDATA[Stories by Vrishabh Agamya on Medium]]></description>
        <link>https://medium.com/@agamya.vrishabh?source=rss-7f92936f2485------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zD1gF6ab4eIcJlOZJEZbHQ.jpeg</url>
            <title>Stories by Vrishabh Agamya on Medium</title>
            <link>https://medium.com/@agamya.vrishabh?source=rss-7f92936f2485------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 01:51:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@agamya.vrishabh/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[Where does a pod actually run?]]></title>
            <link>https://medium.com/@agamya.vrishabh/where-does-a-pod-actually-run-983c14688e17?source=rss-7f92936f2485------2</link>
            <guid isPermaLink="false">https://medium.com/p/983c14688e17</guid>
            <category><![CDATA[site-reliability-engineer]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Vrishabh Agamya]]></dc:creator>
            <pubDate>Sun, 06 Sep 2026 16:16:25 GMT</pubDate>
            <atom:updated>2026-09-06T16:16:25.642Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*55iBK36drVpoO4NCk3ijVw.png" /></figure><p><em>A systems field guide to Kubernetes node allocation</em></p><p><strong>The one idea.</strong> Every pod carries a request (what it reserves) and a limit (what it may burst to). Placement is decided on reservations. Survival is decided on reality. The scheduler packs pods onto nodes by comparing requested CPU to capacity — and never looks at how busy a node actually is. When a pod needs to burst above its request (booting a heavy app, say) and lands on a node that&#39;s already using its cores, it starves. The gap between reserved and used is where pods go to die.</p><h3>§1 · The puzzle: two identical pods, two fates</h3><p>During a routine autoscale-up, two replicas of the same service were scheduled in the same second, from the same container image. One landed on a lightly-loaded node and was serving traffic in about three minutes. The other landed on a node already running at 90% CPU, failed its startup health check for eighteen minutes, and was killed. Nothing about the pods differed. The only variable was the node.</p><p>That is a strange result if you think a pod is a pod. It stops being strange once you understand that a pod’s fate is set by two separate systems that don’t talk to each other: the scheduler, which chose the node, and the Linux kernel, which then decided how much CPU the pod actually got. This article walks that path end to end.</p><h3>§2 · Two numbers every pod carries</h3><p>Before anything is scheduled, each container declares two CPU numbers (and the same for memory):</p><ul><li><strong>request</strong> — “reserve this much for me.” A guarantee. The scheduler won’t place the pod on a node that can’t set this aside.</li><li><strong>limit</strong> — “let me use up to this, if there’s spare.” A ceiling. Best-effort above the request.</li></ul><p>The interesting behaviour of the entire system lives in the gap between these two. A pod that requests 0.75 cores but has a limit of 3 is saying: “guarantee me three-quarters of a core, but I’d like to grab up to three when I can.” Booting a large Rails or Spring app is exactly this shape — it idles at a fraction of a core but needs a multi-core burst for ~90 seconds at startup.</p><p>The ratio of request to limit also fixes the pod’s Quality-of-Service class, which decides who gets evicted first under pressure:</p><ul><li><strong>Guaranteed</strong> — request == limit. Reserves its ceiling; hardest to evict.</li><li><strong>Burstable</strong> — request &lt; limit. Reserves a floor, borrows above it. Most pods.</li><li><strong>BestEffort</strong> — no request/limit. Reserves nothing; evicted first.</li></ul><h3>§3 · How the scheduler picks a node</h3><p>When a pod needs a home, the scheduler runs a two-phase decision over every node in the cluster, then binds the pod to the winner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7VFHYL2vGl1Z37WYjP2Pxg.png" /></figure><p><strong>Filter</strong> narrows the cluster to feasible nodes — ones where the pod’s CPU/memory request fits in the unreserved space, plus any affinity, taint, and topology rules. <strong>Score</strong> ranks the survivors and picks the best. <strong>Bind</strong> writes the choice.</p><p>Here is the load-bearing fact for everything that follows: the scheduler reasons entirely in requests. “Does it fit?” means “does its request fit in the unreserved requests?” — not “is this node busy?” A node can be pinned at 95% real CPU and still look wide open to the scheduler, as long as its reservations aren’t full.</p><p>The Score step is also where cluster policy shows up. Two common strategies point in opposite directions:</p><ul><li><strong>Spread</strong> (least-allocated wins) — favours the emptiest node. Pods fan out.</li><li><strong>Bin-pack</strong> (most-allocated wins) — favours the fullest node that still fits. Pods pile onto already-loaded nodes so the cluster can drop empty ones and save money. On GKE, this is the optimize-utilization autoscaling profile.</li></ul><p>Bin-packing is a perfectly reasonable cost optimisation — until you remember it packs by reservations and is blind to heat. It will happily steer a new pod toward the fullest-by-request node, which is very often also the hottest-by-usage node.</p><h3>§4 · What happens after it lands: the Linux side</h3><p>Scheduling ends the moment the pod is bound. Now the Linux Completely Fair Scheduler (CFS) takes over, turning those same two numbers into two very different runtime mechanisms.</p><p>The <strong>request</strong> becomes a weight (cpu.shares). Under contention, CFS hands out CPU in proportion to these weights — so the request is a floor: when everyone wants CPU at once, a pod gets at least its share. The request does double duty — it&#39;s both a scheduling reservation and a runtime priority.</p><p>The <strong>limit</strong> becomes a quota. CFS slices time into 100ms periods and grants each container limit × 100ms of CPU per period. Burn through it early, and the kernel freezes the container until the next period — this is throttling.</p><p>This quota is easy to underestimate because it’s spent in <em>CPU-time</em>, not wall-clock time — and the two only match on a single core. A limit of 2000m gives a 200ms quota per 100ms window. One thread can&#39;t burn that in under 200ms wall-clock. But eight threads running flat-out in parallel — exactly what a JVM boot looks like, between GC, JIT, and class loading — burn 8 × 100ms = 800ms of CPU time in just 100ms of wall-clock. A 200ms quota is gone in roughly 25ms, and the container is frozen for the remaining 75ms of that window, repeatedly, for as long as the burst lasts.</p><p>Requests set what you’re guaranteed. Limits set what you’re capped at. The whole drama plays out in the space between them.</p><h3>§5 · Requested vs used: the number that lies</h3><p>Two commands describe the same node, and they do not agree:</p><ul><li>kubectl describe node shows <strong>requests and limits</strong> — the reservations. This is the scheduler&#39;s worldview.</li><li>kubectl top node shows <strong>usage</strong> — the actual cores being burned right now.</li></ul><p>These diverge, often sharply. A production node in the incident read 94% requested but only 54% used. Another read 99% requested and 2% used. Reservations and reality are two separate books.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LAdbDjIUeFlaAC5q6d8yXg.png" /></figure><p>Why do they diverge? Two reasons, pulling in opposite directions. Pods that under-use their reservation (a Guaranteed service holding 4 cores but using 0.4) push requested above used. Pods that burst above their reservation push used above requested. On any real cluster both happen at once, so the two totals wander apart — and the scheduler, reading only the first, has a systematically wrong picture of how much room a node really has.</p><h3>§6 · Overcommit: selling more than you own</h3><p>Because limits are ceilings, not reservations, the scheduler never checks them against capacity. So the sum of limits on a node can blow past 100%. In the incident, one 32-core node had CPU limits totalling 658% — about 210 cores of “burstable” ceiling promised on hardware that has 32.</p><p>This is deliberate, and usually fine. It’s airline overbooking: sell more seats than the plane has, betting most passengers won’t show up at once. It buys density — you pack far more pods per node — and it works as long as everyone doesn’t burst simultaneously. When they do, there are still only 32 real cores, and the promises can’t all be kept. The pods relying on borrowed CPU — the ones bursting above their requests — are the ones left standing when the music stops.</p><h3>§7 · Two ways CPU runs out — and only one shows up on the dashboard</h3><p>This is the distinction that trips everyone up. There are two entirely different CPU failure modes, and they light up different metrics.</p><p><strong>Throttling</strong> is hitting your own limit. You wanted more CPU than your quota allows in a 100ms window, so the kernel paused you. The cpu.cfs.throttled.periods metric counts these. High throttling means your limit is binding — a sizing signal about the ceiling.</p><p><strong>Starvation</strong> is not getting CPU that others are holding. The node is saturated, and although you’re runnable, you’re waiting in the run-queue for a core that’s always busy. You’re being denied CPU you’d happily use.</p><p>Here’s the trap: a starved pod shows <strong>low throttling</strong>. It never reaches its own ceiling — it can’t even get that far. So if you go looking for a starving pod on a throttle dashboard, it’s invisible. Throttling measures a pod bumping its head on its own limit; starvation measures a pod that can’t get off the floor. Watching the wrong gauge is how a CPU problem hides in plain sight.</p><h3>§8 · The autoscalers don’t rescue you</h3><p>Surely something notices a hot node? Two autoscalers are watching, and neither is looking at the thing that matters.</p><p>The <strong>Horizontal Pod Autoscaler</strong> adds pods when a metric (CPU%, request rate) crosses a target. It reacts to load on the service, not to any individual node’s heat.</p><p>The <strong>Cluster Autoscaler</strong> adds nodes — but only when a pod is Pending, i.e. can&#39;t be scheduled anywhere. A pod that does schedule (onto a hot node, because its small request fit) is never Pending, so the autoscaler sees no problem and adds nothing.</p><p>And overcommit widens the blind spot further: the cluster autoscaler fires on request saturation (~100% reserved), but contention happens at usage saturation (~100% used)—which, with limits at 658%, arrives long before. So the autoscaler sits idle while pods are already starving. Everyone in the loop is reading reservations; the pod is dying on reality.</p><h3>§9 · Putting it together: why the boot died</h3><p>Now the opening puzzle resolves. Follow the doomed pod:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*omQEMpMYrwaqhXM9XSliAw.png" /></figure><p>Every link is a system doing its job correctly. The scheduler placed the pod where its request fit — correct. Bin-packing preferred the fullest node — correct, per policy. CFS gave the pod its guaranteed floor — correct; the floor was just far below what boot needed. The probe killed a pod that never became healthy — correct. No single component is broken. The failure lives in the seam between placement (reservations) and execution (reality) — a seam nobody is watching.</p><h3>§10 · How to reason about it</h3><p>Once you hold the two-books model, the operational questions get sharp answers.</p><ul><li><strong>Why did a pod land here?</strong> → look at CPU <em>requested</em> → describe node</li><li><strong>Will a pod starve here?</strong> → look at CPU <em>used</em> → top node</li><li><strong>Is a pod’s limit binding?</strong> → look at <em>throttle %</em> → cfs.throttled metrics</li><li><strong>Is a pod starved?</strong> → look at <em>restarts + boot time</em> → events / probe status</li></ul><p><strong>Field commands</strong>, tied to the numbers already used in this piece:</p><pre># The scheduler&#39;s worldview vs. reality, on the same node<br>$ kubectl describe node &lt;node&gt;<br>  Allocated resources:<br>    Resource   Requests    Limits<br>    cpu        30140m (94%) 210560m (658%)<br><br>$ kubectl top node &lt;node&gt;<br>  NAME       CPU(cores)   CPU%<br>  &lt;node&gt;     17280m       54%<br><br># Is THIS pod throttling (hit its own ceiling) or starving (denied a core)?<br>$ kubectl exec &lt;pod&gt; -- cat /sys/fs/cgroup/cpu.stat<br>  nr_periods 1200<br>  nr_throttled 4          # low → not throttling<br>  throttled_usec 31000<br><br># Confirm starvation directly: time spent runnable but waiting for a CPU<br>$ kubectl exec &lt;pod&gt; -- cat /sys/fs/cgroup/cpu.pressure<br>  some avg10=38.42 avg60=41.10 avg300=22.05 total=91820441<br>  # &quot;some&quot; = % of time at least one task was waiting on a core it didn&#39;t get.<br>  # High &quot;some&quot; + low nr_throttled is the starvation signature.</pre><p>nr_throttled low but cpu.pressure&#39;s some line high, alongside repeated restarts and slow boots, is the fingerprint of starvation rather than throttling — the exact pattern behind §9.</p><p>And the levers, in order of how directly they close the seam:</p><ol><li><strong>Right-size requests to real usage.</strong> When the request reflects what a pod actually needs — including its boot burst — the scheduler’s reservation view stops lying, and the pod gets a floor big enough to survive. This is the cheapest, most direct fix.</li><li><strong>Fix placement.</strong> A dedicated node pool, anti-affinity, or a genuinely load-aware scheduler keeps burst-sensitive pods off saturated nodes. Switching a bin-packing profile back to spread is a blunt but effective version.</li><li><strong>Mind the profile and the overcommit.</strong> Know whether your cluster packs or spreads, and keep the limit-to-request ratio sane so “reserved” and “used” don’t drift into fantasy.</li></ol><h3>§11 · Conclusion: what the scheduler doesn’t see</h3><p>Kubernetes scheduling is often taught as “the scheduler finds a node with room.” That’s true, but “room” is a reservation — a promise on a spreadsheet — and a pod doesn’t run on promises. It runs on cores, right now, shared with every other pod bursting at the same instant.</p><p>Hold both pictures at once and the whole class of “it works on that node, but not this one” bugs becomes legible. Placement is decided on what’s reserved. Survival is decided on what’s used. Learn to read both books, and never trust one to tell you what the other knows.</p><p><em>Concepts covered: Kubernetes scheduler (filter/score/bind) · Resource requests &amp; limits · CFS shares &amp; quota · QoS classes · CPU overcommit · Throttling vs Starvation · HPA &amp; cluster autoscaler · Bin-pack vs Spread scheduling.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=983c14688e17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manage Personal and Work GitHub Accounts in VS Code]]></title>
            <link>https://medium.com/@agamya.vrishabh/manage-personal-and-work-github-accounts-from-vs-code-4ff01969eb48?source=rss-7f92936f2485------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ff01969eb48</guid>
            <dc:creator><![CDATA[Vrishabh Agamya]]></dc:creator>
            <pubDate>Sat, 01 Feb 2025 09:50:35 GMT</pubDate>
            <atom:updated>2025-02-01T09:53:03.256Z</atom:updated>
            <content:encoded><![CDATA[<p>For setting up both personal and work GitHub accounts in a single VS Code, we will be needing two SSH keys, one for your personal account and other one for your work account.</p><p><strong>Open terminal and go to the .ssh directory</strong></p><pre>cd ~/.ssh</pre><p><strong>Check if you already have an SSH key</strong></p><p>Check if an SSH key already exists, which will have a .pub extension. Typically, you will have a work-related SSH key that you use to access your work GitHub account from your local machine, especially if you’re working on a workspace machine where the connection to your work GitHub account is set up using SSH.</p><pre>ls -al ~/.ssh</pre><p><strong>Generate a new SSH key</strong></p><p>If you have a work SSH key already present in your system, you can just run the command to generate the SSH key for your personal account. Otherwise, you can run both commands in .ssh directory.</p><pre>#execute one by one<br>ssh-keygen -t ed25519 -C &quot;personal_email_address&quot; -f ~/.ssh/&lt;personal_github_username&gt;<br>ssh-keygen -t ed25519 -C &quot;company_email_address&quot; -f ~/.ssh/&lt;company_github_username&gt;</pre><p>It asks for a passphrase just leave it empty and press enter.</p><p><strong>Start SSH-agent</strong></p><pre>eval `ssh-agent -s`</pre><p>Then you get an output similar to Agent pid 76228</p><p><strong>Add SSH keys to SSH-agent</strong></p><pre>#execute one by one<br>ssh-add ~/.ssh/personal_github_username  #personal SSH key<br>ssh-add ~/.ssh/company_github_username   #Company SSH key</pre><p><strong>Add the SSH keys to Github Account</strong></p><p>Copy the SSH keys first from your local:</p><pre>#execute one by one<br>cat ~/.ssh/&lt;personal_github_username&gt;.pub<br>cat ~/.ssh/&lt;company_github_username&gt;.pub</pre><p>Add these keys to your both work and personal github accounts. Go to GitHub → Settings → SSH and GPG Keys → New SSH Key</p><p><strong>Create config file</strong></p><p>Inside .ssh directory, run the following commands to create a config file if it does not exist already.</p><pre>#execute one by one<br>touch config<br>nano config</pre><p>Add the below content inside the config file.</p><pre>#inside ~/.ssh/config<br>Host github.com<br>  AddKeysToAgent yes<br>  UseKeychain yes<br>  IdentityFile ~/.ssh/&lt;work_ssh_key&gt; # Default key (You can also use personal key)</pre><p>After making the changes, you can press Ctrl + X and then enter Y to save the changes and exit.</p><p><strong>Go to root directory and create three more files</strong></p><pre>cd ~<br>touch .gitconfig<br>touch .gitconfig.work<br>touch .gitconfig.personal</pre><p>Open the three files using vim/nano and add the below code.</p><ul><li>.gitconfig.work</li></ul><pre>#inside ~/.gitconfig.work<br>[user]<br>email = &lt;company_email_address&gt;<br>name = &lt;Your Name&gt;<br> <br>[github]<br>user = &quot;&lt;company_github_username&gt;&quot; #should be inside double quote.<br> <br>[core]<br>sshCommand = &quot;ssh -i ~/.ssh/&lt;company_github_username&gt;&quot; #should be inside double quote</pre><ul><li>.gitconfig.personal</li></ul><pre>#inside ~/.gitconfig.personal<br>[user]<br>email = &lt;personal_email_address&gt;<br>name = &lt;Your Name&gt;<br> <br>[github]<br>user = &quot;&lt;personal_github_username&gt;&quot; #should be inside double quote.<br> <br>[core]<br>sshCommand = &quot;ssh -i ~/.ssh/&lt;personal_github_username&gt;&quot; #should be inside double quote</pre><ul><li>.gitconfig</li></ul><pre>#inside ~/.gitconfig<br>[includeIf &quot;gitdir:/Users/&lt;user_name&gt;/&lt;directory_for_personal_repos&gt;/&quot;] # include for all .git projects under Personal/ <br>path = ~/.gitconfig.personal<br> <br>[includeIf &quot;gitdir:/Users/&lt;user_name&gt;/&lt;directory_for_work_repos&gt;/&quot;] # include for all .git projects under Work/<br>path = ~/.gitconfig.work  <br> <br>[core]<br>excludesfile = ~/.gitignore      # Ignore .gitconfig files valid everywhere</pre><p><strong>That’s all, now you can try to clone and make changes to both personal and work repos. Please note this might not work for your pre-cloned repos, try deleting them from your local and re-clone them.</strong></p><pre>git clone git@github.com:&lt;personal_username&gt;/&lt;personal_repo_name&gt;.git #personal<br>git clone git@github.com:&lt;work_username&gt;/&lt;work_repo_name&gt;.git #work</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ff01969eb48" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>