<?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"><channel><title><![CDATA[k8s-pod-RC-RS-DS-Deploy]]></title><description><![CDATA[k8s-pod-RC-RS-DS-Deploy]]></description><link>https://k8spoddeploy.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 15:49:38 GMT</lastBuildDate><atom:link href="https://k8spoddeploy.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Kubernetes : From Containers to Deployment]]></title><description><![CDATA[This flowchart summarizes the Kubernetes journey from containers to deployments. Each step solves a limitation of the previous one.

When we start learning Kubernetes, it is important to understand why each concept exists. This guide walks through th...]]></description><link>https://k8spoddeploy.hashnode.dev/kubernetes-flow-from-containers-to-deployment</link><guid isPermaLink="true">https://k8spoddeploy.hashnode.dev/kubernetes-flow-from-containers-to-deployment</guid><category><![CDATA[Devops]]></category><category><![CDATA[Kubernetes]]></category><category><![CDATA[AWS]]></category><category><![CDATA[#kubernetes #container ]]></category><category><![CDATA[Deploy ]]></category><category><![CDATA[deployment strategies]]></category><category><![CDATA[Hashnode]]></category><category><![CDATA[#Pods ]]></category><category><![CDATA[containers]]></category><category><![CDATA[replicaset]]></category><category><![CDATA[replication-controller]]></category><category><![CDATA[Daemon sets]]></category><dc:creator><![CDATA[Mamatha Bandi]]></dc:creator><pubDate>Wed, 20 Aug 2025 21:36:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1755776537302/d23b20a2-e988-45a4-8a3a-f432de74b507.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-this-flowchart-summarizes-the-kubernetes-journey-from-containers-to-deployments-each-step-solves-a-limitation-of-the-previous-one">This flowchart summarizes the Kubernetes journey from containers to deployments. Each step solves a limitation of the previous one.</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755775736883/b8b2cf5c-ec29-4c5a-871c-d46eb6c753a9.png" alt class="image--center mx-auto" /></p>
<p>When we start learning Kubernetes, it is important to understand why each concept exists. This guide walks through the evolution of Kubernetes components—from basic containers to advanced deployment strategies.</p>
<p>Each step solves a limitation of the previous one, helping us understand how Kubernetes manages applications in real-world environments. and background process what it is done.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755756004504/f2a3b4bb-b42a-49a1-b376-ee69996d523c.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-1-container">1. Container</h2>
<ul>
<li><p>A container is a lightweight, portable unit that packages application code and its dependencies.</p>
</li>
<li><p>It runs consistently across different environments—development, testing, and production.</p>
</li>
</ul>
<p><strong>Problem with Containers:</strong></p>
<ul>
<li><p>Containers do not restart automatically if they fail.</p>
</li>
<li><p>No built-in mechanism for scaling or managing multiple instances.</p>
</li>
<li><p>Manual effort is required to monitor and recover failed containers.</p>
</li>
</ul>
<h2 id="heading-2-pod">2. Pod</h2>
<ul>
<li><p>A Pod is the smallest building block in Kubernetes.</p>
</li>
<li><p>It can contain one or more containers ( but as a best practice one pod has only one container =&gt; 2 containers in one pod also used in sidecar containers) that share storage, network, and lifecycle.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755754364129/fa8e0703-37f6-4316-aff0-d76dd3cb8ffe.png" alt class="image--center mx-auto" /></p>
<p>Observe If anything happen to the pod suddenly deleted or crashed. It show <code>No resources found.</code><br />It not automatically Running State, If you need that pod, you need to apply manually again.</p>
<p><strong>Problem with Pods:</strong></p>
<ul>
<li><p>pod is ephemeral. (If due to any issues pod is deleted can’t up automatically)</p>
</li>
<li><p>Pods are not self-healing. If a Pod crashes, it won’t restart automatically.</p>
</li>
<li><p>No replication or scaling features by default.</p>
</li>
<li><p>Manual intervention is needed to maintain availability.</p>
</li>
</ul>
<h2 id="heading-2-replication-controller-rc">2. Replication Controller (RC) -</h2>
<p>A <strong>Replication Controller (RC)</strong> is a Kubernetes component that ensures a specified number of identical Pods are always running in the cluster.</p>
<p>If a Pod crashes or is deleted, the RC automatically creates a new one to maintain the desired count. It helps with basic fault tolerance and horizontal scaling.</p>
<p><strong>Key Features:</strong></p>
<ul>
<li><p>Maintains a fixed number of Pod replicas.</p>
</li>
<li><p>Automatically replaces failed or terminated Pods.</p>
</li>
<li><p>Supports manual scaling by changing the replica count.</p>
</li>
</ul>
<p>THIS IS SAMPLE ReplicationController YAML FILE</p>
<pre><code class="lang-bash">apiVersion: v1
kind: ReplicationController
metadata:
  name: javawebrc
  namespace: <span class="hljs-built_in">test</span>
  labels:
    name: javarc
spec:
  replicas: 3
  selector:
    app: javawebapp
  template:
    metadata:
      name: javawebpod
      labels:
        app: javawebapp
    spec:
      containers:
        - name: javawebcon
          image: mamathabandi/maven-web-app:1.0.0
          ports:
           - containerPort: 8080
</code></pre>
<h3 id="heading-why-we-are-going-for-replication-controller-instead-of-pod">Why We are Going for Replication Controller Instead of POD</h3>
<p>Before RC, Pods had to be managed manually. If a Pod failed, it wouldn’t restart unless someone run again. This was not practical for production systems.</p>
<p><strong>RC solves these problems:</strong></p>
<ul>
<li><p><strong>Self-healing:</strong> Automatically recreates Pods if they fail.</p>
</li>
<li><p><strong>Scalability:</strong> Easily increase or decrease the number of Pods.</p>
</li>
<li><p><strong>Consistency:</strong> Ensures the desired state is always maintained.</p>
</li>
</ul>
<p>In short, RC introduced automation and reliability to Kubernetes workloads, making it a foundational step toward more advanced controllers like ReplicaSet and Deployment.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755721064410/38d1b86c-4fdd-42d2-8040-7de176264d72.png" alt class="image--center mx-auto" /></p>
<p>Observe In this ReplicationController is created and <code>replicas=3</code> so it create 3 Pods. If anything happen to POD deleted or crashed. It automatically restart state.</p>
<p><code>pod/javawebrc-gwtsh</code> is deleted. That pod replaces with <code>pod/javawebrc-wp2xz</code> running. see timestamp <code>7s</code></p>
<h3 id="heading-differences-between-pod-and-replicationcontroller">Differences between POD and ReplicationController</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>POD</strong></td><td><strong>Replication Controller (RC)</strong></td></tr>
</thead>
<tbody>
<tr>
<td><strong>Pod</strong> is the basic unit that runs one or more containers, but it does not self-heal or scale automatically.</td><td><strong>Replication Controller (RC)</strong> manages multiple Pods, ensures a fixed number are always running, and recreates them if they fail.</td></tr>
</tbody>
</table>
</div><h2 id="heading-4-replicaset-rs">4. ReplicaSet (RS)</h2>
<ul>
<li><p>RS is the modern version of RC.</p>
</li>
<li><p>It uses label selectors to manage Pods more flexibly.</p>
</li>
<li><p>RS is used internally by Deployments.</p>
</li>
</ul>
<p><strong>Why RS over RC?</strong></p>
<ul>
<li><p>RS supports advanced label selectors means it is support for both equality-based selector and set-based selector..</p>
</li>
<li><p>It is more efficient and widely adopted in modern Kubernetes setups.</p>
</li>
</ul>
<h3 id="heading-equality-based-selector">Equality-based selector:</h3>
<p>In Equality based selector we use <strong><em>matchLabels</em></strong> inside selector</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755721661350/10a9b092-db93-4bfa-b524-d1debd524a3b.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-set-based-selector">Set-based Selector</h3>
<p><strong>Set-Based Selector Keywords (OneWord Definations)</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Keyword</td><td>Meaning</td></tr>
</thead>
<tbody>
<tr>
<td><code>in</code></td><td>includes</td></tr>
<tr>
<td><code>notin</code></td><td>excludes</td></tr>
</tbody>
</table>
</div><h3 id="heading-example-usage-in-matchexpression">Example Usage in <code>matchExpression</code></h3>
<pre><code class="lang-bash">selector:
  matchExpressions:
  - key: app
    operator: In
    values:
    - javawebapp1
    - javawebapp2
</code></pre>
<p>This matches Pods where the label <code>app</code> is one of the listed values.</p>
<p>In Set-based selector we use <strong><em>matchExpressions</em></strong> inside selector.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755721922992/a4607da5-e845-4a65-8839-7de4723c1702.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-difference-between-replication-controller-rc-and-replicaset-rs">Difference Between Replication Controller (RC) and ReplicaSet (RS)</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Feature</td><td>Replication Controller (RC)</td><td>ReplicaSet (RS)</td></tr>
</thead>
<tbody>
<tr>
<td><strong>Selector Type</strong></td><td>Only supports <strong>equality-based</strong> selectors</td><td>Supports <strong>equality-based</strong> and <strong>set-based</strong> selectors</td></tr>
<tr>
<td><strong>Selector Requirement</strong></td><td>Selector is <strong>optional</strong></td><td>Selector is <strong>mandatory</strong></td></tr>
<tr>
<td><strong>Label Matching Flexibility</strong></td><td>Limited to exact matches</td><td>Can match multiple values using set-based logic</td></tr>
<tr>
<td><strong>Usage</strong></td><td>Considered <strong>legacy</strong></td><td>Used by <strong>Deployments</strong> and is the current standard</td></tr>
<tr>
<td><strong>Integration with Deployment</strong></td><td>Not supported</td><td>Fully supported and managed by Deployments</td></tr>
</tbody>
</table>
</div><h3 id="heading-comparison-of-rc-and-rs">Comparison of RC and RS:</h3>
<h3 id="heading-first-see-replicationcontroller">First see ReplicationController:</h3>
<ol>
<li><p>Selector is optional to match with Labels.</p>
</li>
<li><p>Without writing selector field also it automatically matches to Labels.</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755722145593/0f03ffa9-6247-4d09-856b-7f888a051db0.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755722176679/80fce824-cccf-4324-b3cb-582976f8c874.png" alt class="image--center mx-auto" /></p>
<p>Observe without writing selector also it matches <code>app=javawebapp</code></p>
<h3 id="heading-next-see-replicaset">Next See ReplicaSet</h3>
<ol>
<li><p>In Replicaset selector is mandatory field to write</p>
</li>
<li><p>If we didn't write Selector it through error <strong><em>Selector: Required Value</em></strong></p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755722295913/0b398ea4-b3fc-4036-83d7-59dc6077ec55.png" alt class="image--center mx-auto" /></p>
<p>Observe without writing selector it through <code>Selector: Required Value</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755722319959/843aa0ce-aed0-47d0-ad64-170b2835ec97.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-5-daemonset-ds">5. DaemonSet (DS)</h2>
<ul>
<li><p>DS ensures that a Pod runs on every Node in the cluster.</p>
</li>
<li><p>Commonly used for system-level tasks like logging, monitoring agents, or networking agents.</p>
</li>
<li><h3 id="heading-one-pod-per-node">One Pod per Node:</h3>
<p>  DaemonSets guarantee that a single pod runs on each selected node</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755723330624/503b61d0-24e1-4ae5-bedd-f5da58312bd5.png" alt class="image--center mx-auto" /></p>
<p>When we run <code>kubectl get all -A -o wide</code>, we see <code>kube-proxy</code> and <code>weave-net</code> always running in the background because they are deployed as <strong>DaemonSets</strong> to ensure one Pod runs on every Node for networking and service routing.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755722544034/87edc7d9-e21b-4b31-91e1-b42df5f34832.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-daemonset-yaml">DaemonSet Yaml</h3>
<p>How to declare daemon we use nginx Instead of logging file for understanding. but in realtime used for logging, monitoring purpose of nodes deployed in 2 nodes only.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755722578529/8f0de379-3ce3-4cb5-9a31-d551a3aec444.png" alt class="image--center mx-auto" /></p>
<blockquote>
<p>We created a DaemonSet using an Nginx pod to understand how it runs one pod per node. In real-world scenarios, DaemonSets are used for logging, monitoring, or networking agents.</p>
<p>After applying the DaemonSet, it was scheduled <strong>only on slave nodes</strong>, not on the control plane node. This is because the control plane node has a <strong>taint</strong> that prevents regular workloads from being scheduled:</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755722602172/729c4ad5-fb49-4875-9216-5c509dea970b.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-tolerations">Tolerations:</h3>
<p>Add this under <code>spec.template.spec</code> in your DaemonSet:</p>
<pre><code class="lang-bash">tolerations:
- key: <span class="hljs-string">"node-role.kubernetes.io/control-plane"</span>
  operator: <span class="hljs-string">"Exists"</span>
  effect: <span class="hljs-string">"NoSchedule"</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755722642008/2162f204-1dd1-4bfe-b487-2ed7ed727ab5.png" alt class="image--center mx-auto" /></p>
<blockquote>
<p>We added a toleration to our DaemonSet so that it can be scheduled on control plane nodes, which are normally restricted by taints. This is useful for system-level Pods like logging or monitoring agents that must run on every node—including control plane nodes.</p>
<p>Without this toleration, the DaemonSet Pods will only appear on worker nodes (which have no taints).</p>
</blockquote>
<h3 id="heading-problem-with-rs-no-version-control"><strong>Problem with RS: No Version Control</strong></h3>
<ul>
<li><p>The change <strong>won’t reflect</strong> in existing Pods.</p>
</li>
<li><p>RS does <strong>not support rollback or reversion or reverting</strong> to previous versions.</p>
</li>
<li><p>You must manually delete Pods or recreate the RS to apply changes.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755723578542/c8cec2f8-49c8-418c-a093-ce62ff410c87.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Suppose I deploy a Pod with image version <code>2.0.2</code>.</p>
</li>
<li><p>Later, you update the RS YAML to use image <code>1.0.0</code> and reapply it.</p>
</li>
<li><p>Even though apply again also it won’t reflect changes see AGE of POD <code>7m37s</code> and it is pointing to <code>2.0.0</code></p>
</li>
</ul>
<h2 id="heading-6-deployment">6. Deployment</h2>
<p>A <strong>Deployment</strong> is In Kubernetes, is a higher-level object that manages ReplicaSets and ensures that a specified number of pods are running at all times. It provides features like rolling updates, rollbacks, and scaling.</p>
<p>With Deployment, you can:</p>
<ul>
<li><p>Update your application without downtime.</p>
</li>
<li><p>Roll back to a previous version if something goes wrong.</p>
</li>
<li><p>Maintain revision history for tracking changes.</p>
</li>
</ul>
<p>Deployments internally manage ReplicaSets and ensure that the desired state of your application is always maintained.</p>
<h3 id="heading-deployment-strategies-are-2-types">Deployment Strategies are 2 types:</h3>
<ol>
<li><h3 id="heading-recreate-strategy">Recreate Strategy</h3>
</li>
<li><h3 id="heading-rollingupdate-strategy">RollingUpdate strategy</h3>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755770855595/db7981dd-8ba6-4362-933a-ef7cdc12c8b9.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-1-recreate-strategy">1. Recreate Strategy</h2>
<p><strong>Definition:</strong></p>
<ul>
<li>Terminates all existing Pods before creating new ones with the updated configuration.</li>
</ul>
<p><strong>Behavior:</strong></p>
<ul>
<li><p>All old Pods are stopped first.</p>
</li>
<li><p>Then, new Pods are created with the updated version.</p>
</li>
</ul>
<p><strong>Use Case:</strong></p>
<ul>
<li>Suitable when downtime is acceptable or when the application cannot run multiple versions simultaneously.</li>
</ul>
<p><strong>Drawback:</strong></p>
<ul>
<li>Causes downtime during the update process.</li>
</ul>
<pre><code class="lang-bash">apiVersion: apps/v1
kind: Deployment
metadata:
  name: javadeploy
  namespace: <span class="hljs-built_in">test</span>
spec:
  replicas: 3
  strategy:
    <span class="hljs-built_in">type</span>: Recreate
  selector:
    matchLabels:
      app: javawebapp
  template:
    metadata:
      name: jabawebpod
      labels:
        app: javawebapp
    spec:
      containers:
        - name: javawebcon
          image: kkeducation12345/spring-app:1.0.5
          ports:
            - containerPort: 8080
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755724304914/47071abd-af4d-4a34-9baf-2b665699f07d.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 1:</strong> Used image version <code>1.0.5</code> in <code>deploy.yaml</code></p>
<pre><code class="lang-bash">kubectl apply -f deploy.yaml
kubectl get all -n <span class="hljs-built_in">test</span>
</code></pre>
<p>→ Creates Pods in the background using Deployment.</p>
<p><strong>Step 2:</strong> Edited <code>deploy.yaml</code> and changed image to <code>1.0.2</code></p>
<pre><code class="lang-bash">vi deploy.yaml  <span class="hljs-comment"># change image version to 1.0.2</span>
kubectl apply -f deploy.yaml
kubectl get all -n <span class="hljs-built_in">test</span>
</code></pre>
<p>→ New Pods created with updated version.<br />→ Old Pods terminated (Recreate strategy).<br />→ Pod age shows recent (e.g., 9s), confirming update.<br />→ Deployment revision is tracked automatically.</p>
<p><strong>Conclusion:</strong></p>
<p>Even if only the Pod template changes, Deployment reflects updates. This overcomes RS and DS limitations—<strong>versioning and rollback are possible</strong>.</p>
<p>For better understanding describe the ReplicaSet to see which version is latest(running state) and which version is old (downstate).</p>
<pre><code class="lang-bash">kubectl describe replicaset.apps/javadeploy-578998884 -n <span class="hljs-built_in">test</span> <span class="hljs-comment">#Present running vesrion 1.0.2</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755724543006/33571123-3054-446b-991e-25b2d9377d80.png" alt class="image--center mx-auto" /></p>
<pre><code class="lang-bash">kubectl describe replicaset.apps/javadeploy-578998884 -n <span class="hljs-built_in">test</span> <span class="hljs-comment"># Old Down vesrion 1.0.5</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755724572599/82a004b4-be06-41cf-86e5-8cfe42dd6091.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-rollback-to-previous-deployment-version">Rollback to Previous Deployment Version</h3>
<p>After applying multiple updates to your Deployment (e.g., changing image versions), Kubernetes tracks each change as a <strong>revision</strong>. You can view and revert to any previous revision using the following commands.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755773296753/0a1ac7e1-48a1-4d4f-8cf4-8f72c28130cd.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755724778611/0c75cd7b-ac96-46e1-bb72-8b0acab15f93.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-1-view-deployment-revision-history">1. View Deployment Revision History</h3>
<pre><code class="lang-bash">kubectl rollout <span class="hljs-built_in">history</span> deployment javadeploy -n <span class="hljs-built_in">test</span>
</code></pre>
<p>→ Shows all revisions with change-tracking.</p>
<h3 id="heading-2-view-details-of-a-specific-revision">2. View Details of a Specific Revision</h3>
<pre><code class="lang-bash">kubectl rollout <span class="hljs-built_in">history</span> deployment javadeploy -n <span class="hljs-built_in">test</span> --revision=1
kubectl rollout <span class="hljs-built_in">history</span> deployment javadeploy -n <span class="hljs-built_in">test</span> --revision=2
kubectl rollout <span class="hljs-built_in">history</span> deployment javadeploy -n <span class="hljs-built_in">test</span> --revision=3
</code></pre>
<p>→ Each revision corresponds to a specific image version:</p>
<ul>
<li><p>Revision 1: <code>kkeducation12345/spring-app:1.0.5</code></p>
</li>
<li><p>Revision 2: <code>kkeducation12345/spring-app:1.0.2</code></p>
</li>
<li><p>Revision 3: <code>kkeducation12345/spring-app:1.0.3</code></p>
</li>
</ul>
<h3 id="heading-3-rollback-to-a-previous-revision">3. Rollback to a Previous Revision</h3>
<pre><code class="lang-bash">kubectl rollout undo deployment javadeploy -n <span class="hljs-built_in">test</span> --to-revision=1
</code></pre>
<p>→ Reverts the Deployment to image version <code>1.0.5</code>.</p>
<h3 id="heading-rollback-to-previous-version">ROLLBACK TO PREVIOUS VERSION</h3>
<blockquote>
<p>Using <code>kubectl rollout undo</code>, we can revert to any previous image version based on revision history—this is one of the key advantages of using <strong>Deployment</strong> over RS or DS.</p>
</blockquote>
<h3 id="heading-observing-pod-downtime-with-recreate-strategy">Observing Pod Downtime with Recreate Strategy</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755725091479/0e09e31f-6998-4c73-93ef-53f7a4f9ebd2.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755773141999/ed91447b-4e32-46f1-9adf-fb07a2d0aff7.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 1: Connect VS Code to Master Node via SSH</strong></p>
<ul>
<li><p>Install <strong>Remote - SSH</strong> extension in VS Code.</p>
</li>
<li><p>Open Command Palette:</p>
<pre><code class="lang-bash">  Ctrl + Shift + P → Remote-SSH: Connect to Host...
</code></pre>
</li>
<li><p>Enter SSH details:</p>
<pre><code class="lang-bash">  ssh user@&lt;master-node-IP&gt;
</code></pre>
</li>
<li><p>Once connected, open your <code>deploy.yaml</code> file and make changes directly in VS Code.</p>
</li>
</ul>
<p><strong>Step 2: Apply Deployment with Recreate Strategy</strong></p>
<ul>
<li><p>In VS Code terminal:</p>
<pre><code class="lang-bash">  kubectl apply -f deploy.yaml
</code></pre>
<p>  On master node (or in another terminal), run:</p>
<pre><code class="lang-bash">  watch kubectl get po -n <span class="hljs-built_in">test</span>
</code></pre>
</li>
</ul>
<p>→ This command continuously (Every 2 seconds) monitors pod status in the <code>test</code> namespace.</p>
<h2 id="heading-2-rollingupdate-strategy">2. RollingUpdate Strategy</h2>
<p><strong>Definition:</strong></p>
<ul>
<li>Gradually replaces old Pods with new ones, ensuring that some Pods are always available during the update.</li>
</ul>
<p><strong>Behavior:</strong></p>
<ul>
<li><p>Updates a few Pods at a time (based on <code>maxUnavailable</code> and <code>maxSurge</code> settings).</p>
</li>
<li><p>Ensures zero downtime and smooth transition.</p>
</li>
</ul>
<p><strong>Use Case:</strong></p>
<ul>
<li>Ideal for production environments where availability is critical.</li>
</ul>
<p><strong>Advantage:</strong></p>
<ul>
<li>Supports rollback and maintains high availability during updates.</li>
</ul>
<h3 id="heading-rollingupdate-strategy-zero-downtime-deployment">RollingUpdate Strategy: Zero Downtime Deployment</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755725308028/0065f21e-9146-4cfb-bcb8-8521d84c7ddc.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-using-watch-see-live-status-of-pod-every-2-seconds-for-better-understanding">USING Watch see live status of pod every 2 seconds (for better understanding)</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755725216235/2292441a-4e29-48e6-8ae8-bfceb694e379.png" alt class="image--center mx-auto" /></p>
<p>In this Example, We use the RollingUpdate strategy to deploy changes in kubernetes. This method ensures that at lease one Pod remains available at all times, avoiding downtime.</p>
<p><strong><em>Steps to Observe Live POD Status:</em></strong></p>
<ol>
<li><p><strong>Connect VS Code to Master Node via SSH</strong></p>
<ul>
<li><p>Use the Remote-SSH extension in VS Code.</p>
</li>
<li><p>Connect using:</p>
<pre><code class="lang-bash">  ssh user@&lt;master-node-IP&gt;
</code></pre>
</li>
<li><p>Open your deployment YAML file and make necessary changes.</p>
</li>
</ul>
</li>
<li><p><strong>Apply the Deployment</strong></p>
<ul>
<li><p>In the VS Code terminal, run:</p>
<pre><code class="lang-bash">  kubectl apply -f rollingdeploy.yaml
</code></pre>
</li>
</ul>
</li>
<li><p><strong>Monitor Pod Status in Real Time</strong></p>
<ul>
<li><p>On the master machine or in a separate terminal, run:</p>
<pre><code class="lang-bash">  watch kubectl get po -n <span class="hljs-built_in">test</span>
</code></pre>
</li>
<li><p>This command continuously displays the current status of Pods in the <code>test</code> namespace.</p>
</li>
</ul>
</li>
</ol>
<h3 id="heading-what-we-observe">What we Observe</h3>
<ul>
<li><p>A new Pod starts before the old one is terminated.</p>
</li>
<li><p>In your image, the new Pod is up in 7 seconds while the old Pod is still running.</p>
</li>
<li><p>There is no downtime—at least one Pod is always available during the update.</p>
</li>
</ul>
<h3 id="heading-key-points">Key Points</h3>
<p>RollingUpdate ensures continuous availability. By using <code>watch kubectl get po -n test</code>, you can observe the live transition: new Pods start first, and only then are old Pods removed. This is ideal for production environments where uptime is critical.</p>
<p><mark>By reading this blog, you will clearly understand what happens in the background of Kubernetes—from container creation to deployment—and how each component plays its role in managing applications efficiently.</mark></p>
]]></content:encoded></item></channel></rss>