<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Puneetjain on Medium]]></title>
        <description><![CDATA[Stories by Puneetjain on Medium]]></description>
        <link>https://medium.com/@puneetjain72635?source=rss-d775e70feed0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YYduxms1_1cqPGFn.jpg</url>
            <title>Stories by Puneetjain on Medium</title>
            <link>https://medium.com/@puneetjain72635?source=rss-d775e70feed0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 12:22:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@puneetjain72635/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Solving the Noisy Neighbor Problem in Kubernetes]]></title>
            <link>https://medium.com/@puneetjain72635/solving-the-noisy-neighbor-problem-in-kubernetes-1eb82e5c2217?source=rss-d775e70feed0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1eb82e5c2217</guid>
            <dc:creator><![CDATA[Puneetjain]]></dc:creator>
            <pubDate>Wed, 08 Jul 2026 03:17:10 GMT</pubDate>
            <atom:updated>2026-07-08T03:17:10.419Z</atom:updated>
            <content:encoded><![CDATA[<p>As organizations adopt Kubernetes at scale, it’s common for multiple development teams to share the same cluster. While this improves infrastructure utilization and reduces operational costs, it also introduces a new challenge — <strong>resource contention</strong>.</p><p>Without proper governance, one team’s workload can negatively impact the performance of applications owned by other teams.</p><p>Let’s understand the problem and explore practical solutions.</p><h4>The Challenge</h4><p>Imagine a Kubernetes cluster shared by four development teams:</p><ul><li>Payments Team</li><li>Orders Team</li><li>Notifications Team</li><li>Analytics Team</li></ul><p>Each team deploys its own applications independently.</p><p>Everything works fine until one day the Analytics team deploys a data-processing job that suddenly starts consuming most of the cluster’s CPU and memory.</p><p>As a result:</p><ul><li>Payment APIs become slow.</li><li>Notification services start getting evicted.</li><li>Order processing experiences higher latency.</li><li>Critical applications begin competing for resources.</li></ul><p>This is a classic example of the Noisy Neighbor Problem.</p><p>The issue isn’t Kubernetes itself — it’s the lack of resource governance.</p><h4>Why Does This Happen?</h4><p>By default, Kubernetes allows Pods to consume available cluster resources unless limits are configured.</p><p>If applications don’t define resource requests and limits, the scheduler cannot make informed placement decisions, and workloads may consume more resources than intended.</p><p>In a shared cluster, this quickly leads to:</p><ul><li>Resource starvation</li><li>Unpredictable application performance</li><li>Pod evictions due to memory pressure</li><li>Reduced cluster stability</li></ul><h4>Solution 1: Isolate Teams Using Namespaces</h4><p>The first step is to logically separate workloads.</p><p>Create a dedicated namespace for every development team.</p><pre>payments<br>orders<br>notifications<br>analytics</pre><p>Namespaces provide logical isolation for:</p><ul><li>Applications</li><li>Secrets</li><li>ConfigMaps</li><li>Network Policies</li><li>Resource policies</li></ul><p>Although namespaces don’t provide dedicated hardware, they allow administrators to apply governance independently for each team.</p><h4>Solution 2: Configure Resource Quotas</h4><p>Namespaces alone don’t prevent excessive resource usage.</p><p>Use <strong>ResourceQuota</strong> to define the maximum resources a namespace can consume.</p><p>Example:</p><pre>apiVersion: v1<br>kind: ResourceQuota<br>metadata:<br>  name: team-quota<br>spec:<br>  hard:<br>    requests.cpu: &quot;20&quot;<br>    requests.memory: 40Gi<br>    limits.cpu: &quot;30&quot;<br>    limits.memory: 60Gi</pre><p>This ensures that even if a team deploys hundreds of Pods, they cannot exceed their allocated CPU and memory budget.</p><p>Benefits include:</p><ul><li>Fair resource allocation</li><li>Prevention of resource exhaustion</li><li>Better cluster planning</li><li>Reduced noisy neighbor issues</li></ul><h4>Solution 3: Enforce Limit Ranges</h4><p>ResourceQuota controls the total resources in a namespace, but individual Pods also need boundaries.</p><p>That’s where LimitRange comes in.</p><p>Example:</p><pre>apiVersion: v1<br>kind: LimitRange<br>metadata:<br>  name: limits<br>spec:<br>  limits:<br>  - default:<br>      cpu: &quot;500m&quot;<br>      memory: &quot;512Mi&quot;<br>    defaultRequest:<br>      cpu: &quot;250m&quot;<br>      memory: &quot;256Mi&quot;<br>    type: Container</pre><p>LimitRange helps by:</p><ul><li>Applying default resource requests</li><li>Applying default limits</li><li>Preventing developers from creating containers with unlimited resources</li></ul><p>This encourages consistent resource allocation across applications.</p><h4>Solution 4: Benchmark Applications Before Deployment</h4><p>One of the biggest mistakes organizations make is assigning arbitrary CPU and memory values.</p><p>For example:</p><pre>cpu: 2<br>memory: 4Gi</pre><p>without knowing whether the application actually requires them.</p><p>Instead, every development team should perform <strong>performance benchmarking</strong> before production deployment.</p><p>Benchmarking helps determine:</p><ul><li>Peak CPU usage</li><li>Average memory consumption</li><li>Expected request throughput</li><li>Scaling behavior</li><li>Performance under load</li></ul><p>Tools such as JMeter, k6, Gatling, or Locust can be used to simulate production traffic and identify realistic resource requirements.</p><p>The results should guide the application’s CPU and memory requests and limits, leading to more efficient resource utilization.</p><h4>Solution 5: Continuously Monitor Resource Usage</h4><p>Resource management isn’t a one-time activity.</p><p>Applications evolve, traffic changes, and resource consumption fluctuates over time.</p><p>Use monitoring tools such as:</p><ul><li>Prometheus</li><li>Grafana</li><li>Kubernetes Metrics Server</li></ul><p>Track metrics like:</p><ul><li>CPU utilization</li><li>Memory utilization</li><li>Pod restarts</li><li>OOMKilled events</li><li>Node resource usage</li><li>Namespace resource consumption</li></ul><p>Monitoring enables teams to:</p><ul><li>Detect resource bottlenecks early</li><li>Right-size workloads</li><li>Optimize cluster utilization</li><li>Plan capacity proactively</li></ul><h4>A Simple Workflow</h4><p>A healthy multi-team Kubernetes platform typically follows this workflow:</p><pre>Development Team<br>        │<br>        ▼<br>Performance Benchmarking<br>        │<br>        ▼<br>Define Requests &amp; Limits<br>        │<br>        ▼<br>Deploy into Team Namespace<br>        │<br>        ▼<br>ResourceQuota + LimitRange Enforced<br>        │<br>        ▼<br>Continuous Monitoring<br>        │<br>        ▼<br>Optimize Resource Allocation</pre><p>This approach ensures fairness while maintaining cluster stability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1eb82e5c2217" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Architecture]]></title>
            <link>https://medium.com/@puneetjain72635/kubernetes-architecture-29ed87f86d1c?source=rss-d775e70feed0------2</link>
            <guid isPermaLink="false">https://medium.com/p/29ed87f86d1c</guid>
            <dc:creator><![CDATA[Puneetjain]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 14:44:30 GMT</pubDate>
            <atom:updated>2026-07-06T14:44:30.778Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*onU3Qzg6jKdEVF62.jpg" /></figure><h3>What is Kubernetes Architecture</h3><p>Kubernetes has become the industry standard today because of its elegant and well-thought-out architecture. In simple terms, Kubernetes architecture is the design and structure that defines how Kubernetes operates as a distributed system. It’s what allows multiple machines to work together as a single, unified environment that runs, manages, and scales containerized applications automatically.</p><p>In this article I will try to explain with cricket team management analogy in simpler terms.</p><p>At the highest level, Kubernetes cluster architecture consists of two main layers just like in cricket managent:</p><ol><li>The Control Plane (Master Node) — This is the brain of Kubernetes. It makes global decisions, such as scheduling applications, monitoring system health, and managing cluster state. In cricket analogy you can think of this as management, coaches and captain.</li><li>The Worker Nodes — These are the hands of Kubernetes. They run your actual workloads — the containers and Pods that power your applications. In cricket analogy you can think of this as team players.</li></ol><h3>Control Plane :- The brain of kubernetes (Team management)</h3><h4>1. The API Server :- The front door of cluster (Selection Desk)</h4><p>The Kubernetes API Server is the entry point to the entire cluster. Every request — whether from a user, the kubectl command-line tool, or internal components - goes through the API Server first.</p><blockquote>Just like in cricket Team manager / selection desk — receives all requests from players, selectors, and support staff.</blockquote><h4>2. etcd — The Cluster’s Memory (Team Records)</h4><p>etcd is a highly reliable, key-value database that stores all the cluster data. It keeps the official record of what’s running, what should be running, and the configuration of every Kubernetes component.</p><p>If the API Server is the brain’s logic center, etcd is its long-term memory — without it, Kubernetes wouldn’t know the current state of the cluster.</p><blockquote>Just like in cricket Scorebook / team records — stores the official information about the squad, strategy, and match state.</blockquote><h4>3. Scheduler — The Decision Maker (Selector)</h4><p>When you create a new Pod, the Kubernetes Scheduler decides where it should run. It checks all available worker nodes and matches each Pod to the one with the right resources, labels, and constraints.</p><p>This ensures that workloads are evenly distributed across the cluster and that no single node gets overloaded. The Scheduler’s smart decision-making is one of the key reasons how Kubernetes works efficiently in large environments.</p><blockquote>Just like in cricket Playing XI selector — decides which player should be assigned which role on the field.</blockquote><h4>4. Controller Manager — The Cluster’s Automation Engine</h4><p>The Controller Manager continuously monitors the state of the cluster and takes corrective actions whenever something drifts from the desired state.</p><p>For example:</p><ul><li>If a Pod crashes, it triggers a new one.</li><li>If a node goes down, it reschedules workloads elsewhere.</li><li>If replicas are missing, it creates them automatically.</li></ul><p>The Controller Manager acts like an autopilot system, constantly ensuring that what you defined as your desired configuration matches the actual running environment.</p><blockquote>Just like in cricket Coach’s assistant — keeps checking that the planned team is actually on the field and performing.</blockquote><h3>Worker Node — Hands of kubernetes (Team Players)</h3><h4>1. Kubelet — The Node’s Local Agent (Captain)</h4><p>The kubelet is a lightweight agent that runs on every worker node. It’s responsible for making sure the containers assigned to that node are running exactly as instructed by the control plane.</p><p>Here’s what it does:</p><ul><li>Talks to the API Server to receive Pod specifications.</li><li>Starts and monitors the containers for each Pod.</li><li>Reports back the node’s health and status to the control plane.</li></ul><p>If a Pod fails, the kubelet ensures it’s restarted or replaced according to the defined rules.</p><blockquote>Just like in cricket Captain ensures the coach’s strategy is followed on the field. He makes sure every player is in the right position, performing their role, and reports any issues back to the Team management.</blockquote><h4>2. Kube Proxy — The Network Manager (On-field Coordinator)</h4><p>The kube-proxy handles all network communication inside the cluster. It manages traffic routing to ensure that requests reach the correct Pods, no matter where they’re running.</p><p>Its key responsibilities include:</p><ul><li>Maintaining network rules on each node.</li><li>Handling load balancing for services.</li><li>Managing communication between Pods across nodes.</li></ul><p>Without kube-proxy, the distributed nature of Kubernetes networking would make communication between Pods and Services nearly impossible.</p><blockquote>Just like in cricket On-field coordinator who ensures smooth communication and coordination between players.</blockquote><h4>3. Container Runtime-The engine running the container (Players Ability)</h4><p>The container runtime is the underlying software that actually runs the containers inside Pods. Kubernetes supports multiple runtimes, including containerd and CRI-O, which are now preferred over the legacy Docker runtime.</p><p>The runtime is what pulls container images, starts containers, and manages their lifecycles based on kubelet’s instructions.</p><p>In short, the runtime does the heavy lifting, while the kubelet and kube-proxy ensure everything runs and communicates correctly.</p><blockquote>Just like in cricket its Players Ability that enables the player to perform their role. A player is selected by the coach, but it’s their <strong>batting, bowling, or fielding ability</strong> that actually wins the match.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29ed87f86d1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Jenkins Pipelines with Docker Container Agents]]></title>
            <link>https://medium.com/@puneetjain72635/optimizing-jenkins-pipelines-with-docker-container-agents-d995ee76331a?source=rss-d775e70feed0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d995ee76331a</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[pipeline]]></category>
            <dc:creator><![CDATA[Puneetjain]]></dc:creator>
            <pubDate>Sun, 05 Jan 2025 14:50:18 GMT</pubDate>
            <atom:updated>2025-01-05T18:12:54.455Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*vfDBSYybe4gxcRGmkfEQMA.png" /></figure><h3>Understanding Agents in Jenkins</h3><p>An agent is like a helper in a kitchen — it’s a machine or software instance that performs specific tasks such as running scripts, executing tests, or building components. Let’s simplify this with a relatable scenario: Imagine Puneet runs a bustling restaurant. To keep things running smoothly, he hires specialized chefs — a Pastry Chef for desserts, a Garde Manger for salads, and a Saucier for sauces. Each chef is an expert in their field and works on specific tasks.</p><p>In this analogy, Puneet’s restaurant is the pipeline, and the chefs are the agents. Just as you need a Pastry Chef to whip up the perfect cake, you need a Linux-based agent to execute a shell script. The right chef (or agent) ensures the job is done efficiently and to perfection!</p><p>Now that we have a clear understanding of agents in Jenkins, this article will specifically focus on using Docker containers as agents, leaving other types of nodes for another discussion. We’ll begin by exploring what a container as an agent is and the benefits it brings to the table.</p><h3>Why Containers as Agents Are Revolutionizing CI/CD Pipelines</h3><p>In Jenkins, the concept of a “container as agent” involves using a Docker container as a build agent. This allows you to execute Jenkins jobs within a self-contained environment, providing isolation and flexibility for different build requirements. Let’s break this down with a simple and relatable analogy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tXG_nfYOd0KdaLpy1Axkqw.jpeg" /></figure><p>Imagine Puneet restaurant Business has been challenging, and keeping full-time chefs for every role is no longer cost-effective. So, Puneet comes up with a brilliant idea: instead of hiring full-time chefs, he will hire freelancers! These chefs will be called in only when their specific expertise is needed. Here’s how Puneet explains the plan to his team:</p><p><strong>Puneet:</strong><br>“Our restaurant is struggling, so instead of keeping full-time chefs, I’ve decided to hire you as freelancers. This way, I can call you only when your expertise is needed — like a Pastry Chef for desserts or a Saucier for sauces. It’s efficient, cost-effective, and ensures we make the most of everyone’s skills!”</p><p><strong>Chef 1 (Pastry Chef):</strong><br>“So, I’ll only come in when there’s a dessert order? Sounds sweet!”</p><p><strong>Chef 2 (Garde Manager):</strong><br>“That means I can take on other gigs too? I’m in!”</p><p><strong>Chef 3 (Saucier):</strong><br>“Hmm, makes sense. No point paying me to sit around when there are no sauces to make!”</p><p>Now, let’s relate this to Jenkins:</p><h4>Containers as Chefs in Jenkins</h4><p>In this analogy, the <strong>restaurant</strong> represents your Jenkins pipeline, and the <strong>chefs</strong> represent agents. Traditionally, agents might be full-time workers — dedicated machines or VMs set up to run Jenkins jobs. However, this can be resource-intensive and costly.</p><p>By using <strong>containers as agents</strong>, you create a more flexible, on-demand system. Containers are spun up only when a pipeline triggers a job, just like calling a freelancer for a specific task. Once the job is complete, the container is removed, ensuring there are no unnecessary resources idling.</p><h3>Installation of container as agents</h3><p>I am assuming that jenkins is already installed on your machine.</p><h4>Install the Docker Pipeline plugin in Jenkins:</h4><ul><li>Log in to Jenkins.</li><li>Go to Manage Jenkins &gt; Manage Plugins.</li><li>In the Available tab, search for “Docker Pipeline”.</li><li>Select the plugin and click the Install button.</li><li>Restart Jenkins after the plugin is installed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8UJHxxv7ZoSUhfdwRvuI3A.png" /></figure><h4>Docker Slave Configuration</h4><p>Run the below command to Install Docker</p><pre>sudo apt update<br>sudo apt install docker.io</pre><h4>Grant Jenkins user and Ubuntu user permission to docker deamon.</h4><pre>sudo su - <br>usermod -aG docker jenkins<br>usermod -aG docker ubuntu<br>systemctl restart docker</pre><p>Once you are done with the above steps, it is better to restart Jenkins.</p><pre>http://&lt;ec2-instance-public-ip&gt;:8080/restart</pre><p>The docker agent configuration is now successful.</p><h4>Building a Jenkins Pipeline with a Container Agent for Java and Maven Projects</h4><p>In this project, we will demonstrate how to create a pipeline for a Java project that requires Java 8 and Maven. The process includes building a custom Docker image with the necessary tools and configuring it in the Jenkins pipeline.</p><h4>Step 1: Creating a Dockerfile for Java 8 and Maven</h4><p>The first step is to create a Dockerfile that installs Java 8 and Maven. Below is the Dockerfile:</p><pre>FROM openjdk:8-jdk<br>ENV MAVEN_VERSION=3.9.5<br>ENV MAVEN_HOME=/opt/maven<br>ENV PATH=$MAVEN_HOME/bin:$PATH<br>RUN apt-get update \<br>    &amp;&amp; apt-get install -y --no-install-recommends curl tar \<br>    &amp;&amp; mkdir -p /opt \<br>    &amp;&amp; curl -fsSL https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \<br>    | tar -xz -C /opt \<br>    &amp;&amp; mv /opt/apache-maven-${MAVEN_VERSION} $MAVEN_HOME \<br>    &amp;&amp; chmod +x $MAVEN_HOME/bin/mvn <br>RUN java -version &amp;&amp; mvn -version</pre><h4>Building the Docker Image</h4><p>Once the Dockerfile is ready, build the Docker image using the following command:</p><pre>docker build -t jenkins-agent:1 .</pre><p>This creates an image named jenkins-agent:1, which we’ll use as the container agent in our Jenkins pipeline.</p><h4>Step 2: Configuring the Jenkinsfile</h4><p>With the Docker image prepared, the next step is to configure the Jenkinsfile. Below is the Jenkins pipeline configuration:</p><pre>pipeline {<br>    agent {<br>        <strong>docker { <br>            image &#39;jenkins-agent:1&#39;<br>            args &#39;-u root&#39; <br>        }</strong><br>    }<br><br>    parameters {<br>        string defaultValue: &#39;buildBranch&#39;, description: &#39;Build Branch &#39;, name: &#39;Branch&#39;<br>    }<br><br>    stages {<br>        stage(&#39;Download Code&#39;) {<br>            steps {<br>                git branch: env.Branch, credentialsId: &#39;{Crediantial-ID}&#39;, url: &#39;{Git-URL}&#39;<br>            }<br>        }<br>        <br>        stage(&#39;Build&#39;) {<br>            steps {<br>                // Run Maven clean and install with dynamic version values<br>                sh &#39;mvn clean install &#39;<br>            }<br>        }<br>    }<br>}</pre><p>In above Jenkinsfile the highlighted part where we are defining our image details for our conatiner agent.</p><h4>Adapting the Pipeline for Other Projects</h4><p>If your project requires a different environment, you can modify the Dockerfile accordingly. For example:</p><ul><li><strong>Python Projects</strong>: Create a Dockerfile with Python installed.</li><li><strong>Node.js Projects</strong>: Use a Node.js base image and install the necessary dependencies.</li></ul><h3>Key Points</h3><ul><li>Containers as agents provide a flexible, on-demand system for running pipelines.</li><li>Enable parallel execution of multiple pipelines without resource conflicts.</li><li>Containers are removed after pipeline completion, whether successful or failed, ensuring efficient resource usage.</li><li>In this case, master nodes acts as the agent. However, the recommended approach is to have a Jenkins master-agent setup for different job requirements so that you don’t end up corrupting the Jenkins server for any system-wide configuration changes required for a job.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d995ee76331a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>