<?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 Joshiriya on Medium]]></title>
        <description><![CDATA[Stories by Joshiriya on Medium]]></description>
        <link>https://medium.com/@joshiriya2004?source=rss-5b4ffc49ecea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*NvF-KUQ1aj2ZrRwO</url>
            <title>Stories by Joshiriya on Medium</title>
            <link>https://medium.com/@joshiriya2004?source=rss-5b4ffc49ecea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 00:14:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joshiriya2004/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[I Built My Own Operating System From Scratch — Here’s What I Learned]]></title>
            <link>https://medium.com/@joshiriya2004/i-built-my-own-operating-system-from-scratch-heres-what-i-learned-a138e743b90d?source=rss-5b4ffc49ecea------2</link>
            <guid isPermaLink="false">https://medium.com/p/a138e743b90d</guid>
            <category><![CDATA[os]]></category>
            <category><![CDATA[operating-systems]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[bootloader]]></category>
            <category><![CDATA[grub]]></category>
            <dc:creator><![CDATA[Joshiriya]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 12:03:50 GMT</pubDate>
            <atom:updated>2026-07-06T12:03:50.951Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A journey from “what even is a bootloader?” to a kernel with memory management, interrupts, and a working keyboard driver.</em></p><p>A few weeks ago, I decided I wanted to understand what actually happens between pressing the power button on a computer and seeing a desktop appear. Not the textbook version — the <em>real</em> version, down to the bytes. The only way I knew to really learn that was to build it myself, from absolute zero.</p><p>No existing kernel. No copied bootloader. No standard library. Just me, a cross-compiler I built by hand, and a lot of very patient debugging.</p><p>Here’s what that looked like.</p><h3>Step Zero: You Can’t Even Use Your Own Compiler</h3><p>The first surprise: you can’t build an OS with the GCC that’s already on your machine. Your system’s GCC assumes it’s compiling programs <em>for</em> an operating system — it links against your OS’s standard library, assumes there’s a malloc, assumes there&#39;s a printf that knows how to talk to a terminal.</p><p>None of that exists yet when you’re building the terminal.</p><p>So the very first thing I had to do was build my own <strong>cross-compiler</strong> — a version of GCC and Binutils that targets i686-elf, a bare-metal target with no underlying OS assumptions at all. That meant compiling GCC from source, which took a genuine chunk of time and taught me more about toolchains than I expected going in.</p><p>Once i686-elf-gcc --version finally printed a version number, it felt like I&#39;d built the ground before I could build the house.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCY0GfzBySXXrNC07ShiNQ.png" /></figure><h3>Getting GRUB to Even Look at My Kernel</h3><p>I didn’t write my own bootloader — that’s its own rabbit hole involving 16-bit real mode, the A20 line, and manually reading disk sectors. Instead, I used <strong>GRUB</strong>, and made my kernel “multiboot compliant” — which just means embedding a specific magic number and checksum at the start of the binary so GRUB recognizes it as loadable.</p><p>The entire bridge between “GRUB has control” and “my code has control” was about 20 lines of x86 assembly: set up a stack, then jump into a C function called kernel_main. That was the entire bootloader-to-kernel handoff. It&#39;s almost anticlimactic how small it is — the complexity is all in what comes <em>after</em>.</p><h3>Writing to the Screen Without an OS</h3><p>The first real “it’s alive” moment was printing text to the screen — but there’s no printf, no console API, nothing. The trick is that VGA text mode maps directly to a fixed memory address: 0xB8000. Writing bytes there writes directly to the screen. Each character on screen is two bytes: one for the ASCII character, one for its color.</p><p>So “Hello, World” for an OS kernel is just:</p><pre>uint16_t *vga = (uint16_t*) 0xB8000;<br>vga[0] = &#39;H&#39; | (0x0F &lt;&lt; 8);</pre><p>No function call, no system, just memory. It’s a strange kind of magic the first time you see it work.</p><p>From there I built up a proper terminal driver with newline handling and screen scrolling, and eventually a hand-rolled printf clone (kprintf) supporting %d, %x, %s, and %c — using GCC&#39;s built-in variadic argument macros since there&#39;s no stdarg.h to lean on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZurewKwGj5eePSZ4DLUpMA.png" /></figure><h3>Teaching the CPU About Itself: GDT and IDT</h3><p>This is where things stopped feeling like “programming” and started feeling like operating directly on the processor.</p><p>The <strong>Global Descriptor Table (GDT)</strong> tells the CPU how memory is segmented — which regions are kernel code, which are data, what privilege level (ring 0 vs ring 3) each has. GRUB sets up a temporary one just to get you running, but you’re expected to replace it with your own.</p><p>The <strong>Interrupt Descriptor Table (IDT)</strong> was the bigger one. This is what lets the CPU respond to things happening in real time — a divide-by-zero, an invalid instruction, or a key being pressed. Setting this up meant writing 32 assembly stubs for CPU exceptions, plus additional stubs for hardware interrupts, each one saving CPU registers, calling into a C handler, and restoring state before returning with iret instead of a normal ret.</p><p>There was a genuinely satisfying moment where I deliberately triggered a divide-by-zero inside the kernel and, instead of the whole system crashing and rebooting, my exception handler caught it and printed:</p><pre>Exception: Division By Zero (int=0, err=0)</pre><p>That’s the difference between “code that happens to work” and “an operating system.”</p><h3>The PIC Trap Everyone Falls Into</h3><p>Getting keyboard input working exposed a classic gotcha: the hardware chip that manages device interrupts (the PIC) defaults to numbering hardware interrupts 0–15 — which directly collides with the CPU’s own exception numbers 0–31. Every hardware interrupt would get misinterpreted as a CPU exception unless you explicitly reprogram the PIC to remap them higher, into the 32–47 range.</p><p>Once that was sorted, wiring up a scancode-to-ASCII table and reading from I/O port 0x60 meant I could finally type into my own OS. Watching characters I typed appear on a screen with no operating system behind them, no drivers I didn&#39;t write myself, was the most rewarding checkpoint of the whole project so far.</p><h3>Memory Management: Where Theory Meets a Lot of Bugs</h3><p>This was the deepest section, split into three layers:</p><p><strong>Physical Memory Manager</strong> — GRUB hands you a memory map describing which regions of RAM are actually usable versus reserved for hardware. I built a bitmap where each bit represents one 4KB physical page frame, marked everything used by default, then freed the regions GRUB reported as available, then re-reserved whatever the kernel itself occupies.</p><p><strong>Paging</strong> — this is where “virtual memory” stops being an abstract concept from a textbook and becomes something you assemble by hand. A Page Directory pointing to Page Tables pointing to physical frames, with the CPU’s MMU translating addresses through them automatically once you load the directory into CR3 and flip the paging bit in CR0. I started with identity mapping — virtual address equals physical address — specifically so I wouldn&#39;t have two new sets of bugs at once.</p><p><strong>Heap allocation</strong> — with physical frames and paging in place, I wrote a kmalloc/kfree pair: a bump allocator for new memory, backed by a free-list so freed blocks get reused rather than wasted. Testing it meant allocating a block, writing a string into it, freeing it, then allocating again and confirming the new pointer reused the exact same address. Small moment, disproportionately satisfying.</p><h3>What I’d Tell Someone Starting This</h3><p><strong>You will hit a bug where the C calling convention bites you.</strong> Mine was pushing function arguments onto the stack in the wrong order before calling kernel_main — the classic mistake of forgetting that the <em>last</em> pushed argument is the <em>first</em> parameter. The fix was a one-line swap, but finding it required understanding exactly how arguments get read off the stack.</p><p><strong>Build your own error signals early.</strong> The reason I caught that calling-convention bug quickly is that I’d already built exception handling and kprintf — I could see the multiboot magic number was wrong instead of just getting a silent, confusing crash. Debug visibility is worth building before you think you need it.</p><p><strong>The theory only sticks once you’ve broken it.</strong> Reading about paging is one thing. Watching your OS instantly triple-fault and reboot because you forgot to identity-map the kernel’s own memory is what actually makes the mental model permanent.</p><h3>Where This Goes Next</h3><p>Right now the kernel can boot, print, catch exceptions, read keystrokes, and manage memory dynamically. Next on the list: a basic shell so keystrokes turn into actual commands, a hardware timer for preemptive multitasking, and eventually loading and running separate user-mode programs.</p><p>Every step so far has been small enough to understand completely and large enough to be genuinely satisfying when it finally works. That combination is, I think, the whole appeal of doing this from scratch instead of reading about how it works.</p><p><em>If you’re curious about the code, Github link-</em><a href="https://github.com/riyajoshi2004/myos">https://github.com/riyajoshi2004/myos</a>,<em>feel free to poke around, fork it, or tell me what I got wrong.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d-tI4CF-_KKJDDLvF7SbgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F2YoQjHwej4uXqkaQOzjOg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a138e743b90d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a CI/CD Pipeline for Spring Boot: Jenkins → Docker → Kubernetes (Locally, For Free)]]></title>
            <link>https://medium.com/@joshiriya2004/building-a-ci-cd-pipeline-for-spring-boot-jenkins-docker-kubernetes-locally-for-free-6af7911b12b9?source=rss-5b4ffc49ecea------2</link>
            <guid isPermaLink="false">https://medium.com/p/6af7911b12b9</guid>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[ngrok]]></category>
            <category><![CDATA[localhost]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[cicd-pipeline]]></category>
            <dc:creator><![CDATA[Joshiriya]]></dc:creator>
            <pubDate>Fri, 03 Jul 2026 16:31:18 GMT</pubDate>
            <atom:updated>2026-07-03T16:31:18.917Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>When you start learning DevOps, most tutorials immediately tell you to spin up servers on AWS, Google Cloud, or Azure. But let’s be honest — cloud costs can add up quickly, and nobody wants an unexpected bill at the end of the month!</p><p>What if you could build a complete, enterprise-grade CI/CD pipeline right on your laptop for <strong>absolutely free</strong>?</p><p>In this easy-to-follow guide, I will show you how I built a fully automated pipeline for a Spring Boot “Hello World” application using <strong>Jenkins, Docker, and Kubernetes (Minikube)</strong> — running entirely on <strong>localhost</strong>. If you are a beginner looking to get hands-on DevOps experience without spending a single dime on cloud servers, this guide is for you.</p><h3>Stage 1: The Foundation — Setting Up Jenkins via Docker</h3><p>Every CI/CD journey starts somewhere, and mine started with a decision: where does Jenkins actually live?</p><p>I could have installed Jenkins directly on my Windows machine — download the installer, click through a setup wizard, done. But I wanted to understand what I was building, not just get it running. So instead, I ran Jenkins <strong>inside a Docker container</strong>. Also installing Jenkins directly onto our Windows machine (which can get messy with paths and environment variables), we will run Jenkins inside a <strong>Docker Container</strong>. This keeps our setup clean and isolated.</p><p>Here’s the command that got it started:</p><p>bash</p><pre>docker network create jenkins</pre><pre>docker run -d --name jenkins \<br>  --network jenkins \<br>  -p 8080:8080 -p 50000:50000 \<br>  -v jenkins_home:/var/jenkins_home \<br>  -v /var/run/docker.sock:/var/run/docker.sock \<br>  jenkins/jenkins:lts</pre><p>At first glance this looks like a lot of flags for “just start Jenkins.” But each one earns its place:</p><ul><li><strong>-p 8080:8080</strong> exposes Jenkins&#39; web dashboard, so localhost:8080 in my browser reaches it.</li><li><strong>-v jenkins_home:/var/jenkins_home</strong> is what makes Jenkins <em>remember</em> anything. This is a Docker volume — a persistent storage location outside the container&#39;s own lifecycle. Without it, every job, credential, and plugin I configure would vanish the moment the container restarts. With it, Jenkins&#39; entire brain survives even if I delete and recreate the container itself.</li><li><strong>-v /var/run/docker.sock:/var/run/docker.sock</strong> turned out to be the single most important line in this whole project, even though I didn&#39;t fully appreciate it on day one. This mounts my host machine&#39;s Docker control socket directly into the Jenkins container. In plain terms: it gives Jenkins a direct line to command my <em>actual</em> Docker engine from the outside, rather than being sealed off inside its own container with no way to build or run images. Every Docker-related stage I&#39;d build later — image builds, deployments — depends entirely on this one mount existing.</li></ul><p>Once the container was running, I grabbed the initial admin password:</p><p>bash</p><pre>docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword</pre><p>Pasted it into localhost:8080, installed the suggested plugins, created an admin user — and there it was. A blank Jenkins dashboard, waiting for its first real job.</p><h3>The concept that mattered most here</h3><p>Before writing a single pipeline, it was worth understanding two words that show up everywhere in Jenkins documentation: <strong>controller</strong> and <strong>agent</strong>.</p><p>The <strong>controller</strong> is the main Jenkins process — the thing serving that dashboard at port 8080. It schedules work and tracks state. The <strong>agent</strong> (or node) is whatever machine actually <em>executes</em> the build steps. On a simple setup like mine, the controller doubles as its own agent — there’s no separate build machine yet, just one container doing both jobs.</p><p>That distinction seems academic on day one. It stops being academic the moment you start scaling — adding remote agents, distributing builds across machines — but understanding it early meant every later concept (workspaces, tool installations, agent any in a Jenkinsfile) made sense in context instead of feeling like magic syntax.</p><p>By the end of Stage 1, I had a running Jenkins instance, a persistent home for its configuration, and — without fully realizing it yet — the exact plumbing I’d need three stages later to teach it how to build Docker images.</p><h3>Stage 2: My First Pipeline — Just Printing “Hello Jenkins”</h3><p>With Jenkins running, it would have been tempting to jump straight into cloning a repo and building a real app. I didn’t. I wanted the very first pipeline I ever ran to do almost nothing — just enough to prove the machinery worked, with zero other variables that could go wrong.</p><p>So I created a new item in Jenkins, chose <strong>Pipeline</strong> as the type, and instead of pointing it at GitHub, I wrote the script directly in the job’s config box:</p><pre>pipeline {<br>    agent any</pre><pre>    stages {<br>        stage(&#39;Hello&#39;) {<br>            steps {<br>                echo &#39;Hello Jenkins&#39;<br>            }<br>        }<br>    }<br>}</pre><p>Five lines. No Git, no Java, no Docker. Just Jenkins proving it could run a script and print something back.</p><h3>Why bother with something this trivial?</h3><p>Because a pipeline that fails later is much easier to debug when you already know the <em>foundation</em> works. If I’d gone straight to a full build-test-deploy pipeline and hit an error on day one, I’d have no idea if the problem was Jenkins itself, my Groovy syntax, my Git credentials, or something else entirely. Starting here meant that every later failure could be isolated to whatever I’d <em>just</em> added.</p><h3>What this tiny script actually taught me</h3><p>This is where Jenkins’ <strong>Declarative Pipeline</strong> syntax started making sense, piece by piece:</p><ul><li><strong>pipeline { }</strong> — the top-level wrapper. It tells Jenkins &quot;this whole block is a Declarative Pipeline,&quot; the more structured, readable style, as opposed to raw Groovy scripting.</li><li><strong>agent any</strong> — an instruction to run this on whatever executor is available. Since I hadn&#39;t configured any separate build agents, this meant Jenkins&#39; own built-in node — the controller doing double duty, exactly as I&#39;d learned in Stage 1.</li><li><strong>stages { }</strong> — a container that holds one or more stage blocks. This is also what drives the visual pipeline view in the Jenkins UI — every stage becomes its own box, rendered left to right, so you can see at a glance where a build is, or where it failed.</li><li><strong>stage(&#39;Hello&#39;) { }</strong> — a single named phase. The name in quotes is purely a label; it&#39;s what shows up in the UI, but it doesn&#39;t affect execution.</li><li><strong>steps { }</strong> — the actual commands that run inside that stage.</li><li><strong>echo</strong> — the simplest possible step, just printing text to the console log, much like print() in most languages.</li></ul><h3>Running it</h3><p>I hit <strong>Build Now</strong>, clicked into the build number that appeared, and opened <strong>Console Output</strong>. There it was:</p><pre>[Pipeline] echo<br>Hello Jenkins<br>[Pipeline] End of Pipeline<br>Finished: SUCCESS</pre><p>A single green checkmark. A single box labeled “Hello” in the stage view. Nothing impressive to look at — but it confirmed something worth confirming: Jenkins could take a script, execute it, and report back cleanly.</p><p>That’s the entire point of Stage 2. Every pipeline I built after this — the ones with Git checkouts, Maven builds, Docker images, and eventually a Kubernetes deployment — was really just this same five-line skeleton, one stage at a time, growing more capable without ever changing its fundamental shape.</p><p><em>Next up: swapping that hardcoded script for a Jenkinsfile pulled directly from GitHub — and the first real error I hit along the way.</em></p><h3>Stage 3: Pulling the Jenkinsfile from GitHub</h3><p>Up to this point, my pipeline script lived inside Jenkins’ own config box — hardcoded, not connected to my actual project. That’s not how real CI/CD works. The whole point is that the pipeline definition lives <em>with the code</em>, versioned in the same repo, so any change to how the app is built or deployed is itself a tracked, reviewable commit.</p><p>So I switched the job’s Pipeline definition from “Pipeline script” to <strong>“Pipeline script from SCM”</strong>, pointed it at my GitHub repo, and told it to look for a file named Jenkinsfile at the root.</p><pre>stage(&#39;Checkout&#39;) {<br>    steps {<br>        git branch: &#39;main&#39;, url: &#39;https://github.com/riyajoshi2004/Springboot_Application.git&#39;<br>    }<br>}</pre><h3>Stage 4: Teaching Jenkins Where Java Lives</h3><p>My Spring Boot app needs a JDK to compile. So before writing a Build stage, I checked whether Jenkins even had one:</p><pre>docker exec -it jenkins bash<br>java -version</pre><p>The first time I ran this, something felt off — the output showed a Windows file path, not a Linux one. I’d actually let my terminal drift back to my host machine instead of staying inside the docker exec session. It was a useful mistake to make early: Jenkins runs in a completely isolated container filesystem. It cannot see, and doesn&#39;t care about, anything installed on my actual Windows machine. Every check needs to happen <em>inside</em> that container, confirmed by the prompt itself changing to something like jenkins@2ebaed4d2dbb:/$.</p><p>Once I actually ran it inside the container, the real answer appeared: Jenkins’ base image already ships a full JDK — OpenJDK 21, Temurin build — because it needs one to run Jenkins itself. I didn’t need to install anything; I just needed to formally register it as a <strong>Tool</strong> so my Jenkinsfile could reference it by name:</p><pre>tools {<br>    jdk &#39;JDK-21&#39;<br>}</pre><p>Declaring a tool like this does something specific under the hood: before any of my stages run, Jenkins locates that tool and prepends its bin/ directory to the pipeline&#39;s PATH. That&#39;s the entire mechanism — no magic, just an environment variable set at the right time.</p><h3>Stage 5: Adding Maven to the Mix</h3><p>Java existed, but Maven didn’t:</p><pre>mvn -version<br># bash: mvn: command not found</pre><p>Unlike Java, Maven wasn’t bundled into the base Jenkins image. This time, instead of pointing at something that already existed, I let Jenkins install it itself — checking “Install automatically” in Tools configuration and letting the first build download it fresh.</p><pre>tools {<br>    jdk &#39;JDK-21&#39;<br>    maven &#39;Maven-3&#39;<br>}<br>stage(&#39;Build&#39;) {<br>    steps {<br>        sh &#39;mvn -version&#39;<br>        sh &#39;mvn compile&#39;<br>    }<br>}</pre><p>I deliberately used mvn compile, not mvn package, here. Compile only turns source files into class files — no tests, no jar. That was intentional: I wanted each stage in my pipeline to prove exactly one thing, so that if something ever broke, the stage name alone would tell me what failed, without digging through a wall of combined output.</p><h3>Stage 6: Running the Tests, and Trusting the Report</h3><pre>stage(&#39;Test&#39;) {<br>    steps {<br>        sh &#39;mvn test&#39;<br>    }<br>    post {<br>        always {<br>            junit &#39;target/surefire-reports/*.xml&#39;<br>        }<br>    }<br>}</pre><p>mvn test runs anything under src/test/java, using Maven&#39;s Surefire plugin, which writes its results as XML into target/surefire-reports/. The interesting part isn&#39;t the test run itself — it&#39;s the post { always { junit ... } } block. This is a <strong>post-build action</strong>, separate from the stage&#39;s normal steps, and always means it runs whether the tests passed or failed. That distinction matters: if a test fails, I still want Jenkins to show me exactly which one and why, not just a red X with no explanation.</p><p>My default DemoApplicationTests ran, passed, and a new Test Result Trend graph appeared on the job dashboard — a small but satisfying sign that Jenkins was now doing more than just running commands blindly; it was actually understanding structured output.</p><h3>Stage 7: Producing a Real, Traceable Artifact</h3><pre>stage(&#39;Package&#39;) {<br>    steps {<br>        sh &#39;mvn package -DskipTests&#39;<br>        archiveArtifacts artifacts: &#39;target/*.jar&#39;, fingerprint: true<br>    }<br>}</pre><p>Two details worth calling out. First, -DskipTests: Maven&#39;s lifecycle means package already runs everything before it, including tests — so without this flag, my tests would silently run twice, once in my dedicated Test stage and again here. Second, archiveArtifacts: this isn&#39;t a Maven feature, it&#39;s a Jenkins one. It copies the resulting jar out of the temporary build workspace and attaches it permanently to that specific build number, so I can go back to build #7 six months from now and download the exact jar that was produced, even if the workspace itself has long since been overwritten by newer builds.</p><p>Watching Spring Boot’s plugin log Replacing main artifact ... with repackaged archive was a nice moment — that&#39;s the step that turns a plain jar into an executable one, bundling all dependencies inside so it can run standalone with nothing but java -jar.</p><h3>Stage 8: Teaching Jenkins to Speak Docker</h3><p>This is where things got genuinely interesting — and where I hit the most instructive errors of the whole project.</p><p>I added a Dockerfile to my repo, deliberately simple, copying in the jar Jenkins had already built rather than recompiling inside the image:</p><pre>FROM eclipse-temurin:21-jre-alpine<br>WORKDIR /app<br>COPY target/*.jar app.jar<br>EXPOSE 8080<br>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><p>Then I tried to run docker inside the Jenkins container and got:</p><pre>bash: docker: command not found</pre><p>Back in Stage 1, I’d mounted my host’s Docker socket into the Jenkins container — but a socket isn’t a program. It’s a door. I still needed something inside the container that knew how to knock on it. So:</p><pre>apt-get install -y docker.io</pre><p>Tried again, and hit a second, subtler error:</p><pre>permission denied while trying to connect to the Docker daemon socket</pre><p>The jenkins user inside the container simply didn&#39;t have rights to touch that socket file. The quick, learning-appropriate fix:</p><pre>chmod 666 /var/run/docker.sock</pre><p>Not something I’d do on a real production system without more thought — it opens that socket a bit too widely — but for a local learning setup, it was the right tradeoff to keep moving. I made a note to revisit this properly with a custom Jenkins image later, and also learned something important in the process: any fix I apply <em>live</em>, directly inside a running container, only survives as long as that same container instance keeps running. Delete and recreate the container, and both fixes vanish, since only the mounted volume persists.</p><p>With that resolved, the actual pipeline stage was almost anticlimactic:</p><pre>stage(&#39;Docker Build&#39;) {<br>    steps {<br>        sh &quot;docker build -t ${DOCKER_IMAGE}:${DOCKER_TAG} .&quot;<br>        sh &quot;docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest&quot;<br>    }<br>}</pre><p>Tagging every image with env.BUILD_NUMBER (Jenkins&#39; auto-incrementing build counter) rather than only latest turned out to matter more than I expected — it means every single build produces a uniquely identifiable image, which becomes essential the moment you need to trace <em>which</em> build caused a problem in production.</p><h3>Stage 9: Actually Deploying Something</h3><pre>stage(&#39;Deploy&#39;) {<br>    steps {<br>        sh &#39;&#39;&#39;<br>            docker rm -f hello-world-container || true<br>            docker run -d --name hello-world-container -p 9090:8080 ${DOCKER_IMAGE}:latest<br>        &#39;&#39;&#39;<br>    }<br>}</pre><p>The || true matters more than it looks — without it, the very first deploy would fail outright, because there&#39;s no old container yet to remove, and docker rm errors out when its target doesn&#39;t exist. Adding || true tells the shell &quot;that&#39;s fine, keep going.&quot;</p><p>One conceptual thing clicked for me here: because Jenkins was talking to my <em>host’s</em> Docker daemon (thanks to that socket mount from Stage 1), running docker run from inside Jenkins didn&#39;t create a container nested inside Jenkins. It created a completely separate, sibling container, visible right alongside Jenkins itself when I ran docker ps on my actual Windows machine.</p><p>I opened localhost:9090 expecting my app — and got Spring Boot&#39;s Whitelabel 404 error page instead. Panic, briefly. Then I remembered: my controller&#39;s actual route was /hello, not /. The 404 wasn&#39;t a failure at all — it was proof the app was running correctly, just at a different path than I&#39;d guessed.</p><h3>Stage 10: Making GitHub and Jenkins Actually Talk</h3><p>Everything so far still required me to click “Build Now” manually. That’s not continuous anything. The real goal was: push code, pipeline runs, no clicking required.</p><p>The obstacle: Jenkins lived on my localhost, and GitHub&#39;s servers on the public internet had no way to reach it. I explored two solutions.</p><p><strong>Poll SCM</strong> was the simple option — Jenkins periodically asks GitHub “anything new?” on a schedule. No exposure needed, but not instant, and still fundamentally polling rather than a real push notification.</p><p><strong>A real webhook via ngrok</strong> was the more interesting option, and the one I actually went with. ngrok creates a temporary public URL tunneling straight to my local port 8080. Getting there wasn’t frictionless — I hit ngrok: system cannot execute the specified program (it wasn&#39;t actually installed yet), then Invoke-Expression is not recognized (I was in Command Prompt, not PowerShell — a distinction I hadn&#39;t taken seriously until it broke something). After a manual install and switching terminals properly, I finally got:</p><pre>Forwarding    https://a1b2c3d4.ngrok-free.app -&gt; http://localhost:8080</pre><p>I added that URL as a webhook on my GitHub repo, pointed at /github-webhook/, enabled &quot;GitHub hook trigger for GITScm polling&quot; on the Jenkins job side, made a small code change, and pushed.</p><p>Without touching Jenkins at all, a new build started on its own within seconds.</p><p>That was, honestly, the single most satisfying moment of the entire project — not because the concept was complicated, but because it was the first time the pipeline felt genuinely <em>continuous</em> rather than something I was operating by hand.</p><p>(One caveat I learned to live with: ngrok’s free tier hands out a brand-new random URL every time it restarts, meaning the GitHub webhook needs updating each time. A real setup would run Jenkins somewhere with a stable, permanent address instead.)</p><h3>Stage 11: Bringing In Kubernetes, Without Paying for AWS</h3><p>The natural next step, inspired by a pipeline I read about that deployed to AWS EKS, was Kubernetes. But EKS costs money continuously — the control plane alone runs roughly $0.10/hour, before even counting worker nodes. For a learning project, I didn’t want to pay to learn.</p><p><strong>minikube</strong> solved that — a single-node Kubernetes cluster that runs entirely locally, for free, using the same Docker engine already running on my machine.</p><pre>minikube start --driver=docker<br>kubectl get nodes</pre><p>One node, status Ready. Before writing anything more, I made sure I actually understood four words that show up constantly in Kubernetes docs: a <strong>Pod</strong> is the smallest deployable unit, typically one container. A <strong>Deployment</strong> describes the desired state — how many copies of a pod should exist — and Kubernetes actively works to keep that state true, restarting anything that crashes. A <strong>Service</strong> is a stable network address that routes to your pods even as individual pods get replaced. A <strong>Namespace</strong> is a way to logically separate resources within the same cluster.</p><h3>Stage 12: Deploying by Hand First</h3><p>I wrote two YAML manifests — a Deployment and a Service — deliberately deploying manually before ever letting Jenkins touch Kubernetes, so I’d actually understand what Jenkins would later be automating.</p><p>The first hurdle was realizing minikube runs its <strong>own internal Docker engine</strong>, completely separate from my regular Docker Desktop. Building an image the normal way meant minikube’s cluster couldn’t see it at all. The fix was a small but essential command:</p><pre>minikube docker-env | Invoke-Expression</pre><p>This redirects the current terminal session to talk to minikube’s Docker instead. Forget to run it, and you’ll build a perfectly good image that Kubernetes simply can’t find.</p><p>With that sorted, I applied my manifests:</p><pre>kubectl create namespace staging<br>kubectl apply -f k8s/deployment.yaml<br>kubectl apply -f k8s/service.yaml</pre><p>Two pods came up, Running, inside a staging namespace. I opened it in the browser and saw my app — genuinely satisfying to see Kubernetes&#39; self-healing, multi-replica model working on my own laptop, not just in a diagram.</p><p>Then I hit a subtler problem. I changed my controller’s return message, rebuilt the image, and… the app kept showing the old text. Kubernetes, it turns out, doesn’t watch for silent changes to an image’s <em>content</em> — as far as the Deployment was concerned, nothing had changed, because the tag was still just latest. I had to explicitly tell it to notice:</p><pre>kubectl rollout restart deployment hello-world-deployment -n staging</pre><p>A useful lesson in how declarative systems actually work: they react to changes in <em>desired state</em>, not to you quietly overwriting something behind their back.</p><h3>Stage 13: Connecting Jenkins to Kubernetes</h3><p>This was, by a wide margin, the most technically dense stage of the whole project — and the one I’m proudest of actually getting working.</p><p>The challenge had two separate layers. First, Jenkins needed the kubectl binary at all — a quick fix, downloading it directly inside the container. Second, and much harder: Jenkins and minikube are two entirely separate Docker containers, on separate networks, and Kubernetes requires real certificate-based authentication before trusting any request.</p><p>I connected the two containers onto the same Docker network:</p><pre>docker network connect minikube jenkins</pre><p>Then copied my existing kubeconfig and certificates from my Windows host into the Jenkins container. This is where things got genuinely fiddly. My kubeconfig referenced Windows-style paths (C:\Users\joshi\.minikube\...), which mean nothing inside a Linux container. My first attempt at fixing this with sed only partially worked — it correctly rewrote the folder prefix but left backslashes scattered <em>inside</em> the rest of each path, producing errors like:</p><pre>unable to read client-cert /tmp/.minikube\profiles\minikube\client.crt: no such file or directory</pre><p>The real fix was to stop trying to match specific substrings and just replace every remaining backslash globally, in one pass:</p><pre>sed -i &#39;s/\\/\//g&#39; /var/jenkins_home/.kube/config</pre><p>That, plus correcting the cluster’s server address to minikube’s actual reachable IP on the shared network (rather than 127.0.0.1, which inside a container just means &quot;this same container,&quot; not my Windows host), finally got me a clean result:</p><pre>kubectl get nodes<br># minikube   Ready   control-plane</pre><p>The last piece was making sure Jenkins’ Docker builds landed in the <em>right</em> engine — minikube’s, not my regular Docker Desktop — by setting DOCKER_HOST, DOCKER_TLS_VERIFY, and DOCKER_CERT_PATH as environment variables inside the pipeline itself.</p><p>With all of that in place, the final Deploy stage became genuinely elegant:</p><pre>stage(&#39;Deploy to Kubernetes&#39;) {<br>    steps {<br>        sh &quot;kubectl set image deployment/hello-world-deployment hello-world=${DOCKER_IMAGE}:${DOCKER_TAG} -n staging&quot;<br>        sh &quot;kubectl rollout status deployment/hello-world-deployment -n staging&quot;<br>    }<br>}</pre><p>Using the build-number tag instead of latest meant Kubernetes could now detect real, meaningful changes to the Deployment automatically — no more manual rollout restart needed. And rollout status meant the pipeline would actually wait, and fail loudly, if new pods didn&#39;t come up healthy — rather than reporting a hollow SUCCESS while something was quietly broken behind the scenes.</p><p>I pushed a change, watched Jenkins trigger automatically, build, test, package, containerize, and roll out a new version to my local Kubernetes cluster — entirely on its own. That’s the moment this stopped feeling like a tutorial and started feeling like a system I actually understood, end to end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJdrm20H1fddrmHrCh06Dg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbAsyUjvh4eDEiwaOcruwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*mnV3PcFZ2H7Udj6_39rn9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NcG4qtjQ-v0hUQPLAZ5i4A.png" /></figure><h3>What I’d tell someone starting this today</h3><p>Build it exactly this slowly. Every error above taught me more than the working commands did — the case-sensitivity issue taught me how Jenkins looks for files; the socket permission issue taught me how Docker’s security model actually works; the kubeconfig path mess taught me more about how Windows and Linux disagree with each other than any course ever had. A finished pipeline you copy-pasted teaches you nothing. A pipeline you built stage by stage, and broke, and fixed, teaches you almost everything you actually need to know.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6af7911b12b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>