<?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 Hamza Bharmal on Medium]]></title>
        <description><![CDATA[Stories by Hamza Bharmal on Medium]]></description>
        <link>https://medium.com/@b-hamza?source=rss-c21a056e4c77------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Hamza Bharmal on Medium</title>
            <link>https://medium.com/@b-hamza?source=rss-c21a056e4c77------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:12:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@b-hamza/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[Kubernetes Controller Memory Optimization: Cache Configuration Best Practices]]></title>
            <link>https://b-hamza.medium.com/kubernetes-controller-memory-optimization-cache-configuration-best-practices-9923072bd102?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/9923072bd102</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Fri, 31 Jul 2026 18:26:51 GMT</pubDate>
            <atom:updated>2026-07-31T18:26:51.850Z</atom:updated>
            <content:encoded><![CDATA[<p><em>By </em><a href="https://medium.com/u/5a0503cd70a7"><em>Karan Kumar</em></a><em> &amp; </em><a href="https://medium.com/u/c21a056e4c77"><em>Hamza Bharmal</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lr7q1wTYpuGQ9jH-VhUm7Q.png" /></figure><p>In Part 1 we covered what the cache is, how the informer pipeline works, and why client.Get() never touches the network. If you have not read that yet, start there.</p><p>This part is about what happens when the cache gets expensive, and what to do about it.</p><h3>Where the memory goes</h3><p>The indexer holds in-memory copies of every object it watches. Not summaries, not metadata. Full Go structs, the same objects you would get from a live API call. That includes ManagedFields, Annotations, full Status blocks, everything.</p><p>How much is that? A typical Pod object lands somewhere between 8 and 15 KB, depending on how many annotations it carries and how long its status history is. In a cluster with 20,000 pods:</p><pre>20,000 pods × 10 KB average = ~200 MB</pre><p>That is just Pods. Add Nodes, ConfigMaps, Secrets, and any custom resources your controller cares about, and you are well past the numbers most people set as memory limits.</p><p>But there is a second factor that catches nearly everyone off guard: <strong>each manager process has its own independent cache</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxVUM2WveepNaTd-XNvAJw.png" /></figure><p>Three replicas for high availability means three full, independent copies of the same data sitting in memory simultaneously. A 200 MB cache per replica becomes 600 MB across the deployment, before accounting for other watched types.</p><p>This is exactly what happened in the opening story. The cluster grew from 3,000 pods to 20,000. Nobody increased the memory limit. Three replicas, each holding a full copy, started pushing 490 MB each. Staging had one replica and a fraction of the pods. The crash was inevitable. It just took long enough to feel random.</p><h3>How to control it</h3><p>These techniques compose; you can use several at once. Which ones you reach for depends on what your controller actually watches and how much you want to trim.</p><h3>1. Scope to namespaces</h3><p>If your controller only manages resources in specific namespaces, there is no reason to pull in everything else.</p><pre>cache.Options{<br>    DefaultNamespaces: map[string]cache.Config{<br>        &quot;my-namespace&quot;: {},<br>    },<br>}</pre><p>In a multi-tenant cluster where your controller only touches one or two namespaces, this alone can cut memory by an order of magnitude.</p><h3>2. Use label and field selectors</h3><p>If you only care about a subset of objects of a given type, tell the API server upfront. The filtering happens before events even enter the cache.</p><pre>cache.Options{<br>    ByObject: map[client.Object]cache.ObjectCacheOptions{<br>        &amp;corev1.Pod{}: {<br>            Label: labels.SelectorFromSet(labels.Set{<br>                &quot;app&quot;: &quot;my-app&quot;,<br>            }),<br>        },<br>    },<br>}</pre><p>Only Pods with app=my-app land in the indexer. Everything else is never seen. You can combine this with ByObject to apply different policies per resource type: a tight label selector on Pods, namespace scoping on ConfigMaps, defaults for everything else.</p><h3>3. Cache metadata only</h3><p>If your controller only needs to know a resource exists (its name, labels, owner references) and does not read spec or status, you can cache just the metadata.</p><pre>&amp;metav1.PartialObjectMetadata{<br>    TypeMeta: metav1.TypeMeta{<br>        APIVersion: &quot;v1&quot;,<br>        Kind:       &quot;Pod&quot;,<br>    },<br>}</pre><p>For large objects like Pods, this cuts per-object memory by 60–80%. It is surprisingly underused.</p><h3>4. Transform functions</h3><p>Transform functions intercept each object before it is stored in the cache. You strip fields your controller never reads.</p><pre>cache.Options{<br>    DefaultTransform: func(obj interface{}) (interface{}, error) {<br>        if pod, ok := obj.(*corev1.Pod); ok {<br>            pod.ManagedFields = nil<br>            pod.Annotations = nil<br>            pod.Status.ContainerStatuses = nil<br>        }<br>        return obj, nil<br>    },<br>}</pre><p>ManagedFields is the biggest lever here. In clusters that use server-side apply, it can account for 30–50% of a single object&#39;s serialized size. Stripping it from every cached Pod before it hits the indexer is often the highest-return change you can make, and it requires zero changes to your reconciler logic.</p><p>One thing to be careful about: transform functions apply to the entire cache, not per-reconciler. If another part of your manager reads a field you stripped, it will silently get a zero value. No error, no warning. Only strip fields you are genuinely certain nothing reads.</p><h3>At a glance</h3><p>TechniqueEffortWhen to reach for itNamespace scopingLowController manages specific namespacesLabel / field selectorsLowYou care about a subset of objectsMetadata-only cachingMediumYou only need names, labels, owner refsTransform functionsHigherFull objects needed but fields are large and unused</p><h3>Things worth keeping in mind</h3><p>Use client.Get() as your default. APIReader is not a safer version of the same call. It is a different trade-off with real costs. Use it when you need live state, not as a hedge against eventual consistency.</p><p>Write reconcilers that are idempotent. This is not just a cache thing. It is the foundation of the whole controller model. Stale reads will happen, and an idempotent reconciler handles them without needing special casing.</p><p>Be deliberate about what you watch. Every resource type you add to the cache has a cost: a watch connection to the API server, CPU to process events, and memory to store objects. If your controller does not use Pods, do not watch Pods. Easy to overlook when copy-pasting a new controller from an existing one.</p><p>Pay attention to memory as your cluster scales. A controller that looked fine at 5,000 objects can silently approach its limit at 50,000. Set limits with actual headroom, not just “a bit above current usage.”</p><h3>Back to the crash</h3><p>The controller had no namespace scoping, was watching Pods cluster-wide, and had never had a transform function applied. The cluster had grown from 3,000 pods when it was first deployed to just over 20,000 by the time it crashed. Three replicas, each holding a full copy, ManagedFields intact on every Pod.</p><p>Three changes, all in the cache configuration:</p><pre>cache.Options{<br>    // 1. Scope to the namespace the controller actually manages<br>    DefaultNamespaces: map[string]cache.Config{<br>        &quot;production&quot;: {},<br>    },</pre><pre>    ByObject: map[client.Object]cache.ObjectCacheOptions{<br>        &amp;corev1.Pod{}: {<br>            // 2. Only cache Pods this controller owns<br>            Label: labels.SelectorFromSet(labels.Set{&quot;managed-by&quot;: &quot;my-controller&quot;}),<br>        },<br>    },</pre><pre>    // 3. Strip ManagedFields from every cached object<br>    DefaultTransform: func(obj interface{}) (interface{}, error) {<br>        if acc, ok := obj.(metav1.Object); ok {<br>            acc.SetManagedFields(nil)<br>        }<br>        return obj, nil<br>    },<br>}</pre><p>Memory dropped from ~490 MB per replica to ~60 MB. No OOMKills since. The reconciler code did not change at all.</p><h3>That is it</h3><p>490 MB down to 60. No code changes, no architectural rework. Three lines of cache configuration that should have been there from the start.</p><p>The cache is easy to ignore when it is working. It is fast, transparent, and mostly invisible. The problem is that “working” in a 3,000-pod staging cluster and “working” in a 20,000-pod production cluster with three HA replicas are two very different things, and the gap only shows up when it is too late to be calm about it.</p><p>The levers exist. Namespace scoping, label selectors, metadata-only caching, transform functions, most controllers need maybe two of these, applied early, before the cluster grows into them. The time to think about this is when you are writing the controller, not when you are staring at a CrashLoopBackOff at midnight.</p><p>And honestly, if you are ever debugging unexpected memory usage in a controller and you cannot figure out where it is coming from: it is the cache. It is almost always the cache.</p><h3>About This BlogPost</h3><p>This is <strong>Part 2 of 2</strong> in our Kubernetes controller caching:</p><ul><li><strong>Part 1</strong>: Explains what the controller-runtime cache is, how the informer pipeline works, why client.Get() reads from memory instead of the API server, and why reads can be stale.</li><li><strong>Part 2</strong> (this article): Covers what the cache costs in memory, why replicas multiply the problem, and four proven configuration strategies to optimize memory usage without changing reconciler code.</li></ul><p>If you haven’t read <a href="https://medium.com/@b-hamza/kubernetes-controller-cache-how-the-informer-pipeline-works-860f27b317cd">Part 1</a> yet, start there to understand the fundamentals before diving into optimization techniques.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9923072bd102" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Controller Cache: How the Informer Pipeline Works ?]]></title>
            <link>https://b-hamza.medium.com/kubernetes-controller-cache-how-the-informer-pipeline-works-860f27b317cd?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/860f27b317cd</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Fri, 31 Jul 2026 18:17:59 GMT</pubDate>
            <atom:updated>2026-07-31T18:17:59.955Z</atom:updated>
            <content:encoded><![CDATA[<p><em>By </em><a href="https://medium.com/u/c21a056e4c77"><em>Hamza Bharmal</em></a><em> &amp; </em><a href="https://medium.com/u/5a0503cd70a7"><em>Karan Kumar</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OxAITlKQ8vkJ-zLzL5Yk_Q.png" /></figure><p>A controller pod. OOMKilled. Memory limit 512Mi, actual usage at crash: 514Mi. It ran fine in staging. Nobody changed the code.</p><p>If you have spent time writing Kubernetes controllers, you have probably been here. The instinct (and I have done this) is to bump the memory limit, redeploy, and close the ticket. It works, until it does not. Why the memory was growing at all is almost always the same answer: the controller-runtime cache.</p><p>This is Part 1. It covers what the cache is, why it exists, how it works internally, and why reads from it can sometimes be stale. Part 2 covers what the cache costs in memory and what you can do to control it.</p><h3>A quick word on controllers</h3><p>Kubernetes controllers are reconcile loops. They watch the state of the cluster and continuously drive it toward a desired state (creating resources, updating them, deleting them). controller-runtime is the Go library most operators are built on. It gives you the scaffolding: the manager, the client, the event queues. The cache is a core part of that scaffolding, and it is on by default.</p><h3>What is a cache?</h3><p>Think of the API server as a printing press in a basement. It holds the authoritative state of everything in the cluster. Every time a controller wants to know something: is this Pod running? what is the current replica count? It could go down to the basement and ask directly. That works. It is just slow, and if you have a hundred controllers all doing it constantly, the press starts to buckle.</p><p>Now imagine a person standing at the top of the stairs holding the latest copy. Whenever the press prints something new, they get an updated version. Controllers ask that person instead of making the trip. That person is the cache.</p><p>The cache lives inside your controller process. Reads are in-memory, no network, no round trip. It stays synchronized with the API server through a continuous watch stream. And it is eventually consistent, meaning there is always a small window where it might not reflect the absolute latest state. That last part trips people up more than almost anything else in the controller model.</p><h3>Why Kubernetes needs one</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uK9YZTiY2MSCCbneZSJ2DQ.png" /></figure><p>Take a realistic production cluster: 50,000 Pods, 300 Nodes, 50 controllers, each reconciling frequently. Without caching, every Get call in every reconcile loop is a live request to the API server.</p><p>Fifty controllers, each doing dozens of reads per second. The API server becomes a bottleneck fast. Latency climbs. The API server starts rate-limiting. Reconcile loops back up. Things get weird in ways that are hard to debug because the failures are indirect.</p><p>The cache cuts through that with one trade. Instead of every controller making individual reads, one watch stream per resource type is opened to the API server. All controllers registered to the same manager share that stream (the cache is per-manager, not per-controller). Controllers read from the shared local copy.</p><p>One important nuance: this sharing only applies within a single manager process. If you run two separate operators, say a storage controller and a gateway controller, each with their own ctrl.Manager, they maintain entirely separate caches. There is no cross-process sharing.</p><p>One watch per resource type, per manager. The API server barely notices.</p><h3>Inside the cache</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L1PvumNqgpEjewJ1zoPULQ.png" /></figure><p>When you create a ctrl.Manager and call manager.GetClient(), the client you get back is cache-backed by default. That is easy to miss. Nothing in the method name signals it, and the API looks identical to a live client.</p><p>Under the hood, the cache is built on a Kubernetes concept called an <strong>Informer</strong>. Each resource type you watch gets its own informer. The informer does two things: it keeps a local copy of all objects of that type, and it notifies handlers when something changes.</p><p>Internally, the informer is a three-stage pipeline:</p><p>The <strong>Reflector</strong> opens and holds the watch stream. When an object is created, updated, or deleted, the API server pushes an event down the stream. The reflector catches it.</p><p>The <strong>DeltaFIFO</strong> is a queue. Events land here in order, buffered so that nothing is dropped if the downstream is momentarily busy.</p><p>The <strong>Indexer</strong> (also called the Store) is where objects actually live. It is an in-memory map, and when an event is processed from the queue, the indexer is updated. When your reconciler calls client.Get(), it is querying this map. There is no network involved.</p><p>The whole pipeline runs continuously in the background. You never notice it. Until something breaks, at which point it helps a lot to know what each stage does.</p><h3>What client.Get() actually does</h3><p>This is the part that still surprises people, even engineers who have been writing controllers for a while.</p><pre>// Inside your reconciler:<br>var pod corev1.Pod<br>if err := r.client.Get(ctx, req.NamespacedName, &amp;pod); err != nil {<br>    return ctrl.Result{}, err<br>}</pre><p>That call does not hit the network. It reads from the in-memory indexer. The Pod you get back is a copy of whatever the cache last received from the watch stream. It may be milliseconds old, or a few seconds old if the cluster is under load.</p><p>If you genuinely need the live state (the object as it exists in etcd right now), use APIReader:</p><pre>// This DOES hit the API server<br>var pod corev1.Pod<br>if err := r.apiReader.Get(ctx, req.NamespacedName, &amp;pod); err != nil {<br>    return ctrl.Result{}, err<br>}</pre><pre>apiReader := mgr.GetAPIReader()</pre><p>client.Get() is fast and cheap. APIReader.Get() is slower, and every call adds load to the API server. Default to client.Get(). Reach for APIReader only when you have a specific reason to need current state, like before a destructive or irreversible operation.</p><p>A pattern I have seen go wrong: someone gets nervous about stale reads, switches everything to APIReader &quot;just to be safe,&quot; and accidentally recreates the pre-cache world where every reconcile is a live API call. That is not safer. It is just slower and more expensive.</p><h3>Why reads can be stale</h3><p>The cache stays synchronized through a watch stream, not a synchronous poll. There is always a gap between when the API server records a change and when your cache reflects it. Usually small. Sometimes not.</p><p>Here is what the sequence actually looks like:</p><pre>1. You update a ConfigMap via kubectl<br>2. The API server stores the new version<br>3. The watch event is sent to your controller&#39;s reflector<br>4. The reflector processes it and updates the indexer<br>5. Your reconciler calls client.Get() and finally sees the new version</pre><p>Steps 3 through 5 take time. Usually just milliseconds. Under load, or after a watch reconnect, longer. If your reconciler runs between steps 2 and 5, it sees the old version. This is not a bug. It is how the system is designed to work.</p><p>The Kubernetes controller model is built around <strong>eventual consistency</strong>. The assumption is that your reconciler will be triggered again when things change, so acting on slightly stale data is fine as long as your logic is idempotent. If it is not idempotent, stale reads will eventually cause you pain.</p><blockquote><strong><em>A trap worth naming:</em></strong><em> </em>You create a resource in one reconcile pass, then immediately read it back to verify it exists. The read comes back not-found, or returns the old version, and your controller panics or retries incorrectly. The cache just has not caught up yet. The fix is not to switch to APIReader. The fix is to re-queue and let the next reconcile handle it.</blockquote><p><strong>ResourceVersion</strong> is how Kubernetes tracks object versions. Every write increments it. The watch stream uses it to resume exactly where it left off after a reconnect, so no events are skipped. But that does not eliminate the propagation delay. It only prevents gaps in the event stream.</p><h3>So what is the cache, really?</h3><p>It is the controller’s working view of the cluster, not a caching layer bolted on for speed but the thing the whole model runs on. Every client.Get(), every reconcile trigger, every reaction to a state change goes through it.</p><p>Understanding it does not require reading the source. You just need to know that there is a watch stream, a pipeline, and an in-memory store, and that when you call client.Get(), you are reading from that store, not from the API server.</p><p>What we have not covered yet is what that store costs. In a small cluster, you will not notice. In production with 20,000 pods and three replicas, you will get a 3am Slack message about it.</p><p>Part 2 covers where the memory actually goes, why the replica count multiplies the problem, and the exact configuration changes that brought one controller from 490 MB per replica down to 60. <em>Nobody touched the reconciler code btw.</em></p><h3>About This BlogPost</h3><p>This is <strong>Part 1 of 2</strong> in our Kubernetes controller caching:</p><ul><li><strong>Part 1</strong> (this article): Covers what the controller-runtime cache is, how the informer pipeline works internally, why client.Get() never touches the network, and why cache reads can be stale.</li><li><strong>Part 2</strong>: Explores what the cache costs in memory, why replicas multiply the problem, and practical configuration strategies to optimize memory usage (with real numbers: 490MB → 60MB).</li></ul><p>Start here if you’re new to how controller-runtime works. Jump to <a href="https://medium.com/@b-hamza/kubernetes-controller-memory-optimization-cache-configuration-best-practices-9923072bd102">Part 2</a> if you’re already familiar and looking for optimization techniques.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=860f27b317cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I actually turned the terminal into a productive daily workspace (Zsh, Powerlevel10k & Atuin) ?]]></title>
            <link>https://b-hamza.medium.com/how-i-actually-turned-the-terminal-into-a-productive-daily-workspace-zsh-powerlevel10k-atuin-ac84c9f226dd?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac84c9f226dd</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Sat, 25 Jul 2026 21:10:09 GMT</pubDate>
            <atom:updated>2026-07-25T21:10:09.146Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/852/0*tiCR6aQBJxzbkMvP.png" /></figure><p>A while back I wrote about <a href="https://medium.com/@b-hamza/turning-the-terminal-into-a-productive-daily-workspace-zsh-powerlevel10k-atuin-90e4177bd0c1">why I set up my terminal the way I do</a>. That post was about the thinking. This one is about the actual setup.</p><p>If you read that and thought “okay but how do I do this” then this is that post.</p><p>I’ll go through each step in order, including the thing that tripped me up, so hopefully you don’t hit the same wall.</p><h3>What you’ll have by the end</h3><ul><li>Zsh as your default shell</li><li>oh-my-zsh for keeping config manageable</li><li>Powerlevel10k showing you git status, exit codes, and time at a glance</li><li>Three plugins that make day-to-day typing noticeably less annoying</li><li>Atuin replacing shell history search with something you’ll actually use</li></ul><p>Plan for about 20 minutes on a fresh machine.</p><h3>How your terminal experience actually changes</h3><p>A default terminal does not tell you much. You type, run, and figure out what happened from the output. You want to know what branch you are on, so you run git branch. You want to know if the last command failed, so you scroll up and read. You want a command you ran last week, so you press Ctrl+R and hope you remember enough of it to find it.</p><p>After this setup, most of that goes away.</p><p>The prompt shows your current directory, the git branch, and whether the last command worked or not. You read it the way you read a status bar. It is just there.</p><p>When you start typing, two things help you. A faint suggestion from your history appears on the same line. If that is what you want, press the right arrow and it fills in. Below the cursor, a small dropdown shows completions for the current command, including flags, paths, and branch names.</p><p>Before you press Enter, the command turns green if it is valid and red if it is not. A typo, a missing binary, a bad path. You see it before it runs and fix it on the spot.</p><p>When you need something from history, you press Ctrl+R. You get a search UI that shows the command, the directory it ran in, the exit code, and when it happened. You search by what you remember, not by how recently you ran it.</p><p>Each of these is a small thing. But they add up across a day.</p><h3>Before you start</h3><p>You’ll need:</p><ul><li>git installed</li><li>curl or wget available</li><li>A terminal 😜</li></ul><h3>Step 1: Get Zsh</h3><p>On macOS (Catalina and later), Zsh is already your default shell. Confirm it’s there:</p><pre>zsh --version<br># zsh 5.9 (or similar)</pre><p>On Linux, install it through your package manager:</p><pre># Ubuntu / Debian<br>sudo apt update &amp;&amp; sudo apt install zsh -y</pre><pre># Fedora / RHEL<br>sudo dnf install zsh -y</pre><p>Set it as your default shell:</p><pre>chsh -s $(which zsh)</pre><p>Close and reopen your terminal. You’re now on Zsh.</p><h3>Step 2: Install oh-my-zsh</h3><p>Without some kind of framework, .zshrc files tend to grow into something messy that nobody wants to touch. oh-my-zsh keeps plugins and themes organized so that doesn&#39;t happen.</p><pre>sh -c &quot;$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)&quot;</pre><p>No curl? Use wget:</p><pre>sh -c &quot;$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)&quot;</pre><p>One thing worth knowing before you run this: the installer replaces your existing .zshrc with a fresh one. Your old file gets backed up as .zshrc.pre-oh-my-zsh. If you had aliases or PATH exports in there, grab them from that backup after the install finishes.</p><p>Verify it worked:</p><pre>echo $ZSH<br># /Users/yourname/.oh-my-zsh</pre><h3>Step 3: Install Powerlevel10k</h3><p>Powerlevel10k is the prompt. It tells you where you are, what git branch you’re on, whether your last command succeeded, and what time it is. All without running a separate command.</p><pre>git clone --depth=1 https://github.com/romkatv/powerlevel10k.git \<br>  ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k</pre><p>Open ~/.zshrc and find this line:</p><pre>ZSH_THEME=&quot;robbyrussell&quot;</pre><p>Replace it with:</p><pre>ZSH_THEME=&quot;powerlevel10k/powerlevel10k&quot;</pre><p>Reload:</p><pre>source ~/.zshrc</pre><h3>Step 4: Configure Powerlevel10k</h3><p>Here’s the thing I ran into: the configuration wizard does not always start automatically after you reload. If nothing happens, just run it yourself:</p><pre>p10k configure</pre><p>The wizard shows you visual samples and asks what you prefer at each step. Just go through it and pick what looks right to you , it is hard to make a wrong choice here, and you can always rerun it with p10k configure if you want to change something later.</p><p>When it finishes, the config is saved to ~/.p10k.zsh.</p><p>By default, Powerlevel10k shows more segments than you need. Open ~/.p10k.zsh and trim the two arrays down to what you actually look at:</p><pre>typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(<br>  dir           # where you are<br>  vcs           # git branch and status<br>  prompt_char   # prompt symbol, turns red on error<br>)</pre><pre>typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(<br>  status                  # exit code of last command<br>  command_execution_time  # how long it took<br>  time                    # current time<br>)</pre><p>Remove anything you wouldn’t notice was missing.</p><h3>Step 5: Add three plugins</h3><p>I keep this list short. These are the three I actually use beyond the built-in git plugin.</p><h3>zsh-autosuggestions</h3><p>As you type, it shows a faint suggestion pulled from your history. Press the right arrow key to accept it, or just keep typing.</p><pre>git clone https://github.com/zsh-users/zsh-autosuggestions \<br>  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions</pre><h3>zsh-autocomplete</h3><p>This gives you a live dropdown of completions below your cursor as you type. Commands, paths, flags, git branches. It sits alongside autosuggestions without conflicting, it does the single-line history completions, zsh-autocomplete does the full dropdown menu.</p><pre>git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git \<br>  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autocomplete</pre><h3>zsh-syntax-highlighting</h3><p>Colors a command green if it’s valid, red if it’s not, before you press Enter. Good for catching typos before they fail.</p><pre>git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \<br>  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting</pre><blockquote><em>zsh-syntax-highlighting must be the last plugin in your list. If it&#39;s not, things break in ways that are annoying to debug.</em></blockquote><p>Update your plugins list in ~/.zshrc:</p><pre>plugins=(<br>  git<br>  zsh-autosuggestions<br>  zsh-autocomplete<br>  zsh-syntax-highlighting<br>)</pre><p>Reload:</p><pre>source ~/.zshrc</pre><h3>Step 6: Install Atuin</h3><p>Ctrl+R in a default shell only goes so far. You scroll backwards one entry at a time with no context about when something ran or where.</p><p>Atuin stores your history in a local SQLite database. Press Ctrl+R and you get a proper search UI with the command, the directory it ran in, the exit code, how long it took, and the timestamp.</p><p>Install it:</p><pre># macOS<br>brew install atuin</pre><pre># Linux<br>curl --proto &#39;=https&#39; --tlsv1.2 -LsSf <a href="https://setup.atuin.sh/">https://setup.atuin.sh</a> | sh</pre><p>Add this at the end of your ~/.zshrc:</p><pre>eval &quot;$(atuin init zsh)&quot;</pre><p>Import your existing history so you don’t lose it:</p><pre>atuin import auto</pre><p>Reload:</p><pre>source ~/.zshrc</pre><p>Now press Ctrl+R (or up-arrow). A few other commands worth knowing:</p><pre># Only search commands run from the current directory<br>atuin search --cwd</pre><pre># Search for a specific string<br>atuin search &quot;docker run&quot;</pre><pre># See your most-used commands<br>atuin stats</pre><h3>Step 7: Clean up .zshrc (Optional)</h3><p>After all of this, your .zshrc needs some organization. Here&#39;s the layout I use:</p><pre># Enable Powerlevel10k instant prompt (keep this at the very top)<br>if [[ -r &quot;${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh&quot; ]]; then<br>  source &quot;${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh&quot;<br>fi</pre><pre># --- oh-my-zsh ----------------------------------------------------<br>export ZSH=&quot;$HOME/.oh-my-zsh&quot;<br>ZSH_THEME=&quot;powerlevel10k/powerlevel10k&quot;</pre><pre>plugins=(<br>  git<br>  zsh-autosuggestions<br>  zsh-autocomplete<br>  zsh-syntax-highlighting<br>)</pre><pre>source $ZSH/oh-my-zsh.sh</pre><pre># --- Powerlevel10k ------------------------------------------------<br>[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh</pre><pre># --- Environment --------------------------------------------------<br>export EDITOR=&quot;vim&quot;<br>export PATH=&quot;$HOME/.local/bin:$PATH&quot;</pre><pre># --- Aliases ------------------------------------------------------<br>alias ll=&quot;ls -lAh&quot;<br>alias ..=&quot;cd ..&quot;<br>alias ...=&quot;cd ../..&quot;</pre><pre># --- Atuin --------------------------------------------------------<br>eval &quot;$(atuin init zsh)&quot;</pre><p>The instant prompt block has to stay at line 1. Powerlevel10k uses it to show the prompt before Zsh is fully loaded, which is what makes startup feel fast.</p><h3>Quick sanity check</h3><p>Run these once you’re done:</p><pre># Confirm you&#39;re in Zsh<br>echo $SHELL<br># /bin/zsh or /usr/bin/zsh</pre><pre># Confirm oh-my-zsh loaded<br>echo $ZSH<br># /Users/yourname/.oh-my-zsh</pre><pre># Check startup time<br>time zsh -i -c exit<br># Should be under 200ms, else you will feel slowness.</pre><pre># Check Atuin is working<br>atuin stats</pre><h3>Things that went wrong for me (and how to fix them)</h3><p><strong>The </strong><strong>.zshrc backup.</strong> oh-my-zsh saves your old config as .zshrc.pre-oh-my-zsh. If you had aliases or exports you care about, copy them over before you forget that file exists.</p><p><strong>p10k configure not running automatically.</strong> The wizard doesn&#39;t always launch on its own after source ~/.zshrc. If your prompt looks wrong, run p10k configure manually. That&#39;s it.</p><p><strong>Old history after Atuin.</strong> Once Atuin is running, it takes over history tracking. Your old history gets imported, and the original ~/.zsh_history file stays put if you ever need it.</p><h3>What actually changes</h3><p>The prompt fades into the background pretty quickly. You stop thinking about it and just read the information. Branch, status, whether the last thing worked.</p><p>Atuin is the bigger shift. You stop trying to remember exact command syntax and start searching for things you know you’ve done before. That change in how you think about history is where most of the time savings come from.</p><p>Neither of these tools demand your attention. They just quietly answer questions you’d otherwise have to stop and ask. That’s the whole point.</p><p>If you set this up and something feels off, or you find a plugin that works better for your workflow, I would really like to hear about it.</p><p><em>The thinking behind why I chose this setup over the alternatives is in </em><a href="https://medium.com/@b-hamza/turning-the-terminal-into-a-productive-daily-workspace-zsh-powerlevel10k-atuin-90e4177bd0c1"><em>the original post</em></a><em>.</em></p><p>Thanks for reading !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac84c9f226dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes 101: Why Apps Fail (Even When Everything Looks Fine)]]></title>
            <link>https://b-hamza.medium.com/kubernetes-101-why-apps-fail-even-when-everything-looks-fine-c70b27ea9724?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/c70b27ea9724</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Thu, 16 Jul 2026 21:18:15 GMT</pubDate>
            <atom:updated>2026-07-16T21:18:15.266Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJLzm8dkFoss1RXiQmmv3g.png" /></figure><p><a href="https://medium.com/@b-hamza/kubernetes-101-liveness-vs-readiness-a-pod-running-doesnt-mean-it-s-healthy-ae19961d3d96">Last post</a> we looked at liveness and readiness probes. Kubernetes constantly asking one question: is this Pod healthy enough to take traffic?</p><p>Here’s the annoying part. Even when the answer is yes, your app can still be quietly broken. 😿</p><h3>The misunderstanding I had for way too long</h3><p>When I started, I blamed Kubernetes for basically everything. Pod restarts, crashing containers, apps falling over mid-deploy, surely that’s a Kubernetes problem.</p><p>It mostly wasn’t. Kubernetes wasn’t creating these failures. It was just the first place I actually noticed the assumptions my app had been quietly making the whole time.</p><h3>The assumptions that get exposed</h3><p>Turns out a lot of apps assume things like:</p><ul><li>The database is always reachable</li><li>The network never drops anything</li><li>Files written to disk are still there tomorrow</li><li>Startup is basically instant</li><li>The process only ever starts once, ever</li></ul><p>None of that holds in Kubernetes. Pods get replaced. Nodes vanish. Containers restart mid-request. That’s just Tuesday for a cluster , not a failure state.</p><h3>Desired state gets you halfway, not all the way</h3><p>Kubernetes really is good at one job: shoving the cluster back toward whatever you told it you wanted. Pod dies, it spins up another. Node disappears, it reschedules the work elsewhere. Replica count drops, a controller quietly fixes it.</p><p>What it won’t do is make your app survive any of that. That part’s still on you: retries, a startup that doesn’t assume the DB is already there, handling a dropped connection without silently dying inside, not stashing state on a disk that might not exist in five minutes.</p><h3>The lesson that actually stuck</h3><p>Stop writing apps that expect a calm, stable environment. Write apps that expect to get shoved around occasionally, because they will.</p><p>Kubernetes is going to keep dragging reality back to the desired state on its own schedule. Whether your app can handle the ride is a separate question and one Kubernetes will never answer for you.</p><h3>Next up</h3><p>So how do we stop baking these environment assumptions into our apps in the first place? That’s where ConfigMaps come in.</p><p>Thanks for reading post 13th of Kubernetes 101 ! Follow me for more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c70b27ea9724" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Spent Hours Arguing With ChatGPT Over a LeetCode Problem]]></title>
            <link>https://b-hamza.medium.com/i-spent-hours-arguing-with-chatgpt-over-a-leetcode-problem-ad9fc19cc50e?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad9fc19cc50e</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[writing-prompts]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Wed, 01 Jul 2026 19:02:47 GMT</pubDate>
            <atom:updated>2026-07-01T19:02:47.595Z</atom:updated>
            <content:encoded><![CDATA[<p>Okay so this is not one of those “AI solved leetcode for me” posts, I promise. I solve most of my problems on my own, that part hasn’t changed. What changed was last week I decided to run a weird little experiment on myself. Instead of asking ChatGPT for the optimal solution and closing the tab like I always do, I wanted to see what happens if I treat it like an annoying teammate at a whiteboard. Someone I could actually fight with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*78ePUfkbQ2O6udGX" /></figure><p>I picked <a href="https://leetcode.com/problems/find-the-safest-path-in-a-grid/">Find the Safest Path in a Grid</a>. If you have not seen it, you’re on an n x n grid, some cells got thieves in them, and you are walking from top left to bottom right. “Safeness” of your path is basically the shortest distance (Manhattan distance, so no diagonals) from any cell you stepped on to any thief anywhere on the board. You want to pick the path that keeps you as far as possible from every thief, the whole way.</p><p>One rule before I even opened the chat: code only when I say so. Not before. I did not want a solution, I wanted someone to push back on me.</p><p>Started innocent enough. It gave me the standard move, BFS from every thief at once to get each cell’s distance, then binary search on the answer while checking reachability. Fine. Correct probably, this is basically the textbook move for this shape of problem.</p><p>But I was not buying it. Or, I mean, I believed it worked, I just had this other idea stuck in my head that also felt like it should work and I could not immediately explain why not. So I did not let it go. I pushed.</p><p>Next few hours turned into this loop, over and over:</p><p>“but what if this cell is allowed to be wrong” “here’s a counterexample” “fair. but what about this invariant” “ok that fixes one thing. here’s another problem”</p><p>And on and on it went. It kept breaking my idea, I kept patching it, it broke again somewhere else, I switched up the traversal order, tried going diagonal instead of the usual row by row sweep and somewhere in there we landed on something that actually held up against every case I threw at it.</p><p>Is it some new algorithm nobody’s thought of? Honestly no idea. Probably not, probably just the same maximin idea everyone uses here wearing a different coat. And honestly that’s not even the part I care about.</p><p>Here’s the actual thing I took from the whole afternoon ChatGPT was the most useful to me not when it just handed me the answer, but the moment I gave it something to argue against. The first solution it gave me was fine, I could have copy pasted it in under a minute and been done with my evening. What made this worth two hours instead of four minutes was me refusing to just take that answer, and instead making it defend the idea cell by cell, counterexample by counterexample, until one of us gave in.</p><p>There is a version of using AI that is basically outsourcing your brain. Ask, get answer, paste, done, move on with your day. Nothing wrong with that honestly, works fine for a ton of stuff. But there’s this other mode too and I think it’s way more interesting using it like a patient rubber duck that just keeps throwing counterexamples at you until your idea either falls apart completely or actually gets stronger. It doesn’t get tired of you. It doesn’t get defensive when you tell it it’s wrong for the fifth time. It just keeps generating the next test case, calm as anything.</p><p>Not saying this makes me better at leetcode or whatever. But it made me think about one single problem way harder than I would have sitting alone, staring at a whiteboard with literally no one around to argue with me.</p><p>This was not really an experiment in solving a problem with AI, if I am being honest. It was an experiment in thinking with one. I would do it again in a heartbeat.</p><p>If you have tried something like this, using AI as someone to disagree with instead of just an answer machine do let me know how it went, genuinely curious.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad9fc19cc50e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes 101: Liveness vs Readiness (a Pod running doesn’t mean it’s healthy)]]></title>
            <link>https://b-hamza.medium.com/kubernetes-101-liveness-vs-readiness-a-pod-running-doesnt-mean-it-s-healthy-ae19961d3d96?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae19961d3d96</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Sun, 10 May 2026 19:06:08 GMT</pubDate>
            <atom:updated>2026-05-10T19:06:08.426Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uKSCo1_N8nMxOOs9rXQgiQ.png" /></figure><h3>Recap</h3><p>So far in this series:</p><ul><li>Deployments define desired state</li><li>Controllers continuously enforce it</li><li>Rolling updates replace Pods gradually</li></ul><p>But now we hit an important question:</p><p>How does Kubernetes know if a Pod is actually working?</p><p>Because a Pod being “Running” doesn’t guarantee anything.</p><h3>Problem</h3><p>I’ve seen applications start perfectly…</p><p>Container running<br>Process alive<br>Pod status = Running</p><p>And yet every request failed.</p><p>The app wasn’t ready.</p><p>This is where Kubernetes probes become critical.</p><h3>Kubernetes mainly uses two health checks here:</h3><h3>Readiness Probe</h3><p>Readiness asks:</p><p>“Can this Pod receive traffic right now?”</p><p>If the answer is no:</p><p>Kubernetes stops sending traffic to it.</p><p>The Pod still exists.<br>It just gets temporarily removed from service.</p><p>This is useful during:</p><ul><li>startup</li><li>dependency loading</li><li>database reconnects</li></ul><h3>Liveness Probe</h3><p>Liveness asks:</p><p>“Is this container still healthy?”</p><p>If the answer is no:</p><p>Kubernetes kills the container<br>and starts it again.</p><p>This is recovery logic.</p><h3>Example</h3><p>Imagine your app takes 20 seconds to fully initialize.</p><p>Without readiness checks:</p><p>Traffic hits the Pod immediately.<br>Requests fail.</p><p>With readiness checks:</p><p>Kubernetes waits until the app is actually ready.</p><p>Now imagine the app gets stuck forever later.</p><p>That’s where liveness comes in.</p><p>Kubernetes notices the app is unhealthy<br>and restarts it.</p><h3>Real-world moment</h3><p>In production, probe configuration matters more than people realize.</p><p>I have seen perfectly good applications restart endlessly<br>because the liveness check was too aggressive.</p><p>And I have seen “healthy” Pods serve failures<br>because readiness checks were missing entirely.</p><h3>The thing nobody tells you</h3><p>A container running is not the same as an application being healthy.</p><p>Kubernetes only knows what you tell it.</p><p>Bad probes create bad decisions.</p><h3>Insight</h3><p>Readiness protects users from broken traffic.</p><p>Liveness protects the system from stuck applications.</p><p>Both exist because “Running” is far too simple for real systems.</p><h3>Next topic</h3><p>Now we can finally answer something painful:</p><p>Why apps that work perfectly on your laptop<br>suddenly fail inside Kubernetes.</p><p>Thanks for reading the Kubernetes 101! Follow me for more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae19961d3d96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ghost of Ubuntu: How a Dead Folder Broke My Secure Boot.]]></title>
            <link>https://b-hamza.medium.com/the-ghost-of-ubuntu-how-a-dead-folder-broke-my-secure-boot-c71ed796ba95?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/c71ed796ba95</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 17:44:19 GMT</pubDate>
            <atom:updated>2026-04-19T17:44:19.556Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This is part two of a series. If you’re not sure what UEFI, Secure Boot, or the EFI partition are, </em><a href="https://b-hamza.medium.com/its-not-1981-anymore-stop-thinking-in-bios-60ee81cc6045"><em>start with part one.</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JeqtqLYo41ubJpqtkJd1cg.png" /></figure><p>After reinstalling Fedora, my system started throwing this on boot:</p><blockquote>Verification failed: security violation</blockquote><p>And my BIOS still listed Ubuntu — even though I’d removed Ubuntu months ago.</p><p>My first instinct was wrong. I assumed a Secure Boot key had gotten corrupted or wasn’t enrolled. Logical guess. Completely off.</p><p>The actual problem was three things piling up together: leftover Ubuntu EFI files, a stale UEFI boot entry, and my firmware quietly auto-detecting the old bootloader and occasionally trying to use it.</p><h3>Most people debug the wrong place</h3><p>When something goes wrong at boot, the natural instinct is to open the BIOS menu and poke around. That’s where boot options live, so that’s where the problem must be, right?</p><p>Not quite. As I explained in part one, UEFI maintains two separate things: boot entries stored in NVRAM (what you see in the BIOS menu), and the actual files sitting in the EFI partition at /boot/efi/EFI/. These are supposed to agree. When they don&#39;t, the firmware behaves erratically — and staring at the BIOS menu won&#39;t tell you why.</p><p>My partition still had:</p><pre>/EFI/ubuntu/     ← still there<br>/EFI/fedora/     ← correct<br>/EFI/BOOT/       ← fallback loader, pointing somewhere wrong</pre><p>The Ubuntu directory existing was enough to make firmware recreate the Ubuntu boot entry on every reboot, occasionally try to boot it, and then fail Secure Boot verification when it did.</p><h3>Step 1: Check what boot entries actually exist</h3><pre>sudo efibootmgr -v</pre><p>I had a correct Fedora entry, a stale Ubuntu entry, and two duplicate Fedora entries that had accumulated from previous reinstalls. The -v flag is important, without it you just get names, with it you get the actual file paths each entry points to. That&#39;s where things started looking suspicious.</p><h3>Step 2: Delete the stale Ubuntu entry</h3><pre>sudo efibootmgr -b XXXX -B</pre><p>Replace XXXX with the boot number from the previous command (e.g. 0002). This removes the entry from NVRAM.</p><p>It came back after the next reboot. So the NVRAM entry wasn’t the root cause, something was regenerating it.</p><h3>Step 3: The actual fix — cleaning the EFI partition</h3><pre>ls /boot/efi/EFI/</pre><p>There it was: an ubuntu/ folder, still on the partition, pointing at bootloader files for an OS that no longer existed. The firmware was finding it on each boot and helpfully adding Ubuntu back to the menu.</p><pre>sudo rm -rf /boot/efi/EFI/ubuntu</pre><p>Before running this, make sure you actually want it gone. If you’re dual-booting intentionally, don’t delete a folder you need.</p><h3>Step 4: Fix the fallback bootloader</h3><p>This is the step most guides skip, and it’s the one that actually resolved the Secure Boot error.</p><p>UEFI has a fallback path it uses when no explicit NVRAM entry matches:</p><pre>/EFI/BOOT/BOOTX64.EFI</pre><p>On my system, this file was stale — it wasn’t pointing to Fedora’s signed shim. When UEFI fell back to it during the boot attempts it was making with the Ubuntu entry, Secure Boot refused it.</p><p>The fix is to replace it with your current OS’s shim:</p><pre>sudo cp /boot/efi/EFI/fedora/shimx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI</pre><p>This ensures that even if UEFI falls back to the generic path, it loads a properly signed bootloader.</p><h3>Step 5: Set boot order</h3><pre>sudo efibootmgr -o XXXX,YYYY</pre><p>List the boot numbers in the order you want, comma-separated. Fedora first. This is optional if your NVRAM already has the right entry at the top, but worth doing explicitly while you’re in here.</p><h3>After reboot</h3><p>Ubuntu was gone from BIOS. Fedora booted cleanly. Secure Boot worked. No security violation.</p><p>The issue was never Secure Boot itself. It was a mismatch between what lived in /boot/efi/EFI/, what the UEFI entries said, and what the fallback loader pointed to. Once those three agreed, everything worked.</p><h3>What I’d check first next time</h3><p>If you reinstall Linux and hit weird boot errors, the BIOS menu is the last place to look, not the first. Here’s the actual checklist:</p><p><strong>Check the EFI partition:</strong></p><pre>ls /boot/efi/EFI/</pre><p>Are there folders for OSes you no longer have? Remove them.</p><p><strong>Check the boot entries:</strong></p><pre>sudo efibootmgr -v</pre><p>Stale entries pointing at nothing? Remove them with -b XXXX -B.</p><p><strong>Check the fallback loader:</strong></p><pre>ls -la /boot/efi/EFI/BOOT/</pre><p>Does BOOTX64.EFI exist and point to your current OS&#39;s shim? If not, copy it over.</p><p>The EFI partition is where the real state lives. The BIOS menu is just a display of what the firmware <em>thinks</em> is there. When they disagree, you get exactly the kind of confusing, inconsistent boot failures that seem impossible to diagnose — until you know where to look.</p><p><em>← Back to Part 1: </em><a href="https://b-hamza.medium.com/its-not-1981-anymore-stop-thinking-in-bios-60ee81cc6045">It’s Not 1981 Anymore: Stop Thinking in BIOS.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c71ed796ba95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[It’s Not 1981 Anymore: Stop Thinking in BIOS.]]></title>
            <link>https://b-hamza.medium.com/its-not-1981-anymore-stop-thinking-in-bios-60ee81cc6045?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/60ee81cc6045</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[firmware]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[operating-systems]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 17:32:56 GMT</pubDate>
            <atom:updated>2026-04-19T17:35:48.197Z</atom:updated>
            <content:encoded><![CDATA[<p>Every time you press the power button, something happens before Linux or Windows, or anything gets a say. Most people never think about it. That’s fine, until it breaks.</p><p>I didn’t think about it either, until Fedora stopped booting and my BIOS was cheerfully listing an OS I’d deleted weeks ago.</p><p>This is the article I wish I’d read before that happened.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GdmdYgCAk9BfYw-mTsgv5g.png" /></figure><h3>The old way: BIOS</h3><p>For decades, PCs used a system called BIOS — Basic Input/Output System. It was simple, sometimes charmingly so. When you powered on, the BIOS ran a quick hardware check, then looked for something bootable on your drives by scanning for a specific 512-byte chunk at the very start of the disk. If it found it, it handed control over.</p><p>That chunk was called the Master Boot Record. It held a tiny bootloader, which loaded a slightly less tiny bootloader, which eventually loaded your OS. Turtles all the way down.</p><p>BIOS worked fine for about 30 years. It also had a 2TB drive limit, couldn’t boot from drives larger than that, had no security model to speak of, and ran in 16-bit mode — the same mode as machines from 1981.</p><h3>UEFI replaced it, and the world got weirder</h3><p>UEFI — Unified Extensible Firmware Interface — is what modern computers use instead. It’s been standard since around 2012, though many people still call it “BIOS” out of habit.</p><p>The difference that matters most: UEFI doesn’t look for a magic sector at the start of a disk. It looks for files. Specifically, it looks for .efi files in a special partition called the EFI System Partition, or ESP.</p><p>On a Linux system, that partition is usually mounted at /boot/efi. Inside it, there&#39;s a folder called EFI/, and inside that, each OS gets its own subfolder.</p><pre>/boot/efi/EFI/<br>├── fedora/<br>├── ubuntu/       ← or whatever you&#39;ve had installed<br>└── BOOT/         ← the fallback location</pre><p>UEFI reads these folders and builds a boot menu from what it finds. That menu is what you see when you hold F12 or whatever key your laptop uses to show boot options.</p><p>This is a much more flexible system than BIOS. It also means there are more ways for things to go wrong.</p><h3>The EFI partition is the source of truth</h3><p>Here’s the thing most guides miss: UEFI’s boot menu entries and the actual files in /boot/efi/EFI/ are two separate things that are supposed to agree with each other.</p><p>The boot entries are stored in NVRAM — a small amount of persistent memory on your motherboard. You can see them with a tool called efibootmgr. They look something like this:</p><pre>Boot0001* Fedora<br>Boot0002* Ubuntu<br>Boot0003  Windows Boot Manager</pre><p>But here’s where it gets interesting. If UEFI can’t find a valid entry in NVRAM — or if it wants to double-check — it also scans the EFI partition directly. It finds whatever .efi files are sitting there and may add them to the menu automatically.</p><p>This means: if you delete an OS but leave its folder in /boot/efi/EFI/, the firmware might keep adding it back to your boot menu. Every reboot.</p><h3>Secure Boot: the lock on the door</h3><p>Secure Boot is a feature that adds a verification step to this process. Before UEFI hands control to a bootloader, it checks whether that bootloader is cryptographically signed with a trusted key.</p><p>The idea is to prevent malicious software from inserting itself into the boot chain before your OS loads, a class of attack called a bootkit. If someone compromises your bootloader, they own your machine before your OS even starts. Secure Boot is supposed to stop that.</p><p>In practice, it works like this:</p><ol><li>Your firmware has a set of trusted keys built in (usually from Microsoft, since they’re the ones who pushed Secure Boot into existence)</li><li>Linux distros use a signed piece of software called a <strong>shim</strong> as their first-stage bootloader</li><li>The shim is signed with a key Microsoft trusts, so UEFI lets it run</li><li>The shim then loads GRUB (or another bootloader), which loads the kernel</li></ol><p>The shim file on a Fedora system is usually at:</p><pre>/boot/efi/EFI/fedora/shimx64.efi</pre><p>There’s also a fallback path UEFI uses when it can’t find a specific entry:</p><pre>/boot/efi/EFI/BOOT/BOOTX64.EFI</pre><p>If that fallback file points to the wrong thing — or to nothing — Secure Boot will refuse to proceed. You’ll get an error like:</p><blockquote>Verification failed: security violation</blockquote><p>That’s not UEFI being dramatic. It genuinely found something it couldn’t verify.</p><h3>Why this matters when you switch distros</h3><p>Most Linux installers are good about writing their own bootloader. They’re less good about cleaning up after the previous one.</p><p>If you install Fedora over Ubuntu, or alongside it, or if you delete Ubuntu manually, the files in /boot/efi/EFI/ubuntu/ don&#39;t automatically disappear. The installer for the new OS doesn&#39;t touch another OS&#39;s folder. That&#39;s probably the right call in general, you don&#39;t want installers deleting things they don&#39;t understand! But it means the cleanup is on you.</p><p>And if you don’t do that cleanup, you end up in exactly the situation I was in: an OS that’s gone, a boot entry that keeps coming back, and a Secure Boot error that seems to make no sense.</p><h3>The three things that have to agree</h3><p>Boot problems on UEFI systems almost always come down to a mismatch between:</p><p><strong>1. The NVRAM boot entries</strong> — what UEFI thinks it can boot, stored on the motherboard. View them with sudo efibootmgr -v.</p><p><strong>2. The files in </strong><strong>/boot/efi/EFI/</strong> — what&#39;s actually on the EFI partition. View them with ls /boot/efi/EFI/.</p><p><strong>3. The fallback bootloader</strong> — /boot/efi/EFI/BOOT/BOOTX64.EFI, which UEFI uses as a last resort. This file needs to point to your current OS&#39;s signed shim.</p><p>When all three agree, booting works. When they don’t, you get strange behavior: phantom OS entries, Secure Boot failures, or a system that boots inconsistently depending on how UEFI is feeling that day.</p><p>In part two, I’ll show you exactly what happened when these three things fell out of sync on my system — and the specific commands I used to fix it.</p><p><em>→ Continue to Part 2: [T</em><a href="https://medium.com/@b-hamza/the-ghost-of-ubuntu-how-a-dead-folder-broke-my-secure-boot-c71ed796ba95">he ghost of Ubuntu: How a dead folder broke my secure boot</a> !<em>]</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60ee81cc6045" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Rolling Updates: The “Silent Killer” of Production Apps]]></title>
            <link>https://b-hamza.medium.com/kubernetes-rolling-updates-the-silent-killer-of-production-apps-8067536a7e47?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/8067536a7e47</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 13:20:40 GMT</pubDate>
            <atom:updated>2026-04-18T13:20:40.384Z</atom:updated>
            <content:encoded><![CDATA[<p>Your app has zero downtime, but you might still be serving 100% errors. Here is the nuance most engineers miss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qPLYI86Vtu_JIms_TQJgSw.png" /></figure><h3>The “Perfect” Deployment</h3><p>We’ve all been there. You’ve just finished a feature, your CI/CD pipeline is green, and you’re ready to push to production.</p><p>In the old days, this meant a “maintenance window.” You’d shut down the server, swap the binary, and pray it started back up. During those five minutes, your users saw a 404 page.</p><p>Kubernetes changed the game with <strong>Rolling Updates</strong>. But as I quickly learned, “Zero Downtime” is a metric of <strong>availability</strong>, not <strong>health</strong>.</p><h3>How it Works (The Textbook Version)</h3><p>By default, when you update a Deployment in Kubernetes, it doesn’t kill your workload. It performs a surgical swap.</p><p>Imagine you have 5 Pods running v1. You trigger an update to v2. Kubernetes follows a precise loop:</p><ol><li><strong>The Arrival:</strong> It creates one new Pod (v2).</li><li><strong>The Handshake:</strong> It waits for the container to start.</li><li><strong>The Departure:</strong> Once v2 is up, it terminates one v1 Pod.</li></ol><p>It repeats this until the transition is 100% complete. To the outside world, the app never “went down.”</p><h3>The Trap: Availability ≠ Correctness</h3><p>Here is the part they don’t tell you in the certification exams: <strong>Kubernetes is a blind orchestrator.</strong></p><blockquote>It doesn’t care if your code has a NullPointerException or if your database connection string is wrong. Its only job is to ensure the <em>container</em> is running.</blockquote><p>If your new version is broken, Kubernetes will:</p><ol><li>Start the broken Pod.</li><li>See that the process is “running.”</li><li>Kill a perfectly healthy old Pod.</li><li>Replace it with a broken one.</li></ol><p><strong>Slowly and smoothly, Kubernetes will replace your entire healthy cluster with a broken one — all while reporting “Successful Deployment.”</strong></p><h3>The Lesson</h3><p>Rolling Updates solve the <strong>Availability</strong> problem. They do not solve the <strong>Logic</strong> problem.</p><p>In production, an “invisible” deployment is only good if the code behind it is actually functional. If you aren’t telling Kubernetes <em>how</em> to check if your app is ready to receive traffic, you aren’t actually safe — you’re just failing gradually.</p><h3>What’s Next?</h3><p>A smooth rollout is useless if the Pod isn’t actually “ready.” In the next part of this <strong>Kubernetes 101</strong> series, we’ll dive into the eyes of your cluster: <strong>Liveness vs. Readiness Probes.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8067536a7e47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Deployments: Stop Babysitting Your Pods]]></title>
            <link>https://b-hamza.medium.com/kubernetes-deployments-stop-babysitting-your-pods-b3e4c6c0dba9?source=rss-c21a056e4c77------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3e4c6c0dba9</guid>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Hamza Bharmal]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 16:07:32 GMT</pubDate>
            <atom:updated>2026-04-15T16:07:32.067Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Day I Almost crashed</h3><p>Early in my Kubernetes journey, I thought I was being clever. I was managing Pods directly. I’d create a Pod, watch it run, and feel like a god of infrastructure.</p><p>Then, the “Real World” happened.</p><p>A node went down. A Pod crashed. A configuration drifted. Suddenly, I wasn’t an engineer; I was a glorified babysitter, frantically typing kubectl apply at 2:00 AM to keep the lights on.</p><p><strong>The lesson was brutal: If you are managing Pods directly, you aren’t using Kubernetes then you’re just using a very expensive way to run scripts.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tdie2wlfBXPSAH9Hpt9M8Q.png" /></figure><h3>The Solution: The “Desired State”</h3><p>Kubernetes doesn’t want your commands; it wants your <strong>intent</strong>.</p><p>Instead of telling the cluster “Run this Pod,” you use a <strong>Deployment</strong>. A Deployment is your contract with Kubernetes. You define the <em>what</em>, and you let the system figure out the <em>how</em>.</p><h3>You don’t say:</h3><ul><li>“Start a container.”</li><li>“Check if it’s alive.”</li><li>“Restart it if it dies.”</li></ul><h3>You say:</h3><ul><li><strong>Target:</strong> 5 replicas.</li><li><strong>Blueprint:</strong> Use this specific container image.</li><li><strong>Health:</strong> Keep them alive at all costs.</li></ul><h3>The Secret Architecture</h3><p>Behind every Deployment is a hidden hierarchy. You don’t need to touch the lower layers, but understanding them is the difference between a junior and a senior dev.</p><ol><li><strong>The Deployment:</strong> The high-level “Brain” where you define your version and scale.</li><li><strong>The ReplicaSet:</strong> The “Enforcer” that ensures exactly <em>X</em> copies are running.</li><li><strong>The Pods:</strong> The “Workers” that actually do the job.</li></ol><blockquote><strong><em>Pro Tip:</em></strong><em> You never manage the ReplicaSet or Pods manually. You talk to the Deployment, and the Deployment handles the rest. It’s delegation at its finest.</em></blockquote><h3>The “Mindset Shift” No One Tells You</h3><p>In the old world, servers were <strong>personified</strong>. You gave them names, you nursed them back to health, and you cried when they are gone.</p><p>In the Kubernetes world, Pods are <strong>mortal</strong>.</p><p>They are meant to be temporary. They are meant to die. If your system depends on a specific Pod surviving, your architecture is broken. Deployments abstract that mortality away, turning your system into something repeatable and resilient rather than something you have to babysit.</p><h3>The Insight</h3><p>Deployments transform your workflow. You stop asking, <em>“Is this Pod running?”</em> and start asking, <strong><em>“Is my system defined correctly?”</em></strong> When the definition is right, the reality follows.</p><h3>What’s Next?</h3><p>Now that we have a stable state, how do we change it without dropping traffic?</p><p>In the next post, we’ll dive into <strong>Rolling Updates</strong> : the art of changing the engine while the car is driving 80mph down the highway.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3e4c6c0dba9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>