<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: aniket purohit</title>
    <description>The latest articles on DEV Community by aniket purohit (@aniket_purohit).</description>
    <link>https://dev.to/aniket_purohit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1880405%2F0d6559bf-4881-45f1-821a-8c6d1b6c7df2.png</url>
      <title>DEV Community: aniket purohit</title>
      <link>https://dev.to/aniket_purohit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aniket_purohit"/>
    <language>en</language>
    <item>
      <title>Pod Theory</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Fri, 30 Jan 2026 16:42:57 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/pod-theory-4ib6</link>
      <guid>https://dev.to/aniket_purohit/pod-theory-4ib6</guid>
      <description>&lt;p&gt;This deep dive into &lt;strong&gt;Pod Theory&lt;/strong&gt; reveals why Kubernetes isn't just a container runner—it's a sophisticated resource manager. You’ve touched on the "philosophy" of the Pod, which is essential for moving from a hobbyist to a pro.&lt;/p&gt;

&lt;p&gt;Here is the breakdown of Pod Theory, rewritten for clarity and impact.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Zen of Pods: More Than Just a Wrapper
&lt;/h1&gt;

&lt;p&gt;If a container is a single musician, a &lt;strong&gt;Pod&lt;/strong&gt; is the stage. It provides the lights, the power, and the acoustics. Kubernetes doesn't manage musicians; it manages stages.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Power of Abstraction
&lt;/h2&gt;

&lt;p&gt;Pods are a "universal adapter." Because Kubernetes only sees a "Pod," it doesn't care if what's inside is a Docker container, a WebAssembly (Wasm) app, or even a full Virtual Machine (via KubeVirt).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Benefit:&lt;/strong&gt; You can run old-school VMs and cutting-edge Serverless functions side-by-side on the same hardware.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. The Shared "Apartment" (Resource Sharing)
&lt;/h2&gt;

&lt;p&gt;When you put multiple containers in one Pod, they live in a shared execution environment. They are more than just neighbors; they share the same "utilities":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Network:&lt;/strong&gt; They share one IP. Container A can talk to Container B on &lt;code&gt;localhost&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage:&lt;/strong&gt; They can both mount the same folder (Volume) to swap files instantly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identity:&lt;/strong&gt; They share the same Hostname and Process Tree.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Advanced Logistics (Scheduling)
&lt;/h2&gt;

&lt;p&gt;How does the Captain decide where to put the cargo? It uses a mix of "Hard Rules" and "Vibes" (Soft Rules):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;How it Works&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;NodeSelector&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;"Only put this Pod on a server with an SSD." (Very simple)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Affinity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;"I really &lt;em&gt;prefer&lt;/em&gt; being near other Pods of my type." (Attraction)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Anti-Affinity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;"Keep me away from my clones so we don't all die if one rack fails." (Repulsion)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Requests:&lt;/strong&gt; "I need 1GB RAM to start." &lt;strong&gt;Limits:&lt;/strong&gt; "Never let me use more than 2GB."&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  4. The "Mortal &amp;amp; Immutable" Law
&lt;/h2&gt;

&lt;p&gt;This is the most critical takeaway from your notes. In the Kubernetes world, &lt;strong&gt;nothing is forever.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mortal:&lt;/strong&gt; When a Pod finishes its job (like a batch script) or crashes, it is &lt;strong&gt;deleted&lt;/strong&gt;. It is never "rebooted" as the same object.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Immutable:&lt;/strong&gt; You never change a running Pod. If you need to update the app, you kill the old Pod and the Controller spawns a brand-new one with a new ID and a new IP.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Restart Policy Loop
&lt;/h3&gt;

&lt;p&gt;While Kubernetes won't restart a &lt;strong&gt;Pod&lt;/strong&gt;, the Kubelet &lt;em&gt;will&lt;/em&gt; restart a &lt;strong&gt;Container&lt;/strong&gt; inside that Pod based on your policy:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Always:&lt;/strong&gt; Great for web servers. If it dies, bring it back!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OnFailure:&lt;/strong&gt; Great for jobs. If it finished successfully, leave it alone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never:&lt;/strong&gt; Run once and stay dead, regardless of what happened.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  5. Networking: The Flat Earth Theory
&lt;/h2&gt;

&lt;p&gt;By default, Kubernetes treats the network as a "Flat Layer-2 Overlay."&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every Pod gets its own IP.&lt;/li&gt;
&lt;li&gt;Every Pod can talk to every other Pod directly, even if they are on different servers across the world.&lt;/li&gt;
&lt;li&gt;It’s like every Pod has its own direct phone line to everyone else in the company.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6. How a Pod is Born (The 9-Step Journey)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Blueprint:&lt;/strong&gt; You send a YAML file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Gatekeeper:&lt;/strong&gt; API Server validates and saves it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Matchmaker:&lt;/strong&gt; The &lt;strong&gt;Scheduler&lt;/strong&gt; finds a node with enough CPU/RAM and the right labels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Assignment:&lt;/strong&gt; The Pod is "bound" to a Node in the database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Agent:&lt;/strong&gt; The &lt;strong&gt;Kubelet&lt;/strong&gt; on that specific node sees the new assignment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Action:&lt;/strong&gt; Kubelet tells the &lt;strong&gt;Runtime&lt;/strong&gt; (containerd) to pull the image and start.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Status:&lt;/strong&gt; Kubelet watches the containers and tells the API Server: "We are live!"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Watchdog:&lt;/strong&gt; If a container fails, Kubelet follows the &lt;strong&gt;Restart Policy&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The End:&lt;/strong&gt; If the node fails, a &lt;strong&gt;Controller&lt;/strong&gt; notices and starts the whole process over on a new node.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Static Pod&lt;/strong&gt; (deployed by hand) is a lonely, fragile thing. A &lt;strong&gt;Managed Pod&lt;/strong&gt; (deployed via a Controller) is a self-healing, scaling machine. Always aim for managed Pods!&lt;/p&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>kubectl</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Sun, 25 Jan 2026 14:35:42 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/kubectl-511h</link>
      <guid>https://dev.to/aniket_purohit/kubectl-511h</guid>
      <description>&lt;p&gt;You’ve learned about the Captain (Kubernetes), the Command Center (Control Plane), and the Cargo (Pods). Now, it’s time to talk about the &lt;strong&gt;Remote Control&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If Kubernetes is a massive ship, &lt;code&gt;kubectl&lt;/code&gt; (pronounced "koob-control" or "koob-cuttle") is the steering wheel in your hands.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Kubectl?
&lt;/h2&gt;

&lt;p&gt;At its simplest, &lt;code&gt;kubectl&lt;/code&gt; is a translator. You type in human-friendly commands like "get pods" or "run this app," and &lt;code&gt;kubectl&lt;/code&gt; converts them into a complex JSON/HTTP request that the &lt;strong&gt;API Server&lt;/strong&gt; understands.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Version Rule
&lt;/h3&gt;

&lt;p&gt;Before you start, check your version:&lt;br&gt;
&lt;code&gt;kubectl version --client&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Kubernetes moves fast! Your &lt;code&gt;kubectl&lt;/code&gt; version shouldn't be more than one "minor" version away from your cluster. If your cluster is version &lt;strong&gt;1.29&lt;/strong&gt;, your &lt;code&gt;kubectl&lt;/code&gt; should be &lt;strong&gt;1.28, 1.29, or 1.30&lt;/strong&gt;. Any further, and they might stop speaking the same language.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Secret Map: Kubeconfig
&lt;/h2&gt;

&lt;p&gt;How does &lt;code&gt;kubectl&lt;/code&gt; know where your cluster is? It looks for a hidden file in your home directory: &lt;code&gt;~/.kube/config&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Think of this &lt;strong&gt;kubeconfig&lt;/strong&gt; file as your "Passport and Boarding Pass" collection. It’s broken down into three main sections:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Clusters:&lt;/strong&gt; A list of the destinations (e.g., "Production Cluster," "Testing Cluster"). It includes the web address (URL) for each API server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Users:&lt;/strong&gt; Your credentials. These could be certificates, tokens, or passwords that prove who you are.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contexts:&lt;/strong&gt; The "Shortcut." A context ties a &lt;strong&gt;User&lt;/strong&gt; to a &lt;strong&gt;Cluster&lt;/strong&gt;. For example, the "Director" context might say: &lt;em&gt;"When I use this shortcut, log me into the Shield Cluster using Agent Coulson’s credentials."&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Example Breakdown:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;current-context&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;director&lt;/span&gt;   &lt;span class="c1"&gt;# This is the 'active' shortcut&lt;/span&gt;
&lt;span class="na"&gt;contexts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;director&lt;/span&gt;            &lt;span class="c1"&gt;# The shortcut name&lt;/span&gt;
  &lt;span class="na"&gt;context&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;cluster&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;shield&lt;/span&gt;         &lt;span class="c1"&gt;# Points to the 'shield' definition below&lt;/span&gt;
    &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;coulson&lt;/span&gt;           &lt;span class="c1"&gt;# Points to the 'coulson' credentials below&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Navigating the Clusters
&lt;/h2&gt;

&lt;p&gt;Since you might manage many clusters at once, you need a way to jump between them without getting lost. Here are your "navigation" commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;View your config:&lt;/strong&gt; &lt;code&gt;kubectl config view&lt;/code&gt; (It’s smart enough to hide your passwords/certificates so you don't accidentally leak them).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Where am I?&lt;/strong&gt; &lt;code&gt;kubectl config current-context&lt;/code&gt; (Tells you which "shortcut" you are currently using).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Teleport:&lt;/strong&gt; &lt;code&gt;kubectl config use-context {name}&lt;/code&gt; (Switches your active connection to a different cluster).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Building Your Own "Lab"
&lt;/h2&gt;

&lt;p&gt;You don't need a massive cloud budget to start practicing. You can run a "Kubernetes in a Box" right on your laptop. These tools create a tiny cluster inside a Virtual Machine or a Docker container:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker Desktop:&lt;/strong&gt; The easiest "one-click" setup for Mac and Windows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minikube:&lt;/strong&gt; The classic, feature-rich local cluster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kind (Kubernetes in Docker):&lt;/strong&gt; Great for testing and lightning-fast to start.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;K3d / K3s:&lt;/strong&gt; A "lite" version of Kubernetes that uses very little RAM.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;kubectl&lt;/code&gt; is your primary tool for interacting with the cluster. By mastering the &lt;strong&gt;kubeconfig&lt;/strong&gt; file, you can jump between local labs and massive production environments with a single command.&lt;/p&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>Pods</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Sat, 24 Jan 2026 15:26:38 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/pods-3gp8</link>
      <guid>https://dev.to/aniket_purohit/pods-3gp8</guid>
      <description>&lt;p&gt;We’ve talked about the "Captain" and the "Command Center," but now it’s time to look at the actual cargo. In the world of VMware, the unit of work is a &lt;strong&gt;Virtual Machine&lt;/strong&gt;. In Docker, it's a &lt;strong&gt;Container&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But in Kubernetes? The atomic unit is the &lt;strong&gt;Pod&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a Pod, Exactly?
&lt;/h2&gt;

&lt;p&gt;Think of a Pod as a &lt;strong&gt;protective shell&lt;/strong&gt; or a specialized shipping crate. While a container holds your application code, Kubernetes doesn't like to handle bare containers. It wants them wrapped in a Pod.&lt;/p&gt;

&lt;h3&gt;
  
  
  The "Single Container" Pod
&lt;/h3&gt;

&lt;p&gt;Most of the time, a Pod contains just one container. This is the simplest way to run an app. If you need more power, you don't make the container bigger; you just tell Kubernetes to spin up more Pods.&lt;/p&gt;

&lt;h3&gt;
  
  
  The "Sidecar" Pattern (Multi-Container Pods)
&lt;/h3&gt;

&lt;p&gt;Sometimes, an application needs a "buddy." Imagine a world-class singer (your &lt;strong&gt;Main App&lt;/strong&gt;) who needs a personal assistant (a &lt;strong&gt;Sidecar&lt;/strong&gt;) to handle the logistics.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Main App focuses on the core logic (e.g., a web server).&lt;/li&gt;
&lt;li&gt;The Sidecar handles the "boring" stuff: syncing logs, managing security certificates, or acting as a service mesh proxy.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why keep them in one Pod?&lt;/strong&gt; Because they share the same "apartment." They share the same IP address, the same storage volumes, and the same memory. They are so tightly coupled that they can talk to each other over &lt;code&gt;localhost&lt;/code&gt;, just like two processes on your laptop.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Rules of the Pod
&lt;/h2&gt;

&lt;p&gt;To master Kubernetes, you have to understand the "Biological Laws" that govern Pods:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Pods are Inseparable
&lt;/h3&gt;

&lt;p&gt;If a Pod has three containers, they are &lt;strong&gt;always&lt;/strong&gt; scheduled onto the same physical worker node. You can't have half a Pod on Server A and the other half on Server B. They live together, and they die together.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Pods are Atomic
&lt;/h3&gt;

&lt;p&gt;A Pod is either "Ready" or it isn't. If your Pod has a main app and a helper, Kubernetes won't send traffic to it until &lt;strong&gt;both&lt;/strong&gt; containers are up and running. It’s an all-or-nothing deal.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Pods are Mortal (and Disposable)
&lt;/h3&gt;

&lt;p&gt;This is the hardest part for traditional IT folks to grasp: &lt;strong&gt;Pods are not pets; they are cattle.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They are born, they do their job, and they die.&lt;/li&gt;
&lt;li&gt;If a Pod gets sick (crashes), Kubernetes doesn't try to "fix" it. It executes it and replaces it with a brand-new one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Warning:&lt;/strong&gt; Because they are replaced, every new Pod gets a &lt;strong&gt;new ID and a new IP address&lt;/strong&gt;. You should never fall in love with a Pod’s IP!&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Golden Rule: Immutability
&lt;/h2&gt;

&lt;p&gt;In the old days, if a server was acting up, you’d SSH into it and change a configuration file. &lt;strong&gt;Never do this with a Pod.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pods are &lt;strong&gt;Immutable&lt;/strong&gt;. If you want to change the code or a setting:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You update your YAML "Blueprint."&lt;/li&gt;
&lt;li&gt;You tell Kubernetes.&lt;/li&gt;
&lt;li&gt;Kubernetes kills the old Pods and starts new ones with the changes.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Scaling: The Accordion Effect
&lt;/h2&gt;

&lt;p&gt;When your website gets famous and you need to scale, you don't add more CPUs to a Pod. You simply add &lt;strong&gt;more Pods&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scaling Up:&lt;/strong&gt; Kubernetes clones your Pod across multiple nodes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scaling Down:&lt;/strong&gt; Kubernetes gracefully shuts down the "extra" clones.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Summary Table: The Pod Cheat Sheet
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;The Reality&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Unit of Work&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The Pod (not the container)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Networking&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Containers in a Pod share 1 IP and use &lt;code&gt;localhost&lt;/code&gt; to talk&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scheduling&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;All containers in a Pod land on the same Node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Lifecycle&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ephemeral (temporary) and Immutable (unchanging)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>The Kubernetes Secret Sauce: Pods, Packages, and the "Desired State"</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Sat, 24 Jan 2026 14:45:55 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/the-kubernetes-secret-sauce-pods-packages-and-the-desired-state-3i0b</link>
      <guid>https://dev.to/aniket_purohit/the-kubernetes-secret-sauce-pods-packages-and-the-desired-state-3i0b</guid>
      <description>&lt;p&gt;If you’ve ever sent a package through a courier like FedEx or DHL, you know the drill. You don't just hand the driver a loose pile of electronics. You put them in a box, add a label, and maybe pay for extra insurance.&lt;/p&gt;

&lt;p&gt;In Kubernetes, we do the exact same thing with our code.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Russian Nesting Doll: Containers vs. Pods vs. Deployments
&lt;/h2&gt;

&lt;p&gt;Think of packaging an app for Kubernetes like a set of Russian Nesting Dolls. Each layer adds a new "superpower" to your application.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Container (The Inner Doll):&lt;/strong&gt; This holds your app and its dependencies (like Python, Java, or Node.js).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Pod (The Middle Doll):&lt;/strong&gt; Kubernetes doesn't run containers directly; it runs &lt;strong&gt;Pods&lt;/strong&gt;. A Pod is a thin wrapper that allows K8s to talk to the container. It’s the smallest unit of work in the cluster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Deployment (The Outer Doll):&lt;/strong&gt; You rarely create a Pod by itself. Instead, you wrap it in a &lt;strong&gt;Deployment&lt;/strong&gt;. This adds the "Insurance Policy"—features like self-healing, scaling, and rolling updates.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The "Zen" of Kubernetes: Declarative vs. Imperative
&lt;/h2&gt;

&lt;p&gt;This is the most important concept to master. Most traditional IT is &lt;strong&gt;Imperative&lt;/strong&gt;, but Kubernetes is &lt;strong&gt;Declarative&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Imperative (The "To-Do List"):&lt;/strong&gt; "Step 1: Buy a server. Step 2: Install Linux. Step 3: Download the code. Step 4: Start the app." If Step 2 fails, the whole script breaks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Declarative (The "Blueprint"):&lt;/strong&gt; "I want a house with 3 bedrooms and a blue door." You don't care how the builder does it; you just care that the end result matches your blueprint.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Kubernetes, you write a &lt;strong&gt;YAML manifest&lt;/strong&gt; (your blueprint) and give it to the Captain.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Reconciliation Loop
&lt;/h3&gt;

&lt;p&gt;Kubernetes lives in a constant cycle of three steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Observe:&lt;/strong&gt; Look at what is actually running (Observed State).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Diff:&lt;/strong&gt; Compare it to what the YAML says (Desired State).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reconcile:&lt;/strong&gt; Fix any differences.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Your YAML says you want &lt;strong&gt;10 replicas&lt;/strong&gt; of your web app. A server crashes, and suddenly there are only &lt;strong&gt;8&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Observed State:&lt;/strong&gt; 8&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Desired State:&lt;/strong&gt; 10&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Action:&lt;/strong&gt; The Controller sees the "Diff" and instantly spins up 2 new Pods to make the total 10 again. No human intervention required!&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Because Kubernetes is declarative, it integrates perfectly with modern tools like Git.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Want to update your app? Don't log into a server. Just change one line in your YAML file and &lt;code&gt;kubectl apply&lt;/code&gt; it.&lt;/li&gt;
&lt;li&gt;Kubernetes will notice the "Desired State" has changed and will automatically swap out your old version for the new one, one Pod at a time, ensuring &lt;strong&gt;zero downtime&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Imperative (Old Way)&lt;/th&gt;
&lt;th&gt;Declarative (K8s Way)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Updates&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Risky, manual scripts&lt;/td&gt;
&lt;td&gt;Smooth, automated rollouts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Self-Healing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Requires a 3:00 AM phone call&lt;/td&gt;
&lt;td&gt;Automatic reconciliation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scaling&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;"I need to buy a new server"&lt;/td&gt;
&lt;td&gt;"I'll change 3 to 30 in my YAML"&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Kubernetes is more than just a place to run containers. It is a system built on &lt;strong&gt;intent&lt;/strong&gt;. You tell it what you want, and it works tirelessly—observing, comparing, and reconciling—to make sure your application stays exactly how you envisioned it.&lt;/p&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>Inside the Command Center</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Sat, 24 Jan 2026 14:02:10 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/inside-the-command-center-4jl5</link>
      <guid>https://dev.to/aniket_purohit/inside-the-command-center-4jl5</guid>
      <description>&lt;p&gt;If Kubernetes is the Captain of the ship, the &lt;strong&gt;Control Plane&lt;/strong&gt; is the bridge where all the decisions are made, and the &lt;strong&gt;Worker Nodes&lt;/strong&gt; are the deckhands doing the heavy lifting.&lt;/p&gt;

&lt;p&gt;Let's pull back the curtain on the "brains" and "brawn" of a K8s cluster.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Brains: The Control Plane
&lt;/h2&gt;

&lt;p&gt;The Control Plane lives exclusively on &lt;strong&gt;Linux&lt;/strong&gt;. It’s a suite of services that work together to make sure your "desired state" (what you want) matches the "actual state" (what is happening).&lt;/p&gt;

&lt;h3&gt;
  
  
  The API Server: The Gatekeeper
&lt;/h3&gt;

&lt;p&gt;Every single thing that happens in Kubernetes goes through the &lt;strong&gt;API Server&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Think of it as the cluster's "Front Desk."&lt;/li&gt;
&lt;li&gt;When you send a YAML file (your app's blueprint), the API Server checks your ID (Authentication), makes sure you're allowed to do it (Authorization), and then records the plan.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Cluster Store (etcd): The Source of Truth
&lt;/h3&gt;

&lt;p&gt;Kubernetes needs a memory. It uses &lt;strong&gt;etcd&lt;/strong&gt;, a tiny but mighty distributed database.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The "Quorum" Rule:&lt;/strong&gt; etcd prefers odd numbers (3 or 5). Why? Because if a network wire gets cut, the cluster needs a majority to make decisions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The "Split Brain" Problem:&lt;/strong&gt; If you have 4 nodes and they split 2-and-2, no one knows who is in charge. With 3 nodes, if 1 goes down, the other 2 still have a majority.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Scheduler: The Logistics Expert
&lt;/h3&gt;

&lt;p&gt;The Scheduler is like a high-stakes puzzle solver. When a new task comes in, it looks at every worker node and asks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Does this node have enough RAM?&lt;/li&gt;
&lt;li&gt;Is it already too busy?&lt;/li&gt;
&lt;li&gt;Does it have the right "tags" (Affinity)?
If it finds a match, it assigns the work. If not, it triggers the &lt;strong&gt;Autoscaler&lt;/strong&gt; to go buy more servers!&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Controllers: The Watchdogs
&lt;/h3&gt;

&lt;p&gt;Controllers are the reason Kubernetes "self-heals."&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Deployment Controller&lt;/strong&gt; says: "The boss wants 3 copies of this web app."&lt;/li&gt;
&lt;li&gt;If one copy crashes, the controller notices the count is now 2.&lt;/li&gt;
&lt;li&gt;It immediately tells the Scheduler: "Hey, we're missing one! Start a new one now."&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. The Brawn: Worker Nodes
&lt;/h2&gt;

&lt;p&gt;While the Control Plane must be Linux, the &lt;strong&gt;Worker Nodes&lt;/strong&gt; (where your apps live) can be &lt;strong&gt;Linux or Windows&lt;/strong&gt;. This allows you to run modern cloud-native apps alongside legacy Windows services.&lt;/p&gt;

&lt;p&gt;Every Worker Node has three essential tools:&lt;/p&gt;

&lt;h3&gt;
  
  
  The Kubelet: The On-Site Manager
&lt;/h3&gt;

&lt;p&gt;The Kubelet is an agent that runs on every node. It watches the API Server like a hawk. When the API Server says, "Run this pod on your node," the Kubelet gets to work. It reports back constantly: &lt;em&gt;"All good here!"&lt;/em&gt; or &lt;em&gt;"Help, this container won't start!"&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Container Runtime: The Engine
&lt;/h3&gt;

&lt;p&gt;This is the "engine" that actually pulls the images and runs them. While Docker started the fire, most modern clusters use &lt;strong&gt;containerd&lt;/strong&gt; or &lt;strong&gt;CRI-O&lt;/strong&gt;. They are leaner, faster, and built specifically for the Kubelet to talk to.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Kube-proxy: The Traffic Cop
&lt;/h3&gt;

&lt;p&gt;How does a user's request find its way to a specific container? &lt;strong&gt;Kube-proxy&lt;/strong&gt;. It manages the networking rules on each node, ensuring that traffic is load-balanced and reaches the right destination without getting lost.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Workflow: How a "Click" Becomes a "Container"
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Human:&lt;/strong&gt; "Here is a YAML file. I want 5 web servers."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Server:&lt;/strong&gt; "Accepted. Saving this to the etcd database."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scheduler:&lt;/strong&gt; "I see a new task! Node B has plenty of room. Assigning it there."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kubelet (on Node B):&lt;/strong&gt; "I see a new assignment! Hey Container Runtime, pull the image and start it."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kube-proxy:&lt;/strong&gt; "I'll open the gates so people can actually visit this new web server."&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The Control Plane makes the plans, and the Worker Nodes execute them. By separating the &lt;strong&gt;Brains&lt;/strong&gt; from the &lt;strong&gt;Brawn&lt;/strong&gt;, Kubernetes ensures that even if a server fails or a container crashes, the "Command Center" stays in control.&lt;/p&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>Kubernetes: The Operating System for the Cloud</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Sat, 24 Jan 2026 13:47:03 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/kubernetes-the-operating-system-for-the-cloud-1em1</link>
      <guid>https://dev.to/aniket_purohit/kubernetes-the-operating-system-for-the-cloud-1em1</guid>
      <description>&lt;p&gt;If you’ve ever looked at the guts of a computer, you know it’s a chaotic mess of wires, silicon, and electricity. But when you turn it on, you see a clean desktop. You don't worry about which specific stick of RAM is holding your browser data or which CPU core is calculating your spreadsheet. Your &lt;strong&gt;Operating System (OS)&lt;/strong&gt;—whether it's Windows, macOS, or Linux—handles that "scheduling" for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kubernetes does the exact same thing, but for entire datacenters.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Great Abstraction
&lt;/h2&gt;

&lt;p&gt;In the old days of the cloud, developers had to pick specific servers, manage IP addresses, and worry about which rack their app was sitting on.&lt;/p&gt;

&lt;p&gt;Kubernetes changes that. It treats a collection of 10, 100, or 1,000 servers as one giant pool of resources.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The OS&lt;/strong&gt; abstracts the hardware of a single machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kubernetes&lt;/strong&gt; abstracts the hardware of a whole cloud.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You tell Kubernetes: &lt;em&gt;"I need to run this app,"&lt;/em&gt; and it decides which server has the most room, which one is safest, and how to connect it to the internet. You stop managing &lt;strong&gt;servers&lt;/strong&gt; and start managing &lt;strong&gt;applications.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Anatomy of a Cluster: The Brains and the Brawn
&lt;/h2&gt;

&lt;p&gt;A Kubernetes environment is called a &lt;strong&gt;Cluster&lt;/strong&gt;. Inside that cluster, the world is split into two very different roles: the &lt;strong&gt;Control Plane&lt;/strong&gt; and the &lt;strong&gt;Worker Nodes&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The Control Plane (The Brains)
&lt;/h3&gt;

&lt;p&gt;The Control Plane is the "Intelligence" of the cluster. It’s made up of several specialized services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The API Server:&lt;/strong&gt; The front door. Every command you send goes through here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Scheduler:&lt;/strong&gt; The logistics expert. It looks at your app and decides which worker node is the best fit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Controller Manager:&lt;/strong&gt; The "watchdog." It constantly checks: &lt;em&gt;"Is the app running? Is it healthy? Do I need to scale up?"&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; In a production environment, you want 3 or 5 Control Plane nodes. Why odd numbers? It helps them "vote" and reach a consensus if something goes wrong. These must run on &lt;strong&gt;Linux&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  2. Worker Nodes (The Brawn)
&lt;/h3&gt;

&lt;p&gt;These are the heavy lifters. Their only job is to run your applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Versatility:&lt;/strong&gt; Worker nodes can be physical servers, virtual machines, or cloud instances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OS Choice:&lt;/strong&gt; While the Control Plane stays on Linux, Worker nodes can be &lt;strong&gt;Linux or Windows&lt;/strong&gt;, allowing you to run a mix of different apps in the same cluster.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why "Orchestrator" is the Perfect Word
&lt;/h2&gt;

&lt;p&gt;We use the word "Orchestrator" because Kubernetes acts like a &lt;strong&gt;Conductor&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In an orchestra, the conductor doesn't play the violin; they ensure the violinist starts at the right time, plays at the right volume, and stops when they should.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kubernetes orchestrates your apps by:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deploying:&lt;/strong&gt; Placing them on the right nodes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-Healing:&lt;/strong&gt; If a "musician" (container) stops playing, it instantly brings in a replacement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scaling:&lt;/strong&gt; If the "audience" (traffic) grows, it adds more musicians to the stage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rolling Updates:&lt;/strong&gt; It swaps out old sheet music for new music without stopping the performance.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Summary:
&lt;/h2&gt;

&lt;p&gt;At its core, Kubernetes is a &lt;strong&gt;Cluster&lt;/strong&gt; that provides resources and an &lt;strong&gt;Orchestrator&lt;/strong&gt; that manages the work. It turns a messy collection of servers into a reliable, automated platform that stays up 24/7/365.&lt;/p&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>From Chaos to Captain: The Story of Kubernetes</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Sat, 24 Jan 2026 13:34:42 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/from-chaos-to-captain-the-story-of-kubernetes-3ja2</link>
      <guid>https://dev.to/aniket_purohit/from-chaos-to-captain-the-story-of-kubernetes-3ja2</guid>
      <description>&lt;p&gt;Imagine you’re running an online store. In the old days, your entire website was one giant, heavy "monolith." If the checkout button broke, the whole site went down. If you got a surge of Black Friday traffic, the whole thing crashed under the weight.&lt;/p&gt;

&lt;p&gt;Then came &lt;strong&gt;Microservices&lt;/strong&gt;. Instead of one giant app, we broke it into tiny, specialized workers: one for the shopping cart, one for the product catalog, and one for payments.&lt;/p&gt;

&lt;p&gt;But this created a new problem: &lt;strong&gt;How do you manage hundreds of tiny moving parts without losing your mind?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter the Orchestrator
&lt;/h2&gt;

&lt;p&gt;This is where &lt;strong&gt;Kubernetes&lt;/strong&gt; (or &lt;strong&gt;K8s&lt;/strong&gt;) steps onto the deck. If your microservices are the cargo, Kubernetes is the Captain of the ship.&lt;/p&gt;

&lt;p&gt;In technical terms, Kubernetes is an &lt;strong&gt;orchestrator&lt;/strong&gt;. It doesn't just "run" apps; it manages their entire lifecycle. Think of it as an autopilot system that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scales on Demand:&lt;/strong&gt; Too much traffic? It spins up more containers instantly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-Heals:&lt;/strong&gt; If a container crashes at 3:00 AM, Kubernetes replaces it before you even wake up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero-Downtime Updates:&lt;/strong&gt; It swaps out old versions of your code for new ones one by one, so your users never see a "404" page.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Container Revolution: Docker and Beyond
&lt;/h2&gt;

&lt;p&gt;To understand Kubernetes, you have to understand &lt;strong&gt;Containerization&lt;/strong&gt;. This is the process of packaging your app and everything it needs into a single "image."&lt;/p&gt;

&lt;p&gt;For a long time, &lt;strong&gt;Docker&lt;/strong&gt; was the only name in the game. But as the industry grew, Docker became a bit "bloated"—it tried to do everything. The Kubernetes community wanted something leaner.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The Technical Pivot:&lt;/strong&gt; Kubernetes introduced the &lt;strong&gt;CRI (Container Runtime Interface)&lt;/strong&gt;. This made the "engine" layer pluggable. Today, most Kubernetes clusters use &lt;strong&gt;containerd&lt;/strong&gt; (pronounced &lt;em&gt;container-dee&lt;/em&gt;). It’s a stripped-down, high-performance version of the original Docker tech, optimized specifically for the demands of the cloud.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  A Secret History: From Google to the Stars
&lt;/h2&gt;

&lt;p&gt;Kubernetes didn't just appear out of thin air. It has "Google DNA."&lt;/p&gt;

&lt;p&gt;Before the rest of the world was using containers, Google was already running billions of them using internal tools called &lt;strong&gt;Borg&lt;/strong&gt; and &lt;strong&gt;Omega&lt;/strong&gt;. In 2015, they took everything they learned from those systems and helped create Kubernetes as an open-source project under the &lt;strong&gt;CNCF (Cloud Native Computing Foundation)&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The "Seven of Nine" Connection
&lt;/h3&gt;

&lt;p&gt;If you look closely at the Kubernetes logo, it’s a ship’s wheel with &lt;strong&gt;seven spokes&lt;/strong&gt;. This isn't a coincidence!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The original codename for Kubernetes was &lt;strong&gt;Seven of Nine&lt;/strong&gt; (the famous Borg drone from &lt;em&gt;Star Trek&lt;/em&gt;).&lt;/li&gt;
&lt;li&gt;When lawyers suggested a name change for copyright reasons, the engineers kept the seven spokes as a "nerdy" tribute to its Borg-inspired roots.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How Do You Even Say It?
&lt;/h2&gt;

&lt;p&gt;The word comes from the Greek word for "Helmsman" or "Pilot." Most people say &lt;strong&gt;“koo-ber-net-eez,”&lt;/strong&gt; but don't sweat the pronunciation—the community is famously friendly.&lt;/p&gt;

&lt;p&gt;You’ll also see it written as &lt;strong&gt;K8s&lt;/strong&gt;. Why? Because there are eight letters between the 'K' and the 's'. It’s a shorthand (called a numeronym) that’s much easier to type when you’re in the middle of a deployment!&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Term&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;K8s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Kubernetes (pronounced "Kates")&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Control Plane&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The "brain" of the cluster&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Nodes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The "muscles" (servers) where containers run&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pod&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The smallest unit K8s manages (usually one container)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  The Bottom Line
&lt;/h2&gt;

&lt;p&gt;Kubernetes won the "Orchestration Wars" of 2016 because it was built for scale and backed by a massive community. Whether you're a solo dev or a global giant, K8s is the tool that ensures your applications stay up, stay fast, and stay manageable.&lt;/p&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>Azure Data Services</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Sat, 24 Jan 2026 13:33:01 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/azure-data-services-3d23</link>
      <guid>https://dev.to/aniket_purohit/azure-data-services-3d23</guid>
      <description>&lt;p&gt;The ways you can store the data in azure. They can we classified in the various types of data mainly : &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;File based storage - Azure storage accounts&lt;/li&gt;
&lt;li&gt;Structured data  - relational database &lt;/li&gt;
&lt;li&gt;Semi structured data - tables &lt;/li&gt;
&lt;li&gt;Cosmo DB - distributed database &lt;/li&gt;
&lt;li&gt;Analysing Data  - data transformation, data warehouse, analysis &lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>azure</category>
    </item>
    <item>
      <title>Go tools</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Thu, 20 Nov 2025 17:47:01 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/go-tools-1jh</link>
      <guid>https://dev.to/aniket_purohit/go-tools-1jh</guid>
      <description>&lt;p&gt;Go programming language comes with a set of tools along with the standard installation.&lt;/p&gt;

&lt;h3&gt;
  
  
  gofmt
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;gofmt main.go&lt;/code&gt;: Prints the formatted source code of main.go file on the console.&lt;br&gt;
&lt;code&gt;gofmt -w main.go&lt;/code&gt;: Writes the formatted code in the file main.go&lt;br&gt;
&lt;code&gt;gofmt -w Tasks&lt;/code&gt;: Runs gofmt on all the files in the folder Tasks.&lt;br&gt;
&lt;code&gt;go fmt&lt;/code&gt; can be used in place of &lt;code&gt;gofmt -w&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It is highly recommended to rungofmtbefore committing to version control.&lt;/p&gt;
&lt;h3&gt;
  
  
  godoc
&lt;/h3&gt;

&lt;p&gt;extracts documentation comments on all the Go projects present in$GOPATH/src, and the standardlibrary present in$GOROOT&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;web interface&lt;br&gt;
&lt;code&gt;godoc -http=:6060&lt;/code&gt;&lt;br&gt;
godoc also allowsusers to read the Go source code of the packages. Since Go is now implemented in Go itself,we can read the source code of Go language.&lt;br&gt;
Using the -v flag, we come to know when the server gotup&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Commandline&lt;br&gt;
&lt;code&gt;godoc net/http&lt;/code&gt;&lt;br&gt;
This will provide the documentation of net/http on the terminal, like the man command. Thecatch here is that we need to know the exact library name&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  go test
&lt;/h3&gt;

&lt;p&gt;Go has testing support built into the language.&lt;br&gt;
For each code filefile.go, the corresponding testcases should be present in a file named asfile_test.goin the same folder. The Go compiler ignoresall the*_test.gofiles while building the application.&lt;/p&gt;
&lt;h3&gt;
  
  
  go build
&lt;/h3&gt;

&lt;p&gt;We can build our application usinggo build. It parses all the.gofiles except the*_test.gofilesin the entire folder and all sub folders along with imported libraries if any, and creates a staticallylinked binary. The binary name is the same as the project folder name, if we want a custom namewe should use the -o flag.&lt;br&gt;
Example:&lt;code&gt;go build -o tasks&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;go buildbuilds the entire application and the depending libraries, into a static binary andlater throws all away. This results in rebuilding everything every single timego buildis executed.For caching the library builds, usego installfirst andgo buildlater&lt;/p&gt;
&lt;h3&gt;
  
  
  cross compilation
&lt;/h3&gt;

&lt;p&gt;Go allows cross compilation. We have to pass the OS name as linux/darwin/windows as GOOS asshown in the below commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;env GOOS=darwin GOARCH=386 go build -o tasks.app
env GOOS=windows GOARCH=386 go build -o tasks.exe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  go install
&lt;/h3&gt;

&lt;p&gt;Creates a statically linked binary and places it in$GOPATH/bin. Also creastes a.afile of the libraryand puts it in the $GOPATH/pkg folder. In future builds this library file will be reused until theunderlying code is changed&lt;/p&gt;

&lt;p&gt;n Linux/Unix, this is done using:export PATH=$PATH:$GOPATH/bin. This line needs to be added toeither.bashrcor.profile, whichever is being used by the shell.The profile files are present in the home folder. Do a &lt;code&gt;cd ~&lt;/code&gt; and check for either of the files mentioned&lt;/p&gt;

&lt;h3&gt;
  
  
  go run
&lt;/h3&gt;

&lt;p&gt;go run combines building and running the application in one command. t generates a binary in the temp folder and executes it. The binary file isn’t retained after the run&lt;/p&gt;

&lt;h3&gt;
  
  
  go get
&lt;/h3&gt;

&lt;p&gt;This is the package manager in Go. It internally clones the version control repository parameterpassed to it, can be any local/remote git repository. It then runsgo installon the library, makingthe library available in$GOPATH/pkg. If the repository doesn’t have any buildable files then go getmight complain, but that happens after the repository is cloned&lt;/p&gt;

&lt;h3&gt;
  
  
  go clean
&lt;/h3&gt;

&lt;p&gt;This command is for cleaning files that are generated by compilers, including the following files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_obj/
_test/
_testmain.go
test.out
build.out

DIR(.exe)
DIR.test(.exe)
MAINFILE(.exe)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Other
&lt;/h3&gt;

&lt;p&gt;go fix // upgrade code from an old version before go1 to a new version after go1&lt;br&gt;
go version // get information about your version of Go&lt;br&gt;
go env // view environment variables about Go&lt;br&gt;
go list // list all installed packagesFor details about specific commands,go help .&lt;/p&gt;

</description>
      <category>go</category>
    </item>
    <item>
      <title>OSI open source Explained</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Thu, 07 Nov 2024 17:20:38 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/osi-open-source-explained-2pj8</link>
      <guid>https://dev.to/aniket_purohit/osi-open-source-explained-2pj8</guid>
      <description>&lt;p&gt;Imagine a bustling open market filled with craftspeople showcasing their work. You can walk through, take a closer look, and if you wish, use or build upon any item you find. This is the spirit of open source software: a community-driven approach where everyone benefits from shared knowledge and collaboration. At the heart of this movement is OSI—the Open Source Initiative—an organization that ensures everyone plays by the same fair rules.&lt;/p&gt;

&lt;p&gt;The OSI doesn’t just promote open source; it acts as a guardian, laying down essential ground rules to protect the core values of transparency, freedom, and collaboration. Here’s what these rules look like in simple terms:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Free Distribution
&lt;/h3&gt;

&lt;p&gt;Think of it as giving away a recipe. You can pass it on without anyone needing to pay a fee. Open source licenses ensure that no one can charge for simply redistributing the software.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Source Code Availability
&lt;/h3&gt;

&lt;p&gt;It’s like sharing not just the dish but the recipe itself. Open source software must come with the source code, and there can’t be barriers to sharing it further.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Derived Works
&lt;/h3&gt;

&lt;p&gt;Want to tweak that recipe and make it your own? Go ahead! Open source licenses must allow users to modify the code and share their new versions under the same terms.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Integrity of the Author’s Source Code
&lt;/h3&gt;

&lt;p&gt;If you decide to change the recipe drastically, you might need to give it a new name. Similarly, some licenses require users to remove the original author’s name or version if they significantly modify the code.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. No Discrimination Against Persons or Groups
&lt;/h3&gt;

&lt;p&gt;Open source doesn’t pick favorites. The license must allow everyone—regardless of who they are—to use the software.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. No Discrimination Against Fields of Endeavor
&lt;/h3&gt;

&lt;p&gt;Whether you’re using the code for a school project or a big commercial venture, open source licenses can’t impose restrictions based on the purpose.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Distribution of License
&lt;/h3&gt;

&lt;p&gt;Imagine passing on a recipe and then adding extra rules that tie someone’s hands. Not allowed. The license must travel with the code, and there can’t be new restrictions added along the way.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. License Independence
&lt;/h3&gt;

&lt;p&gt;You can’t say, “This software can only be part of a specific product.” The license must be flexible, not tied to a particular program or suite.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Compatibility with Other Software
&lt;/h3&gt;

&lt;p&gt;Open source plays well with others. The license can’t stop someone from packaging the software alongside non-open source programs.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Technology Neutrality
&lt;/h3&gt;

&lt;p&gt;The license has to be agnostic about how the code is distributed—whether it’s via a USB drive or downloaded from the cloud, it’s all fair game.&lt;/p&gt;

&lt;h3&gt;
  
  
  Popular Open Source Licenses Explained
&lt;/h3&gt;

&lt;h4&gt;
  
  
  LGPL (Lesser General Public License)
&lt;/h4&gt;

&lt;p&gt;Think of this as a flexible agreement for libraries. It allows other programs to use the library without fully adopting its open source license. It’s ideal when you want to share, but also let other projects include the code without needing to be entirely open source themselves.&lt;/p&gt;

&lt;h4&gt;
  
  
  BSD (Berkeley Software Distribution)
&lt;/h4&gt;

&lt;p&gt;The BSD license is generous: you can take the code, use it, and even modify it, as long as you keep the original BSD copyright notice intact. Just don’t use the names of the original contributors to sell your version. Importantly, you’re not required to share your changes.&lt;/p&gt;

&lt;h4&gt;
  
  
  MIT License
&lt;/h4&gt;

&lt;p&gt;Think of the MIT license as BSD’s minimalist cousin. It has similar rules but skips the part about using contributor names for endorsements.&lt;/p&gt;

&lt;h4&gt;
  
  
  Mozilla Public License (MPL)
&lt;/h4&gt;

&lt;p&gt;The MPL is detailed, covering not just code sharing but how contributors interact. It applies to projects like the Firefox browser. If you use and change the code, you need to document those changes, so everyone is clear about what’s been modified. The MPL also highlights patent considerations to keep everyone informed about potential legal issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Takeaway
&lt;/h3&gt;

&lt;p&gt;Open source software isn’t just about having the code freely available; it’s about fostering an environment where ideas can grow, spread, and evolve without unnecessary constraints. As Eric S. Raymond once said, “Given enough eyeballs, all bugs are shallow,” meaning that with more people looking at and contributing to the code, problems are more easily found and solved.&lt;/p&gt;




&lt;p&gt;References&lt;/p&gt;

&lt;p&gt;Open Source Initiative.  Available at: &lt;a href="https://opensource.org" rel="noopener noreferrer"&gt;https://opensource.org&lt;/a&gt;&lt;br&gt;
The Linux Foundation. Available at: &lt;a href="https://www.linuxfoundation.org" rel="noopener noreferrer"&gt;https://www.linuxfoundation.org&lt;/a&gt;&lt;br&gt;
Negus, C. Linux Bible.&lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>MyPy Introduction</title>
      <dc:creator>aniket purohit</dc:creator>
      <pubDate>Sun, 11 Aug 2024 18:30:00 +0000</pubDate>
      <link>https://dev.to/aniket_purohit/mypy-introduction-1i3</link>
      <guid>https://dev.to/aniket_purohit/mypy-introduction-1i3</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;MyPy&lt;sup id="fnref1"&gt;1&lt;/sup&gt; is a static type checker for Python. Unlike statically-typed languages like C++ or Java, Python is dynamically typed. This means that in Python, you don't have to explicitly declare the type of a variable; it is inferred at runtime. For example:&lt;/p&gt;

&lt;h3&gt;
  
  
  Python (Dynamically Typed)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;                &lt;span class="c1"&gt;# `num` is inferred as an integer
&lt;/span&gt;&lt;span class="n"&gt;newString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;new string&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;  &lt;span class="c1"&gt;# `newString` is inferred as a string
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In contrast, statically-typed languages require you to specify the type of each variable at compile time. This helps catch type-related errors during development rather than at runtime.&lt;/p&gt;

&lt;h3&gt;
  
  
  C++ (Statically Typed)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;            &lt;span class="c1"&gt;// `num` is declared as an integer&lt;/span&gt;
&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;newString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"new string"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// `newString` is declared as a string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why Use MyPy?
&lt;/h2&gt;

&lt;p&gt;In dynamically typed languages like Python, type errors can occur at runtime, which may lead to bugs that are harder to trace. MyPy addresses this by allowing you to add type hints to your Python code, which can be checked statically before execution. This offers several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Early Error Detection&lt;/strong&gt;: Identify type-related errors during development rather than encountering them at runtime.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improved Code Readability&lt;/strong&gt;: Type hints clarify the expected types of variables and function arguments, enhancing code readability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better IDE Support&lt;/strong&gt;: Provides improved code completion and inline documentation in IDEs that support type hints.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example with MyPy
&lt;/h3&gt;

&lt;p&gt;Here’s a simple example demonstrating the use of type hints with MyPy:&lt;/p&gt;

&lt;h4&gt;
  
  
  Without Type Hints
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;      &lt;span class="c1"&gt;# Output: 8
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hello&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;world&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# Output: helloworld
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, the &lt;code&gt;add&lt;/code&gt; function can accept both integers and strings, which might not be the intended behavior.&lt;/p&gt;

&lt;h4&gt;
  
  
  With Type Hints
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;      &lt;span class="c1"&gt;# Output: 8
# mypy will report an error for the following line:
# print(add("hello", "world"))  # TypeError: Expected int, got str
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By including type hints (&lt;code&gt;a: int&lt;/code&gt;, &lt;code&gt;b: int&lt;/code&gt;), you specify that &lt;code&gt;add&lt;/code&gt; should work with integers only. MyPy checks the code against these type hints, catching potential type-related issues early.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing and Running MyPy
&lt;/h2&gt;

&lt;p&gt;To get started with MyPy:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Installation&lt;/strong&gt;: Install MyPy using pip:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   python3 &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install &lt;/span&gt;mypy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Running MyPy&lt;/strong&gt;: Once installed, you can run MyPy to check your code for type errors. Use the following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   mypy program.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will check your code statically, similar to how a compiler checks syntax in C++. It will report any type errors it finds without actually running the code.&lt;/p&gt;

&lt;p&gt;Using MyPy effectively allows you to integrate the benefits of static typing into Python, while still enjoying the flexibility of its dynamic nature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Code an Example with MyPy
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Without MyPy
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Hello &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;

&lt;span class="c1"&gt;# These calls will fail when the program runs, but MyPy will not report an error
&lt;/span&gt;&lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Aniket&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  With MyPy
&lt;/h3&gt;

&lt;p&gt;By adding type annotations (also known as type hints), MyPy can detect potential issues:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Hello &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;

&lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;         &lt;span class="c1"&gt;# mypy will report: Argument 1 to "greeting" has incompatible type "int"; expected "str"
&lt;/span&gt;&lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Alice&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# mypy will report: Argument 1 to "greeting" has incompatible type "bytes"; expected "str"
&lt;/span&gt;&lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;World!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# No error
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;name: str&lt;/code&gt; annotation specifies that the &lt;code&gt;name&lt;/code&gt; argument should be a string.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-&amp;gt; str&lt;/code&gt; annotation specifies that the function &lt;code&gt;greeting&lt;/code&gt; will return a string.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When to Use MyPy
&lt;/h2&gt;

&lt;p&gt;MyPy is useful in several situations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Catch Errors Early&lt;/strong&gt;: Use MyPy to find type-related errors before running your code. This helps catch mistakes early and improves code reliability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Make Code Clearer&lt;/strong&gt;: Adding type hints makes your code easier to understand. It shows what types of values are expected, which helps others (and your future self) understand your code better.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Upgrade Old Code&lt;/strong&gt;: When updating old code, MyPy helps find type issues as you add type hints, making the transition smoother.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Improve Prototypes&lt;/strong&gt;: When building new features or prototypes, MyPy helps ensure that the new code works correctly with existing code by enforcing type rules.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Maintain Large Projects&lt;/strong&gt;: In big projects with many contributors, MyPy helps keep code consistent and prevents type-related bugs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Boost IDE Features&lt;/strong&gt;: If you use an IDE, MyPy improves features like code completion and navigation, making development easier.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using MyPy helps you write better, more reliable Python code while still enjoying Python's flexibility.&lt;/p&gt;

&lt;p&gt;A &lt;a href="https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html#cheat-sheet-py3" rel="noopener noreferrer"&gt;official quick cheatsheet&lt;/a&gt; for &lt;code&gt;mypy&lt;/code&gt;&lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;&lt;a href="https://mypy.readthedocs.io/en/stable/getting_started.html" rel="noopener noreferrer"&gt;Official Documentation&lt;/a&gt; ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>python</category>
      <category>mypy</category>
    </item>
  </channel>
</rss>
