<?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 Trahulprabhu38 on Medium]]></title>
        <description><![CDATA[Stories by Trahulprabhu38 on Medium]]></description>
        <link>https://medium.com/@trahulprabhu38?source=rss-56b1dbd03089------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_V3-8K9EHnzshbu_</url>
            <title>Stories by Trahulprabhu38 on Medium</title>
            <link>https://medium.com/@trahulprabhu38?source=rss-56b1dbd03089------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 01:23:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@trahulprabhu38/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[Had A Fun Time Setting Up Multi-Node K8s Cluster  Across 2 VPS]]></title>
            <link>https://medium.com/@trahulprabhu38/had-a-fun-time-setting-up-multi-node-k8s-cluster-across-2-vps-8acaeb185759?source=rss-56b1dbd03089------2</link>
            <guid isPermaLink="false">https://medium.com/p/8acaeb185759</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[vps-server]]></category>
            <category><![CDATA[kubeadm]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Trahulprabhu38]]></dc:creator>
            <pubDate>Sat, 02 May 2026 17:45:26 GMT</pubDate>
            <atom:updated>2026-05-02T17:45:26.969Z</atom:updated>
            <content:encoded><![CDATA[<h3>Had A Fun Time Setting Up Multi-Node K8s Cluster on the VPS.</h3><p><em>I set up a kubeadm cluster on a bare-metal VPS server.Sharing it here for future reference.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cR34-5z71jjWK_Jx7eqlYw.png" /></figure><p>I’ve been putting this off for weeks. Last time I was experimenting with Cilium, I broke my VPS, so I had to start everything from scratch again.</p><p>Every time I thought about self-hosting Kubernetes on my own VPS instead of just paying for a managed cluster, I’d read three different tutorials, get confused by the six different ways people suggest doing it, and go back to whatever I was doing before.</p><p>Today I finally just did it. Two VMs on my VPS server, fresh Ubuntu installs, and about two hours of my Saturday evening. This is the writeup I wish I’d had before I started.</p><h3>Why even bother?</h3><p>Managed Kubernetes (GKE, EKS, etc.) is great until you get the bill. For a personal project or a small team running a handful of services, paying $70–150/month just for the control plane feels insane when you already have a server sitting there doing nothing.</p><h3>What you need before you start</h3><p>Two servers. That’s the main thing. One will be your <strong>control plane</strong> (the master — runs the API server, scheduler, etcd) and one will be your <strong>worker node</strong> (where your actual workloads run).</p><p>Both need to be Ubuntu 20.04, 22.04, or 24.04. Both need at least 2 CPUs and 2GB RAM. They need to be able to talk to each other over the network.</p><p>That’s it. Nothing else pre-installed.</p><h3>Step 1: Prepare both servers (run this everywhere)</h3><p>Before touching Kubernetes, there are three things you have to do on every node. No exceptions.</p><p><strong>Disable swap.</strong> Kubernetes flat out refuses to work with swap enabled. This has been a known requirement for years and the project has never budged on it.</p><pre>sudo swapoff -a<br>sudo sed -i &#39;/ swap / s/^/#/&#39; /etc/fstab</pre><p>The second line makes it stick after a reboot by commenting out the swap entry.</p><p><strong>Load the right kernel modules.</strong> You need overlay for the container filesystem layer and br_netfilter so iptables can see traffic crossing the network bridge.</p><pre>cat &lt;&lt;EOF | sudo tee /etc/modules-load.d/k8s.conf<br>overlay<br>br_netfilter<br>EOF</pre><pre>sudo modprobe overlay<br>sudo modprobe br_netfilter</pre><p><strong>Set the sysctl params.</strong> This tells the kernel to actually pass bridge traffic through iptables — without it, pod networking just silently doesn’t work.</p><pre>cat &lt;&lt;EOF | sudo tee /etc/sysctl.d/k8s.conf<br>net.bridge.bridge-nf-call-iptables  = 1<br>net.bridge.bridge-nf-call-ip6tables = 1<br>net.ipv4.ip_forward                 = 1<br>EOF</pre><pre>sudo sysctl --system</pre><h3>Step 2: Install the container runtime (both servers)</h3><p>Kubernetes doesn’t run containers itself — it delegates that to a container runtime. containerd is the standard choice these days.</p><pre>sudo apt update<br>sudo apt install -y containerd</pre><pre>sudo mkdir -p /etc/containerd<br>containerd config default | sudo tee /etc/containerd/config.toml</pre><p>Now here’s the thing that burned me the first time. After generating the config, you have to flip one flag:</p><pre>sudo sed -i &#39;s/SystemdCgroup = false/SystemdCgroup = true/&#39; /etc/containerd/config.toml</pre><pre>sudo systemctl restart containerd<br>sudo systemctl enable containerd</pre><p>That SystemdCgroup = true change matters more than it looks. If containerd and kubelet use different cgroup drivers, your nodes will look like they joined the cluster but pods will never actually schedule. It&#39;s the kind of bug that wastes two hours.</p><h3>Step 3: Install kubeadm, kubelet, and kubectl (both servers)</h3><pre>sudo apt-get install -y apt-transport-https ca-certificates curl gpg</pre><pre>curl -fsSL <a href="https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key">https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key</a> | \<br>  sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg</pre><pre>echo &#39;deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] <a href="https://pkgs.k8s.io/core:/stable:/v1.29/deb/">https://pkgs.k8s.io/core:/stable:/v1.29/deb/</a> /&#39; | \<br>  sudo tee /etc/apt/sources.list.d/kubernetes.list</pre><pre>sudo apt update<br>sudo apt install -y kubelet kubeadm kubectl<br>sudo apt-mark hold kubelet kubeadm kubectl</pre><p>The apt-mark hold at the end is important — it prevents Ubuntu from upgrading these packages during a routine apt upgrade, which would almost certainly break things.</p><h3>Step 4: Initialize the control plane (master only)</h3><p>This is the big one. SSH into your master node and run:</p><pre>sudo kubeadm init \<br>  --apiserver-advertise-address=&lt;YOUR_MASTER_IP&gt; \<br>  --pod-network-cidr=192.168.0.0/16</pre><p>Replace &lt;YOUR_MASTER_IP&gt; with the private IP of your master server. The pod-network-cidr is the internal IP range for pods — just use 192.168.0.0/16 unless you have a specific reason not to.</p><p>When it finishes, run these three lines — they set up kubectl access for your current user:</p><pre>mkdir -p $HOME/.kube<br>sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config<br>sudo chown $(id -u):$(id -g) $HOME/.kube/config</pre><h3>Step 5: Install networking (master only)</h3><p>Your cluster exists now but pods still can’t talk to each other. You need a CNI plugin — basically a networking layer that lives inside Kubernetes and handles pod routing. I use Calico.</p><pre>kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml</pre><p>Run kubectl get nodes after a minute or so. The master will flip from NotReady to Ready. That means it&#39;s working. <br>(P.S. Calico for now , will later install cilium.)</p><h3>Step 6: Add the worker node</h3><p>On your <strong>master</strong>, generate a join command:</p><pre>kubeadm token create --print-join-command</pre><p>You’ll get a single line that looks something like this:</p><pre>kubeadm join 10.0.0.10:6443 --token abc123.xxxx --discovery-token-ca-cert-hash sha256:xxxx</pre><p>Copy it. SSH into your <strong>worker node</strong> and run it:</p><pre>sudo kubeadm join &lt;MASTER_IP&gt;:6443 \<br>  --token &lt;TOKEN&gt; \<br>  --discovery-token-ca-cert-hash sha256:&lt;HASH&gt;</pre><p>If it prints This node has joined the cluster — you&#39;re done.</p><p>Quick thing worth knowing: don’t try running kubectl on the worker node. It&#39;ll fail with a connection refused error because there&#39;s no API server running there. That&#39;s not a bug, that&#39;s just how Kubernetes works. All your kubectl commands go through the master.</p><h3>Step 7: Verify everything</h3><p>Back on the master:</p><pre>kubectl get nodes</pre><p>You should see both nodes with Ready status:</p><pre>NAME           STATUS   ROLES           AGE<br>master-node    Ready    control-plane   5m<br>worker-node    Ready    &lt;none&gt;          1m</pre><p>That’s your cluster.</p><h3>One more thing: adding nodes later</h3><p>The token from kubeadm token create expires after 24 hours. If you want to add another server to the cluster in the future, just run this on the master to get a fresh join command:</p><pre>kubeadm token create --print-join-command</pre><p>Run the output on any new server that’s been through Steps 1–3, and it’ll join the cluster cleanly.</p><h3>Was it worth it?</h3><p>Yeah, honestly. The main thing I like is that I actually understand what’s running. There’s no abstraction layer hiding the control plane from me. If something breaks, I know where to look.</p><p>One cmd i love and would like to share is :</p><pre>export KUBECONFIG=~/.kube/config-1:/~.kube/config-2<br>k config view --flatten &gt; ~/.kube/config-new<br>export KUBECONFIG=~/.kube/config-new</pre><p>This will help you add multiple config files and connect other k8s cluster and run it through the same server.</p><p>If you’re on a VPS server , Follow these steps in order, don’t skip the kernel module part, remember the SystemdCgroup = true flag, and you&#39;ll have a working cluster by the time you finish your coffee.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8acaeb185759" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cilium, Istio, and a 2-Node k8s Cluster: How I Productionised a 6-Agent RAG System on Bare Metal]]></title>
            <link>https://medium.com/@trahulprabhu38/cilium-istio-and-a-2-node-k8s-cluster-how-i-productionised-a-6-agent-rag-system-on-bare-metal-a3e0780dc880?source=rss-56b1dbd03089------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3e0780dc880</guid>
            <category><![CDATA[cilium]]></category>
            <category><![CDATA[argo-cd]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[istio-service-mesh]]></category>
            <dc:creator><![CDATA[Trahulprabhu38]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 20:45:15 GMT</pubDate>
            <atom:updated>2026-04-12T20:45:15.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bi3120zMwXpfLXGo02mNCQ.png" /></figure><p>A deep-dive into eBPF-native networking, service mesh mTLS, and the netfilter conflicts nobody warns you about.</p><p>— -</p><p>I got the opportunity to lead the DevOps team for Agent Nexus — a multi-agent Retrieval-Augmented Generation platform designed for higher-education institutions. I didn’t just set up a cluster and call it done. I made every infrastructure decision deliberately, with production constraints in mind.</p><p>This post is about those decisions: why Cilium over Flannel or Calico, why Istio over Linkerd, how MetalLB replaced a cloud load balancer, and the specific kernel-level conflict that took the longest to debug.</p><p>— -</p><p>What Agent Nexus does</p><p>Agent Nexus ingests fragmented academic data — student results, placement records, project repositories, faculty publications — and exposes it via a natural language interface. A recruiter can ask “List final-year ML students with CGPA &gt; 8” and receive a provenance-annotated CSV. No SQL. No custom dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cjtyAhseIRVlucpMWaLQ4g.png" /></figure><p>The query flows through six specialised microservices in a deterministic pipeline:</p><p>Each agent is a containerised FastAPI service. The Orchestrator routes requests sequentially. All inter-service traffic is encrypted and policy-controlled.</p><p>— -</p><p>The infrastructure constraints</p><p>Two bare-metal nodes. No cloud provider. No managed control plane. Resource budget was tight enough that every MB of overhead mattered during LLM inference loads.</p><p>This ruled out bloated CNI plugins and sidecar configurations that consume &gt;50MB of resident memory per pod. Every tool in the stack had to justify its overhead.</p><p>— -</p><p>Cilium: eBPF-native networking over a traditional CNI</p><p>Most teams reach for Flannel (simple overlay) or Calico (BGP + policy). We chose Cilium — and it changed how we thought about observability.</p><p>Cilium operates at the eBPF layer, attaching programs directly to kernel hooks in the TC (Traffic Control) subsystem. This means:</p><p>→ L7-aware NetworkPolicy without adding a separate sidecar or proxy<br>→ Per-flow visibility via Hubble — every packet between agents, with source identity, destination port, L7 verdict, and timestamps (visible in the Hubble UI screenshot above)<br>→ No kube-proxy: Cilium handles service load-balancing in eBPF, eliminating the iptables chain overhead that compounds with each additional service</p><p>The Hubble flow table we captured in production shows: orchestrator → audit-agent (port 8006), orchestrator → table-agent (port 8002), orchestrator → intent-agent (port 8001) — all as “forwarded” with sub-millisecond latency at the kernel layer. That’s not application-level logging; that’s the eBPF program itself reporting the verdict.</p><p>Cilium NetworkPolicies enforced per-agent isolation: the SQL Generator could receive traffic only from the Column Pruning Agent and return it only to the SQL Validator. No agent had unrestricted east-west access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bi3120zMwXpfLXGo02mNCQ.png" /></figure><p>— —</p><p>Istio: zero-trust inter-agent communication</p><p>Cilium handles L3/L4 and L7 for plain HTTP. But for mTLS, certificate-based workload identity, and traffic management policies, we layered Istio on top.</p><p>Each agent pod gets an Envoy sidecar injected at admission time. All inter-agent communication transits through the sidecar pair, not the application network stack directly. This gives us:</p><p>→ mTLS by default — PeerAuthentication set to STRICT across the default namespace; plaintext connections rejected at the proxy<br>→ AuthorizationPolicy per service — e.g., the SQL Validator only accepts requests from source principals matching the SQL Generator’s SPIFFE identity<br>→ VirtualService + DestinationRule per agent for circuit breaking and timeout control<br>→ Real-time traffic topology in Kiali — versioned app graph showing every service-to-service edge with RPS, error rate, and latency</p><p>The Kiali traffic graph (screenshot attached) shows the Orchestrator fanning out to all 6 agents with green (healthy) edges. That graph auto-refreshes every 1 minute from live Envoy telemetry — no instrumentation required at the application layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IDB3f0gmGF_CqFK0LWDV1g.png" /></figure><p>— -</p><p>The conflict: Cilium eBPF vs Istio iptables</p><p>Here’s the part nobody writes about.</p><p>Istio’s traffic interception is iptables-based by default. When a pod starts, the istio-init container inserts iptables rules that redirect all inbound and outbound traffic through the Envoy sidecar on port 15001/15006. This happens in the pod’s network namespace via the PREROUTING and OUTPUT chains.</p><p>Cilium, meanwhile, attaches eBPF programs at the TC layer (tc ingress/egress hooks) and optionally at the socket level (sockops/sk_msg). On a kernel where both are active, the interception order matters critically:</p><p>— If Cilium’s eBPF program processes a packet before Istio’s iptables REDIRECT rule fires, Cilium may forward the packet directly to the destination port, bypassing the Envoy sidecar entirely. mTLS breaks silently.<br> — If the iptables rules fire first (as expected), Cilium sees post-redirect traffic and its L7 parsing may misidentify the connection state.</p><p>The fix was a combination of:<br>1. Enabling Cilium’s native kube-proxy replacement ( — kube-proxy-replacement=strict) to eliminate any iptables-based service routing entirely<br>2. Setting Cilium’s socketLB and hostServices flags to avoid conflicts with Istio’s inbound interception in the pod netns<br>3. Annotating agent pods with traffic.sidecar.istio.io/includeOutboundIPRanges to scope Istio’s iptables rules to only the relevant CIDR ranges</p><p>After this configuration, Hubble showed correct mTLS-labelled flows and Kiali showed green mTLS lock icons on every edge.</p><p>— -</p><p>MetalLB: on-premise LoadBalancer without a cloud provider</p><p>Kubernetes LoadBalancer Services are designed for cloud environments — they call a cloud API to provision an external load balancer. On bare metal, that call silently no-ops and the service stays in “pending” forever.</p><p>MetalLB solves this by implementing the LoadBalancer controller in-cluster. We deployed it in Layer 2 mode: MetalLB responds to ARP requests for the allocated VIP, making one node responsible for announcing it on the LAN. Traffic hits the VIP, MetalLB routes it to the Istio Ingress Gateway pod, and from there into the service mesh.</p><p>The result: a stable external IP for the Orchestrator endpoint, fully on-premise, zero cloud dependency.</p><p>— -</p><p>Cert-Manager: declarative TLS lifecycle</p><p>With 6+ services each needing TLS certificates (both for Istio’s workload identity and for any direct HTTPS endpoints), manual certificate management was a non-starter.</p><p>Cert-Manager watches Certificate custom resources and communicates with the configured issuer (we used a self-signed ClusterIssuer for the internal CA) to provision and rotate certificates automatically. Renewals happen 30 days before expiry. The application sees a Kubernetes Secret; it never touches the certificate lifecycle.</p><p>— -</p><p>Observability: Kiali + Prometheus</p><p>The Kiali versioned app graph gave us the most useful operational view: a live topology of every agent and its traffic edges, colour-coded by health. When a service degraded, we saw the edge turn yellow/red within a minute — before any alerting fired.</p><p>Prometheus scraped Envoy sidecar metrics (istio_requests_total, istio_request_duration_milliseconds) per source-destination pair. This gave us per-agent latency histograms and error-rate time series without a single line of instrumentation in the application code.</p><p>— -</p><p>What I would do differently</p><p>→ Enable Cilium’s Hubble relay in production from day one — it adds negligible overhead and the per-flow visibility is irreplaceable during debugging<br>→ Use Cilium’s native Istio integration ( — set cilium.istioGatewayCompatibility=true in newer versions) to formally declare the interop rather than tuning it empirically<br>→ Upgrade to a 3-node cluster for control-plane HA — running etcd on a single node is not production-safe for persistent workloads</p><p>— -</p><p>The repo is open: <a href="https://github.com/trahulprabhu38/nexus-AgenticAI">https://github.com/trahulprabhu38/nexus-AgenticAI</a></p><p>If you’re building multi-agent systems and want to avoid the netfilter debugging session I went through — read the Cilium + Istio interop docs before you deploy. They’re sparse, but they exist.</p><p>#Kubernetes #Cilium #Istio #eBPF #ServiceMesh #BareMetalK8s #MLOps #DevOps #RAG #MultiAgentAI</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3e0780dc880" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Probes Explained Through 9 Real-World Examples]]></title>
            <link>https://medium.com/@trahulprabhu38/kubernetes-probes-explained-through-9-real-world-examples-7460bd381647?source=rss-56b1dbd03089------2</link>
            <guid isPermaLink="false">https://medium.com/p/7460bd381647</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[startupproble]]></category>
            <category><![CDATA[readinessprobe]]></category>
            <category><![CDATA[livenessprobe]]></category>
            <category><![CDATA[probe]]></category>
            <dc:creator><![CDATA[Trahulprabhu38]]></dc:creator>
            <pubDate>Fri, 26 Dec 2025 04:32:25 GMT</pubDate>
            <atom:updated>2025-12-26T04:32:25.266Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wmNvoMVQc-89Iybo0opkFQ.jpeg" /></figure><p>Kubernetes probes are one of the most misunderstood yet critical parts of running workloads in production.</p><p>Misusing them leads to <strong>CrashLoopBackOff</strong>, broken rollouts, and unnecessary downtime.</p><p>Let me give you nine real scenarios you will actually face and explain <strong>why each probe configuration exists and how Kubernetes behaves internally</strong>.</p><h3>Example 1: Slow-Starting Backend API (Startup + Liveness + Readiness)</h3><h3>Scenario</h3><p>A backend service:</p><ul><li>Takes ~50–60 seconds to boot</li><li>Connects to a database</li><li>Should not be restarted during startup</li></ul><h3>Configuration</h3><pre>startupProbe:<br>  httpGet:<br>    path: /healthz<br>    port: 8000<br>  initialDelaySeconds: 5<br>  periodSeconds: 3<br>  failureThreshold: 20<br><br>livenessProbe:<br>  httpGet:<br>    path: /healthz<br>    port: 8000<br>  periodSeconds: 10<br>  failureThreshold: 3<br><br>readinessProbe:<br>  httpGet:<br>    path: /readyz<br>    port: 8000<br>  periodSeconds: 5</pre><h3>What happens internally</h3><ul><li>Kubernetes waits 5 seconds before starting startup checks</li><li>Startup probe runs every 3 seconds</li><li>Allowed startup time = 20 × 3 = 60 seconds</li></ul><p>Until startup succeeds:</p><p>- Liveness and Readiness aredisabled</p><p>Once startup succeeds:</p><ul><li>Traffic can flow (after readiness)</li><li>Liveness protects against runtime hangs</li></ul><p>This configuration <strong>prevents premature restarts</strong> during long initialization.</p><h3>Example 2: Fast-Starting API (No Startup Probe)</h3><h3>Scenario</h3><p>A small API that starts in under 3 seconds.</p><h3>Configuration</h3><pre>livenessProbe:<br>  httpGet:<br>    path: /healthz<br>    port: 8080<br>  initialDelaySeconds: 5<br>  periodSeconds: 10<br>  failureThreshold: 3<br><br>readinessProbe:<br>  httpGet:<br>    path: /readyz<br>    port: 8080<br>  periodSeconds: 5</pre><ul><li>Kubernetes waits 5 seconds</li><li>Liveness and readiness start immediately after</li><li>If liveness fails 3 times → container restarts</li><li>If readiness fails → traffic stops, container continues</li></ul><p>Startup probe is unnecessary here and would only add noise.</p><h3>Example 3: Frontend Application (Readiness-Focused)</h3><h3>Scenario</h3><p>A React / Next.js frontend:</p><ul><li>Rarely crashes</li><li>Main concern is serving traffic correctly</li></ul><h3>Configuration</h3><pre>readinessProbe:<br>  httpGet:<br>    path: /<br>    port: 3000<br>  initialDelaySeconds: 3<br>  periodSeconds: 5<br>  timeoutSeconds: 1<br>  failureThreshold: 2</pre><h3>Why this works</h3><ul><li>Readiness controls whether users see the frontend</li><li>No liveness avoids unnecessary restarts</li><li>If the frontend breaks → traffic stops immediately</li></ul><p>Frontend failures are usually fixed by redeploys, not restarts.</p><h3>Example 4: NGINX Reverse Proxy</h3><h3>Scenario</h3><p>NGINX acting as:</p><ul><li>Reverse proxy</li><li>SSL terminator</li><li>Config reload dependent</li></ul><h3>Configuration</h3><pre>livenessProbe:<br>  httpGet:<br>    path: /healthz<br>    port: 80<br>  initialDelaySeconds: 5<br>  periodSeconds: 10<br>  failureThreshold: 3<br><br>readinessProbe:<br>  httpGet:<br>    path: /healthz<br>    port: 80<br>  periodSeconds: 5</pre><h3>Behavior</h3><ul><li>If config breaks:</li><li>Readiness fails → traffic stops</li><li>If failure continues:</li><li>Liveness restarts NGINX</li></ul><p>HTTP probes verify <strong>request handling</strong>, not just open ports.</p><h3>Example 5: Database (PostgreSQ0L) — Readiness Only</h3><h3>Scenario</h3><p>A stateful database:</p><ul><li>Long startup</li><li>Restarts are risky</li><li>Should not receive traffic when unavailable</li></ul><h3>Configuration</h3><pre>readinessProbe:<br>  tcpSocket:<br>    port: 5432<br>  initialDelaySeconds: 20<br>  periodSeconds: 10<br>  timeoutSeconds: 1<br>  failureThreshold: 3</pre><h3>Key design choice</h3><ul><li>TCP probe checks if DB is accepting connections</li><li>No liveness probe → avoids destructive restarts</li><li>Readiness ensures apps stop sending traffic during outages</li></ul><p>For databases, <strong>availability matters more than restarts</strong>.</p><h3>Example 6: Startup Probe with Graceful Shutdown</h3><h3>Scenario</h3><p>An app that:</p><ul><li>Needs time to flush data on restart</li><li>Must shut down cleanly</li></ul><h3>Configuration</h3><pre>startupProbe:<br>  httpGet:<br>    path: /healthz<br>    port: 8080<br>  failureThreshold: 15<br>  periodSeconds: 4<br>terminationGracePeriodSeconds: 60</pre><ul><li>Startup allowed time = 15 × 4 = 60 seconds</li></ul><p>If startup ultimately fails:</p><ul><li>SIGTERM is sent</li><li>App has 60 seconds to clean up</li><li>Then SIGKILL</li></ul><p>This avoids abrupt data loss.</p><h3>Example 7: Flaky Dependency Recovery (successThreshold)</h3><h3>Scenario</h3><p>Service depends on:</p><ul><li>Network</li><li>External APIs</li><li>Temporary failures possible</li></ul><h3>Configuration</h3><pre>readinessProbe:<br>  httpGet:<br>    path: /readyz<br>    port: 8080<br>  periodSeconds: 5<br>  successThreshold: 3<br>  failureThreshold: 1</pre><h3>Why this matters</h3><ul><li>One failure → Pod becomes NotReady</li><li>Requires 3 consecutive successes to become Ready again</li><li>Prevents traffic flapping during unstable periods</li></ul><p>This is critical in real production environments.</p><h3>Example 8: Readiness Probe Runs Faster When Unready</h3><h3>Kubernetes behavior (often missed)</h3><p>When a Pod is <strong>NotReady</strong>:</p><ul><li>Kubernetes may run readiness probes <strong>more frequently</strong></li><li>periodSeconds can be temporarily ignored</li></ul><h3>Why Kubernetes optimizes for:</h3><blockquote><em>“Make the Pod ready as soon as possible.”</em></blockquote><p>This behavior:</p><ul><li>Applies only to readiness</li><li>Does NOT apply to liveness or startup probes</li></ul><h3>Example 9: Bad Configuration (CrashLoopBackOff)</h3><h3>Configuration</h3><pre>livenessProbe:<br>  httpGet:<br>    path: /healthz<br>    port: 8080<br>  initialDelaySeconds: 2<br>  failureThreshold: 1</pre><h3>What happens</h3><ul><li>App is still starting</li><li>Liveness runs too early</li><li>One failure → restart</li><li>Infinite restart loop</li></ul><p>This is the <strong>most common probe mistake</strong> in Kubernetes.</p><h3>Key Takeaways</h3><ul><li><strong>startupProbe</strong> protects slow startups</li><li><strong>livenessProbe</strong> restarts broken containers</li><li><strong>readinessProbe</strong> protects users from bad traffic</li><li>HTTP probes are better than TCP for web apps</li><li>Databases should almost never have liveness probes</li></ul><h3>Final Rule of Thumb</h3><ul><li>Backend, Frontend, NGINX → HTTP /healthz</li><li>Databases, brokers → TCP readiness</li><li>Slow apps → startupProbe</li><li>User impact → readinessProbe</li></ul><p>Understanding probes changes how you think about application health in Kubernetes.Instead of guessing, you explicitly tell the platform when your app is alive, ready, or still starting. <strong>That clarity is what makes Kubernetes powerful in production.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7460bd381647" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[8 Real, ProvenWays to Protect Your VPS From Constant Global Brute-Force Attacks]]></title>
            <link>https://medium.com/@trahulprabhu38/8-real-provenways-to-protect-your-vps-from-constant-global-brute-force-attacks-07497c4db823?source=rss-56b1dbd03089------2</link>
            <guid isPermaLink="false">https://medium.com/p/07497c4db823</guid>
            <category><![CDATA[vps-server]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[vps]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Trahulprabhu38]]></dc:creator>
            <pubDate>Sat, 22 Nov 2025 17:50:37 GMT</pubDate>
            <atom:updated>2025-11-22T17:50:37.173Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DfjHtGY6ORV-iUAmG2_Drw.png" /></figure><p>I was doing a routine check on my VPS when I decided to explore /var/log/auth.log, mostly because I had recently learned that it stores all SSH authentication activity. I wasn’t expecting anything unusual , just a few entries from my own logins.</p><pre>#Run this to view the logs of all the attempts made to access the server<br>grep sshd /var/log/auth.log</pre><p>Instead, I found pages of repeated login attempts coming from servers across the world. Unknown usernames, rapid-fire password failures, and continuous connection attempts filled the log. It became clear very quickly that my VPS had been getting brute-forced for days without me noticing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e5wUzkIIxTlmhGf0x0PujA.png" /></figure><p>This isn’t unusual , in fact, any VPS exposed to the public internet will be scanned and targeted within minutes of going live. But seeing it firsthand made me realize how vulnerable an unmanaged server really is.</p><p>So, I spent the next few hours properly hardening my VPS. I implemented eight practical security steps that immediately stopped the attacks and significantly reduced my exposure.</p><p>In this article, I’ll walk through each step I applied, why it matters, and how you can implement it safely on your own server — without the guesswork.</p><h3>⚠️ First, Here’s What Brute-Force Attacks Actually Look Like</h3><p>Your logs will start showing:</p><pre>Failed password for invalid user admin...<br>Failed password for root...<br>Invalid user user...<br>Connection closed by invalid user...<br>PAM service ignoring max retries...</pre><p>This is 100% normal for any publicly exposed VPS.</p><p>If you see this:<br> — <strong>You haven’t done anything wrong.</strong><br> — <strong>But you haven’t secured your server either.</strong></p><p>You’re running publicly, with default settings, and bots love that.</p><p>So here are the <strong>8 exact things</strong> I implemented to lock my VPS down. But before you execute any of this make sure u read through everything first and you know everything being used here , else YOU WILL END UP GETTING LOCKED OUT OF THE VPS SERVER WITH NO ACCESS.</p><h3>1. Disable SSH Password Logins Completely</h3><p>This is the number one thing every beginner gets wrong.</p><p>If your VPS allows <strong>password authentication</strong>, you are always one weak password away from a full server compromise.</p><p>Bots will eventually guess one.<br>It’s only a matter of time.</p><p><strong>Solution:</strong><br> Force SSH key authentication.</p><p>Open:</p><pre>sudo nano /etc/ssh/sshd_config</pre><p>Set:</p><pre>PasswordAuthentication no<br>ChallengeResponseAuthentication no<br>UsePAM yes</pre><p>Restart:</p><pre>sudo systemctl restart sshd</pre><p><strong>Be careful:</strong><br> Make sure your SSH keys are working <em>before</em> disabling passwords — otherwise, you lock yourself out.</p><h3>2. Disable Root Login Over SSH</h3><p>The root account is attacker target #1.</p><p>Don’t keep that door open.</p><p>Change this:</p><pre>PermitRootLogin no</pre><p>Restart SSH.</p><p>From now on, you log in as a normal user and use sudo.</p><p><strong>Be careful:</strong><br> Never disable root login before creating a sudo user.<br> Learn this once. It hurts otherwise.</p><h3>3. Create a Separate Non-Root User for SSH</h3><p>Instead of logging in as root, create a hardened user:</p><pre>sudo adduser &lt;username&gt;<br>sudo usermod -aG sudo &lt;username&gt;</pre><p>You now have:</p><ul><li>A normal user for login.</li><li>sudo privileges for admin tasks.</li><li>Root account shielded from brute-force.</li></ul><h3>4. Set Up SSH Key Authentication (Nobody Logs in Without Your Private Key)</h3><p>Generate keys on your machine:</p><pre>ssh-keygen -t ed25519</pre><p>Copy it to server:</p><pre>ssh-copy-id &lt;username&gt;@&lt;your-ip&gt;</pre><p>Or manually:</p><p>Copy id_ed25519.pub into:</p><pre>~/.ssh/authorized_keys<br>chmod 700 ~/.ssh<br>chmod 600 ~/.ssh/authorized_keys</pre><p>Now, even if attackers know your username, they cannot enter without your private key.</p><p>This is 1000x stronger than passwords.</p><h3>5. Install Fail2Ban (Your Automated Bouncer)</h3><p>Fail2ban is a lightweight intrusion-prevention tool that monitors log files for repeated failed login attempts. When it detects suspicious behavior — like bots brute-forcing SSH — it automatically blocks the attacker’s IP using your firewall. It’s one of the simplest and most effective ways to reduce automated attacks without changing your existing setup.</p><p>Install:</p><pre>sudo apt install fail2ban -y</pre><p>Configure:</p><pre>sudo nano /etc/fail2ban/jail.local</pre><p>Add:</p><pre>[sshd]<br>enabled = true<br>port = 2222<br>maxretry = 3<br>findtime = 600<br>bantime = 3600</pre><p>Restart:</p><pre>sudo systemctl restart fail2ban</pre><p>This instantly cuts down 95% of brute-force noise. Here are <strong>simple, useful 2–3 example commands</strong> you can include in your Fail2ban section to help readers verify things quickly:</p><h4>1. Check Fail2ban service status</h4><p>Shows whether Fail2ban is running properly.</p><pre>sudo systemctl status fail2ban</pre><h4>2. List all active jails</h4><p>Useful to confirm SSH brute-force protection is enabled.</p><pre>sudo fail2ban-client status</pre><h4>3. Check details of the SSH jail</h4><p>Shows banned IPs, total attempts, and current monitoring status.</p><pre>sudo fail2ban-client status sshd</pre><h3>6. Change Your SSH Port (Not Security by Obscurity — Just Less Noise)</h3><p>Bots aggressively scan port <strong>22</strong>.<br> Moving SSH to a custom port dramatically reduces the attack surface.</p><p>Edit:</p><pre>Port 2222</pre><p>Allow it in firewall:</p><pre>sudo ufw allow 2222/tcp</pre><p>Restart SSH:</p><pre>sudo systemctl restart sshd</pre><p><strong>Big warning:</strong><br> Change the port incorrectly and you will lock yourself out.<br> Always keep your original SSH session open while testing.</p><h3>7. Configure a Strict Firewall (UFW)</h3><p>Before securing anything else, I set my defaults:</p><pre>sudo ufw default deny incoming<br>sudo ufw default allow outgoing</pre><p>Then I allowed only these:</p><pre>sudo ufw allow 2222/tcp<br>sudo ufw allow 80<br>sudo ufw allow 443</pre><p>Block everything else.</p><p>Your firewall is now tight.</p><p><strong>Common mistake:</strong><br> If you enable UFW without adding your SSH port first, you will immediately lose access.</p><h3>8. Restrict SSH to Your IP / Use a VPN (Ultimate Security)</h3><p>This is the highest level of security and completely kills all brute-force attempts.</p><h3>Option A — Restrict SSH to just your IP:</h3><pre>sudo ufw allow from YOUR_IP to any port 2222 proto tcp</pre><p>Everything else gets:</p><pre>sudo ufw deny 2222/tcp</pre><p>Attackers on the internet?<br> They can’t even see your SSH port.</p><h3>Option B — Use a WireGuard VPN (Best Practice)</h3><p>Set up WireGuard so your server has a private VPN IP:</p><pre>10.0.0.1</pre><p>Your local machine gets:</p><pre>10.0.0.2</pre><p>Now SSH only works <strong>inside VPN</strong>:</p><pre>ssh rahul@10.0.0.1 -p 2222</pre><p>Public internet can’t reach it at all.</p><p>You just made your server invisible.</p><h3>How to Know Your Hardening Worked</h3><p>Your brute-force logs will go from:</p><pre>Failed password for root...<br>Invalid user admin...<br>Failed password for user...</pre><p>To:</p><p><strong>Absolutely nothing. </strong>Your SSH logs turn silent — and that silence is beautiful.</p><h4>Security is never “finished,” but now you’ve built a strong foundation that puts you ahead of most VPS owners.</h4><h4>If you found this breakdown useful and want more practical DevOps tips, real-world debugging lessons, and hands-on cloud security guides, feel free to follow me.</h4><h4>I share what I learn as I build, break, and secure systems , so you don’t have to repeat the same mistakes.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07497c4db823" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ When My SonarQube Crashed, I Learned Backups the Hard Way]]></title>
            <link>https://medium.com/@trahulprabhu38/when-my-sonarqube-crashed-i-learned-backups-the-hard-way-9c42caed9aeb?source=rss-56b1dbd03089------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c42caed9aeb</guid>
            <category><![CDATA[sonarqube]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Trahulprabhu38]]></dc:creator>
            <pubDate>Sun, 21 Sep 2025 20:26:10 GMT</pubDate>
            <atom:updated>2025-09-21T20:26:10.832Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OvVON-2OCtlOFWnLPYgYtQ.png" /></figure><h3>The Crash That Sparked This Journey</h3><p>A few days ago, I was running a <strong>SonarQube production server</strong> for my team.<br> It worked beautifully… until one morning it didn’t.</p><p>The server <strong>crashed hard</strong>. No persistence. No backups. Weeks of data and code quality reports , quality metrics were gone in seconds.</p><p>That pain taught me a priceless lesson: <em>resilience isn’t optional</em>.</p><p>So I set out to design a <strong>secure, production-ready SonarQube setup with PostgreSQL</strong> — this time with <strong>persistence, backups, and disaster recovery</strong> baked in.</p><p>Here’s how I turned chaos into control.</p><h3>🛠️ The Setup</h3><ul><li>The backbone of my deployment was a simple but powerful docker-compose.yml:</li></ul><pre>version: &quot;3.8&quot;<br>services:<br>  db:<br>    image: postgres:13<br>    restart: unless-stopped<br>    environment:<br>      POSTGRES_USER: sonar<br>      POSTGRES_PASSWORD: sonarpasschangeit<br>      POSTGRES_DB: sonarqube<br>    volumes:<br>      - administrator_sonarqube_db_data:/var/lib/postgresql/data<br>      - ./db_backups:/backups<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;pg_isready -U sonar -d sonarqube&quot;]<br>      interval: 15s<br>      timeout: 5s<br>      retries: 5<br> sonarqube:<br>    image: sonarqube:community-latest<br>    depends_on:<br>      db:<br>        condition: service_healthy<br>    restart: unless-stopped<br>    environment:<br>      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonarqube<br>      SONAR_JDBC_USERNAME: sonar<br>      SONAR_JDBC_PASSWORD: sonarpasschangeit<br>      SONAR_WEB_JAVAOPTS: &quot;-Xmx1536m -Xms512m&quot;<br>      SONAR_SEARCH_JAVAOPTS: &quot;-Xmx1024m -Xms512m&quot;<br>      SONAR_CE_JAVAOPTS: &quot;-Xmx1024m -Xms256m&quot;<br>    volumes:<br>      - administrator_sonarqube_extensions:/opt/sonarqube/extensions<br>      - administrator_sonarqube_logs:/opt/sonarqube/logs<br>      - administrator_sonarqube_temp:/opt/sonarqube/temp<br>    ports:<br>      - &quot;9000:9000&quot;<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;curl -f http://localhost:9000/api/system/health || exit 1&quot;]<br>      interval: 20s<br>      timeout: 5s<br>      retries: 6<br>volumes:<br>  administrator_sonarqube_db_data:<br>  administrator_sonarqube_extensions:<br>  administrator_sonarqube_logs:<br>  administrator_sonarqube_temp:</pre><h3>📦 Persistence with Docker Volumes</h3><p>These named volumes became the backbone of resilience:</p><ul><li>administrator_sonarqube_db_data → PostgreSQL data (<strong>critical</strong>)</li><li>administrator_sonarqube_extensions → SonarQube plugins</li><li>administrator_sonarqube_logs → Logs</li><li>administrator_sonarqube_temp → Temp files</li></ul><h3>🛡️ Automating Backups</h3><p>After the crash, I swore I’d never trust “manual backups” again.<br> So I automated them with a <strong>Bash script + cron job</strong>:</p><pre>#!/usr/bin/env bash<br>BACKUP_DIR=/home/administrator/db_backups<br>mkdir -p &quot;$BACKUP_DIR&quot;<br>TIMESTAMP=$(date +&quot;%F_%H%M&quot;)<br><br>docker exec -u postgres administrator-db-1 \<br>  pg_dump -U sonar sonarqube | gzip &gt; \<br>  &quot;${BACKUP_DIR}/sonarqube_${TIMESTAMP}.sql.gz&quot;<br># Delete backups older than 30 days<br>find &quot;$BACKUP_DIR&quot; -type f -name &quot;sonarqube_*.sql.gz&quot; -mtime +30 -delet</pre><p>And the cron job to run it daily at 2 AM:</p><pre>0 2 * * * /home/administrator/sonar_backup.sh</pre><p>Now, my database quietly backs itself up every night.</p><blockquote><em>Peace of mind delivered at 2:00 AM.</em></blockquote><h3>🔄 Disaster Recovery in Minutes</h3><p>If disaster strikes again, restoring is muscle memory now:</p><pre># 1. Drop the old DB (optional if you want a clean restore)<br>docker exec -it administrator-db-1 psql -U sonar -d postgres -c &quot;DROP DATABASE sonarqube;&quot;<br>docker exec -it administrator-db-1 psql -U sonar -d postgres -c &quot;CREATE DATABASE sonarqube;&quot;<br><br># 2. Restore the backup<br>gunzip -c /home/administrator/db_backups/sonarqube_2025-09-22_0200.sql.gz | \<br>  docker exec -i administrator-db-1 psql -U sonar -d sonarqube<br><br><br>If backups aren’t automated, they don’t exist.</pre><pre># 1. Stop SonarQube to avoid connection errors<br>docker stop administrator-sonarqube-1<br><br># 2. Remove old db container (if broken)<br>docker rm -f administrator-db-1<br><br># 3. Create a fresh Postgres container<br>docker run -d --name administrator-db-1 \<br>  -e POSTGRES_USER=sonar \<br>  -e POSTGRES_PASSWORD=sonarpasschangeit \<br>  -e POSTGRES_DB=sonarqube \<br>  -v administrator_sonarqube_db_data:/var/lib/postgresql/data \<br>  postgres:13<br><br># 4. Wait a few seconds for DB to initialize<br><br># 5. Restore backup into the fresh DB<br>gunzip -c /home/administrator/db_backups/sonarqube_2025-09-22_0200.sql.gz | \<br>  docker exec -i administrator-db-1 psql -U sonar -d sonarqube<br><br># 6. Start SonarQube again<br>docker start administrator-sonarqube-1</pre><pre># 1. verify the setup by running this command.<br>docker exec -it administrator-db-1 \<br>  psql -U sonar -d sonarqube -c &quot;SELECT count(*) FROM projects;&quot;</pre><ol><li><strong>Volumes &gt; bind mounts.</strong> They make upgrades and recovery painless.</li><li><strong>Always test restores.</strong> A backup you can’t restore is just a pretty file.</li></ol><h3>🎯 Final Thoughts</h3><p>What started as a painful crash turned into a <strong>playbook for resilience.</strong></p><p>The best DevOps setups aren’t the ones that never fail — they’re the ones that <strong>fail gracefully and recover fast</strong>.</p><p>So next time you docker-compose up, ask yourself:<br> 👉 <em>“If this goes down tonight, can I bring it back in minutes?”</em></p><p>Trust me — you don’t want to learn the answer the hard way.</p><p>💡 <em>If this story saved you some future pain, i’m glad i could help.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c42caed9aeb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>