<?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 Ramanamuttana on Medium]]></title>
        <description><![CDATA[Stories by Ramanamuttana on Medium]]></description>
        <link>https://medium.com/@ramanamuttana?source=rss-71fdfec1f7aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*2IKhwIbChB3QLMjP</url>
            <title>Stories by Ramanamuttana on Medium</title>
            <link>https://medium.com/@ramanamuttana?source=rss-71fdfec1f7aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:18:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ramanamuttana/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[Building a Real-Time MQTT Pub/Sub Pipeline with Python and CloudAMQP]]></title>
            <link>https://medium.com/@ramanamuttana/building-a-real-time-mqtt-pub-sub-pipeline-with-python-and-cloudamqp-516fa206806f?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/516fa206806f</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[mqtt]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cloudamqp]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Wed, 30 Sep 2026 07:51:49 GMT</pubDate>
            <atom:updated>2026-09-30T08:35:50.579Z</atom:updated>
            <content:encoded><![CDATA[<p>Every IoT project eventually needs the same thing: a lightweight, reliable way to move messages between devices and code. MQTT has become the de facto standard for this — it’s small, fast, and works equally well for a single sensor publishing readings as it does for a fleet of devices.</p><p>In this walkthrough, we’ll build a minimal but production-shaped MQTT publisher and consumer in Python, using paho-mqtt and a free-tier <strong>CloudAMQP</strong> broker (their managed service exposes both AMQP and MQTT endpoints). Along the way, we&#39;ll hit — and fix — the handful of gotchas that trip up almost everyone doing this for the first time on macOS.</p><h3>Why MQTT</h3><p>MQTT is a publish/subscribe protocol built for constrained networks and devices. Instead of services calling each other directly, publishers send messages to a <strong>topic</strong>, and any number of subscribers listening on that topic receive them. Neither side needs to know the other exists — the broker handles routing.</p><p>This makes it a natural fit for sensor data, telemetry, and lightweight device-to-cloud messaging, where you want producers and consumers to stay decoupled.</p><h3>Tools used</h3><ul><li><strong>Python 3.10</strong></li><li><strong>paho-mqtt</strong> (2.x) — the standard Python MQTT client library</li><li><strong>CloudAMQP</strong> — managed broker offering both AMQP and MQTT endpoints, TLS included</li><li><strong>certifi</strong> — trusted CA bundle, needed to fix a common macOS TLS issue</li></ul><pre>pip install paho-mqtt certifi</pre><pre>python3 -m pip show paho-mqtt</pre><h3>Step 1: Get broker credentials on CloudAMQP</h3><p>Spin up a free CloudAMQP instance and open its dashboard. Under <strong>MQTT details</strong> you’ll find everything you need:</p><blockquote>Note: First create team :for ex:<strong>IOT_temperature</strong> — then click on the create new instance</blockquote><p>1.click on the create instance here it is the topic name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*osuBVXKr9rmFmZCGFFGmIA.png" /><figcaption>Name as ex:temperature_server as instance</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zSFMz-3_QkeTgbiTIG52ug.png" /><figcaption>name ==Topic name</figcaption></figure><p>2. choose plan</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8YwtiEYx9gFOKBODT8Q7qg.png" /></figure><p>3. Check the configure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jcL8wYtMq5z6AERF4bnryA.png" /></figure><p>4. finally we created the instance , now click on the instance we created here for ex: temperature-server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_v3BBf_2oYqzWCYeafX4fg.png" /></figure><p>5. We can see the deatils of the created for the instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WhVMg_hdN8yHOnGvSHiA7w.png" /></figure><p>6. Coding part</p><p>producer.py</p><pre>from paho.mqtt import client as mqtt<br>import ssl, certifi<br>import time<br>import json<br>import random<br><br>clientId = &quot;Youtube-Producer&quot;<br>hostname = &quot;swallow.lmq.cloudamqp.com&quot;<br>port = 8883<br>username = &quot;bunjvgtn:bunjvgtn&quot;<br>password = &quot;JPQTw0oweROKmMdRrpP18GUXoqHyXD0I&quot;<br>topic = &quot;sensors/temperature-server&quot;<br><br>client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, clientId)<br>client.username_pw_set(username, password)<br>client.tls_set(ca_certs=certifi.where())<br>client.connect(hostname, port)<br><br>client.loop_start()<br>time.sleep(1)  # let the connection fully establish<br><br>for i in range(1, 1001):<br>    temperature = round(random.uniform(15.0, 35.0), 2)<br>    payload = json.dumps({<br>        &quot;id&quot;: i,<br>        &quot;value&quot;: temperature,<br>        &quot;unit&quot;: &quot;celsius&quot;<br>    })<br><br>    client.publish(topic, payload)<br>    print(f&quot;[{i}/1000] Published: {payload}&quot;)<br><br>    time.sleep(1)<br><br>print(&quot;Done sending 1000 messages&quot;)<br><br>time.sleep(1)<br>client.loop_stop()<br>client.disconnect()</pre><p>below code is Consumer.py</p><pre>from paho.mqtt import client as mqtt<br>import certifi<br>import json<br>from datetime import datetime<br><br>clientId = &quot;Youtube-Consumer&quot;<br>hostname = &quot;swallow.lmq.cloudamqp.com&quot;<br>port = 8883<br>username = &quot;bunjvgtn:bunjvgtn&quot;<br>password = &quot;JPQTw0oweROKmMdRrpP18GUXoqHyXD0I&quot;<br>topic = &quot;sensors/temperature-server&quot;<br><br>def on_connect(client, userdata, flags, reason_code, properties):<br>    if reason_code == 0:<br>        print(&quot;Connected successfully&quot;)<br>        client.subscribe(topic)<br>        print(f&quot;Subscribed to: {topic}&quot;)<br>        print(&quot;Waiting for messages...\n&quot;)<br>    else:<br>        print(f&quot;Failed to connect, reason code: {reason_code}&quot;)<br><br>def on_message(client, userdata, msg):<br>    timestamp = datetime.now().strftime(&quot;%H:%M:%S&quot;)<br>    payload = msg.payload.decode()<br><br>    print(f&quot;[{timestamp}] Topic: {msg.topic}&quot;)<br>    try:<br>        data = json.loads(payload)<br>        print(f&quot;           Data: {data}&quot;)<br>    except json.JSONDecodeError:<br>        print(f&quot;           Raw: {payload}&quot;)<br>    print(&quot;-&quot; * 40)<br><br>client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, clientId)<br>client.username_pw_set(username, password)<br>client.tls_set(ca_certs=certifi.where())<br><br>client.on_connect = on_connect<br>client.on_message = on_message<br><br>client.connect(hostname, port)<br>print(&quot;Connecting to broker.....&quot;)<br>client.loop_forever()</pre><p>first run the consumer ready to accept the messages then producer</p><p>7. check on the Lavinmq browser</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mMDXiKpF-HYMPcH19vd2gA.png" /></figure><p>we can see the results on consumer console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*r8p-hpS8UYyAQBGgfASDRw.png" /><figcaption>sample data</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=516fa206806f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Remote Desktop Connection vs. Remote Assistance: Key Differences]]></title>
            <link>https://medium.com/@ramanamuttana/remote-desktop-connection-vs-remote-assistance-key-differences-1f8481b1cfbf?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f8481b1cfbf</guid>
            <category><![CDATA[windows-11]]></category>
            <category><![CDATA[remote-assistance]]></category>
            <category><![CDATA[remote-desktop]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Fri, 24 Jul 2026 17:21:21 GMT</pubDate>
            <atom:updated>2026-07-24T17:23:07.229Z</atom:updated>
            <content:encoded><![CDATA[<p>Both let you connect to another Windows computer over a network, but they serve different purposes:</p><h3>Remote Desktop Connection</h3><ul><li><strong>Purpose</strong>: Lets you fully control a remote computer as if you were sitting in front of it.</li><li><strong>Use case</strong>: Accessing your work PC from home, managing a server remotely, using a machine you own or administer.</li><li><strong>Access</strong>: You need valid login credentials (username/password) for the remote machine.</li><li><strong>Session</strong>: Typically takes over the remote session — the local screen may lock or log off while you’re connected (in most consumer Windows editions).</li><li><strong>Invitation needed?</strong>: No. You just need the computer’s address/name and credentials, plus permission enabled on the remote PC.</li><li><strong>Who initiates</strong>: The person connecting (the “client”) initiates the connection whenever they want.</li></ul><h3>Remote Assistance</h3><ul><li><strong>Purpose</strong>: Lets someone else <em>view or control your</em> computer temporarily to help you troubleshoot a problem — it’s a support tool, not a general access tool.</li><li><strong>Use case</strong>: A tech-savvy friend, family member, or IT help desk helping you fix an issue on your own PC.</li><li><strong>Access</strong>: Requires an explicit invitation sent by the person needing help (via file, email, or Easy Connect code).</li><li><strong>Session</strong>: You (the person being helped) stay logged in and can watch everything happening; you can revoke control at any time.</li><li><strong>Invitation needed?</strong>: Yes — nothing happens without you sending an invite and approving the connection.</li><li><strong>Who initiates</strong>: The person needing help initiates by sending the invitation; the helper can only join after that.</li></ul><h3>Quick summary table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jMURtpFj1vEty8wwjOdBqw.png" /></figure><p><strong>In short</strong>: Remote Desktop is for <em>accessing</em> a machine (usually your own or one you administer), while Remote Assistance is for <em>getting help</em> on your own machine from someone else, with you staying in control of the invitation and session.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f8481b1cfbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keycloak installation in windows]]></title>
            <link>https://medium.com/@ramanamuttana/keycloak-installation-in-windows-b08aee4f9c67?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/b08aee4f9c67</guid>
            <category><![CDATA[keycloak]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Tue, 09 Jun 2026 17:06:40 GMT</pubDate>
            <atom:updated>2026-06-09T17:06:40.808Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting Started with Keycloak (Quick Guide)</h3><p>Keycloak is an open-source Identity and Access Management (IAM) solution that supports authentication, authorization, and identity federation.</p><p>To get started, first ensure your system has <strong>OpenJDK installed (recommended version 25)</strong> and sufficient CPU/memory resources for running Keycloak.</p><h4>1. Download and Setup</h4><p>Download the Keycloak distribution (e.g., keycloak-26.6.3.zip) from the official site and extract it.<br> Navigate to the extracted folder.</p><h4>2. Start Keycloak (Development Mode)</h4><p>Run the following command:</p><ul><li>Linux:<br> bin/kc.sh start-dev</li><li>Windows:<br> bin\kc.bat start-dev</li></ul><p>This starts Keycloak in <strong>development mode</strong>, which is suitable for testing and learning.</p><h4>3. Create Admin User</h4><p>Keycloak does not come with a default admin user.<br> After starting the server, open http://localhost:8080/ and create an admin account.</p><h4>4. Access Admin Console</h4><p>Log in to the Admin Console using the admin credentials you just created.</p><h4>5. Create a Realm</h4><p>A <strong>realm</strong> represents an isolated environment (like a tenant).</p><ul><li>Navigate to <em>Manage realms</em></li><li>Click <em>Create realm</em></li><li>Name it (e.g., myrealm)</li></ul><h4>6. Create a User</h4><p>Inside the new realm:</p><ul><li>Go to <em>Users → Create new user</em></li><li>Set username and basic details</li><li>Assign a password under <em>Credentials</em></li><li>Disable “Temporary” if you don’t want forced password reset</li></ul><h4>7. Create a Client (Application)</h4><p>To secure an application:</p><ul><li>Go to <em>Clients → Create client</em></li><li>Choose <strong>OpenID Connect</strong></li><li>Set Client ID (e.g., myclient)</li><li>Enable Standard Flow</li><li>Configure:</li><li>Redirect URI</li><li>Web origins</li></ul><h4>8. Test Login</h4><p>Use the Keycloak demo application or your own app to test authentication using the configured client.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b08aee4f9c67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Detective Principle: Finding the Most Restrictive Criteria in SQL Queries]]></title>
            <link>https://medium.com/@ramanamuttana/the-detective-principle-finding-the-most-restrictive-criteria-in-sql-queries-17ae5b5029ca?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/17ae5b5029ca</guid>
            <category><![CDATA[restrictive-criteria]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[query-optimization]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Tue, 24 Mar 2026 20:43:19 GMT</pubDate>
            <atom:updated>2026-03-24T20:43:19.777Z</atom:updated>
            <content:encoded><![CDATA[<p>There is a scene in almost every detective story where the investigator surveys a crowded room and immediately focuses on one person. Not the loudest, not the most suspicious-looking — the one who, by some quiet logic, doesn’t belong. A good query optimizer works exactly the same way. Before touching a single row, it asks: which condition eliminates the most suspects?</p><p>This is the principle behind what database engineers call the Most Restrictive Criteria — and understanding it is the difference between a query that finishes in 12 milliseconds and one that makes your DBA cry at 2 a.m.</p><h3>The Trap That Looks Like Common Sense</h3><p>Imagine you receive this query to tune:</p><pre>SELECT *<br>FROM   orders<br>WHERE  status       = &#39;active&#39;<br>  AND  country      = &#39;DE&#39;<br>  AND  referral_code = &#39;XK9-2024&#39;;</pre><p>Your first instinct might be to index status — it&#39;s a clean, short column, clearly used for filtering, and it appears first in the WHERE clause. This instinct is wrong, and the wrongness is invisible until you look at the data.</p><p><em>The most restrictive criterion cannot be identified by reading SQL. It lives in the data, not in the query.</em></p><p>The column that appears first in your WHERE clause, or that feels most “natural” to filter on, is irrelevant. What matters is how many rows survive each condition. To find that out, you have to go to the table itself.</p><h3>Step One: Query the Tables, Not Your Intuition</h3><p>The process begins with two diagnostic queries that every optimizer — human or machine — must run before making index decisions. First, count distinct values per column:</p><pre>-- How many unique values does each filter column have?<br>SELECT COUNT(DISTINCT status)        AS status_card,<br>       COUNT(DISTINCT country)       AS country_card,<br>       COUNT(DISTINCT referral_code)  AS referral_card,<br>       COUNT(*)                        AS total_rows<br>FROM   orders;</pre><p>Suppose this returns: status_card = 3, country_card = 87, referral_card = 31,420, total_rows = 10,000,000. Already, referral_code looks more promising — 31,420 distinct values across 10 million rows suggests high specificity. But cardinality alone doesn&#39;t tell the whole story. You also need to know how those values are <em>distributed</em>.</p><pre>-- What does the distribution of each column look like?<br>SELECT status, COUNT(*) AS freq,<br>       ROUND(COUNT(*) * 100.0 / SUM(COUNT(*)) OVER(), 2) AS pct<br>FROM   orders<br>GROUP BY status<br>ORDER BY freq ASC;</pre><pre>Result - orders.status distribution<br>  status       freq      %of table    selectivity<br>&#39;cancelled&#39; 82,000     0.82%.         0.0082   ✓ good<br>&#39;pending&#39;   418,000    4.18%          0.0418<br>&#39;active&#39;.   9,500,000  95.0%          0.95     ✗ poor</pre><p>he picture snaps into focus. status = &#39;active&#39; matches 95% of all rows. Filtering on it first is barely better than a full table scan. Now run the same analysis for referral_code:</p><pre>SELECT<br>  COUNT(*) AS matching_rows,<br>  (SELECT COUNT(*) FROM orders) AS total_rows,<br>  ROUND(<br>    COUNT(*) * 1.0 / (SELECT COUNT(*) FROM orders),<br>  6) AS selectivity<br>FROM orders<br>WHERE referral_code = &#39;XK9-2024&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AzAvJ6tk2jq-vfrBb3HVTQ.png" /></figure><h3>Understanding Selectivity: The Core Metric</h3><pre>Selectivity  =  matching_rows / total_rows<br><br>Range:  0.0  →  perfect filter (one row matches)<br>        1.0  →  no filter at all (every row matches)<br><br>Rule:   Lower selectivity = more restrictive = more valuable as a leading criterion</pre><p>Visualized across our three criteria, the difference is stark:</p><p>status = ‘active’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*MO1OE6FQvUF9oZLR83aT-w.png" /><figcaption>status</figcaption></figure><p>country = ‘DE’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*CLqAjMO91mCd3uEMfyHQhA.png" /><figcaption>country</figcaption></figure><p>referral_code = ‘XK9-…’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*sgWliDXuFNSQjcHLCWROmw.png" /><figcaption>referral code</figcaption></figure><p>Applying referral_code first reduces 10 million rows to 318 in a single step. Every subsequent filter — and every subsequent join — operates on just those 318 rows. The computational savings compound across the entire query plan.</p><h3>Why Distribution Matters More Than Cardinality</h3><p>A column with high cardinality (many distinct values) is <em>often</em> highly selective — but not always. This is the subtler trap that catches experienced engineers.</p><p>Consider an event_type column with 500 distinct event types. High cardinality, right? But if your specific query filters on event_type = &#39;page_view&#39;, and 80% of all events are page views, the selectivity for <em>that value</em> is 0.80 — nearly useless. A column with only 10 distinct values but a highly skewed distribution might offer a selectivity of 0.001 for one of its rare values.</p><p>Key Insight</p><p>Cardinality is a property of the <em>column</em>. Selectivity is a property of the <em>specific value</em> you are filtering on. Always measure at the value level, not the column level.</p><p>This is precisely why query optimizers maintain not just cardinality statistics but histograms — frequency distributions that allow them to estimate how many rows match a specific value, not just “how many distinct values exist.” When statistics are stale, even the most sophisticated optimizer will make poor choices — because it is working from an outdated picture of the data.</p><p>· · ·</p><h3>When Optimizers Get It Wrong</h3><p>Most modern databases — PostgreSQL, Oracle, SQL Server, MySQL — have cost-based optimizers that perform this analysis automatically, using the catalog statistics they maintain. In many cases, they choose the right access path without any help from you.</p><p>But there are three scenarios where you must do this analysis yourself:</p><h3>1. Stale statistics</h3><p>Statistics are not updated continuously. If a table has grown significantly since the last ANALYZE run, the optimizer may believe a column has the distribution of six months ago. A partition that held 1 million rows last quarter might hold 50 million today. Always check when statistics were last updated for tables you&#39;re tuning:</p><p>PostgreSQL — check statistics age</p><pre>SELECT schemaname, tablename, last_analyze, last_autoanalyze,<br>       n_live_tup, n_mod_since_analyze<br>FROM   pg_stat_user_tables<br>WHERE  tablename = &#39;orders&#39;;</pre><h3>2. Correlated columns</h3><p>Optimizers typically assume column independence — that filters on city and country are unrelated. In reality, if you filter country = &#39;DE&#39; and city = &#39;München&#39;, the combined selectivity is far higher than the product of the two individual selectivities, because München almost exclusively appears under DE. The optimizer&#39;s estimate will be pessimistic. Extended statistics (available in PostgreSQL 10+ and Oracle) can partially address this, but manual analysis remains valuable.</p><h3>3. Manual query construction and join ordering</h3><p>When constructing complex multi-table queries, join order matters enormously. The table that produces the smallest intermediate result set should generally drive the join. Identifying which table’s WHERE conditions are most restrictive — through exactly the analysis described above — tells you which table should be accessed first.</p><p>· · ·</p><h3>The Practical Checklist</h3><p>Before placing an index or finalizing a query plan, run through these steps for every significant WHERE clause you encounter:</p><p>Diagnostic template — copy and adapt</p><pre>Diagnostic template — copy and adapt<br>-- 1. Cardinality of each filter column<br>SELECT<br>  COUNT(DISTINCT col_a) AS card_a,<br>  COUNT(DISTINCT col_b) AS card_b,<br>  COUNT(DISTINCT col_c) AS card_c,<br>  COUNT(*)             AS total<br>FROM your_table;<br><br>-- 2. Frequency distribution of the specific values you filter on<br>SELECT col_a, COUNT(*),<br>       ROUND(COUNT(*) * 100.0 / SUM(COUNT(*)) OVER(), 3) AS pct<br>FROM your_table GROUP BY col_a ORDER BY 2;<br><br>-- 3. Exact selectivity for each specific filter value<br>SELECT COUNT(*) * 1.0 / (SELECT COUNT(*) FROM your_table)<br>FROM your_table WHERE col_c = &#39;your_value&#39;;<br><br>-- 4. Rank all criteria: lowest selectivity = most restrictive</pre><p>· · ·</p><h3>The Payoff</h3><p>Returning to our original query: once we know that referral_code = &#39;XK9-2024&#39; has a selectivity of 0.000032, the index decision and query plan become obvious. An index on referral_code — used as the leading condition — reduces the working set from 10 million rows to 318 before any other filter is applied. The two remaining conditions (status and country) then run as cheap residual checks on those 318 rows.</p><p>The query that once scanned 10 million rows now touches fewer than 320. The execution time drops not by a percentage, but by orders of magnitude.</p><p><em>The most powerful optimization is usually the one you almost didn’t look for — hidden in a column that seemed unremarkable until you measured it.</em></p><p>The detective, in the end, doesn’t solve the case by looking harder at obvious suspects. They solve it by asking who, among everyone in the room, uniquely couldn’t have been somewhere else. The most restrictive criterion works the same way: not the filter that seems most important, but the one that leaves the fewest rows standing.</p><p>Measure before you optimize. The data will always know more than the SQL.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17ae5b5029ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Running Containers as Root Is a Security Nightmare]]></title>
            <link>https://medium.com/@ramanamuttana/why-running-containers-as-root-is-a-security-nightmare-26e483ebd50c?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/26e483ebd50c</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-security]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[containerization]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Wed, 04 Feb 2026 17:52:20 GMT</pubDate>
            <atom:updated>2026-02-04T17:52:20.246Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uA1N9cc6PNkuMgiXFdbVLw.png" /></figure><p>Running containers as root is one of the most significant security concerns in containerization. Let me break down why this matters and what it means in practice.</p><h3>The Default Behavior Problem</h3><p>By default, most container images run processes as <strong>root (UID 0)</strong> inside the container. This seems counterintuitive given that containers are supposed to provide isolation, but it’s the historical default for several reasons:</p><ul><li><strong>Ease of use</strong>: Root can do anything without permission errors</li><li><strong>Legacy compatibility</strong>: Traditional applications often expect root privileges</li><li><strong>Simplicity</strong>: Developers don’t have to think about file permissions during development</li></ul><h3>Why This Is Problematic</h3><h3>1. Root Inside = Root Outside (Kind Of)</h3><p>While containers use namespaces to provide isolation, the root user inside a container <strong>maps to the root user on the host</strong> by default (without user namespaces enabled). This means:</p><pre>Container root (UID 0) → Host root (UID 0)</pre><p>If an attacker escapes the container, they’re already running as root on the host system.</p><h3>2. Kernel Vulnerabilities</h3><p>The container shares the <strong>same kernel</strong> with the host. Root users have more capabilities to:</p><ul><li>Exploit kernel vulnerabilities</li><li>Load kernel modules (if given the capability)</li><li>Access raw devices</li><li>Manipulate system calls</li></ul><h3>3. Breakout Scenarios</h3><p>Running as root makes container breakouts easier through:</p><p><strong>Misconfigured volumes</strong>: If you mount a host directory with write access, root in the container can modify critical host files:</p><pre>docker run -v /etc:/host-etc myimage<br># Now root inside can: echo &quot;malicious&quot; &gt; /host-etc/passwd</pre><p><strong>Privileged containers</strong>: Combined with --privileged flag, root has nearly full host access:</p><pre>docker run --privileged -it ubuntu<br># Inside container, root can now access all devices, mount filesystems, etc.</pre><p><strong>Capability exploitation</strong>: Even without --privileged, certain capabilities can be abused:</p><ul><li>CAP_SYS_ADMIN: Mount filesystems, manipulate namespaces</li><li>CAP_SYS_MODULE: Load kernel modules</li><li>CAP_DAC_OVERRIDE: Bypass file permission checks</li></ul><h3>4. Shared Resources Abuse</h3><p>Root processes can more easily:</p><ul><li>Consume excessive CPU/memory (DoS)</li><li>Manipulate cgroups (if misconfigured)</li><li>Interfere with other containers on the same host</li></ul><h3>Real-World Attack Vectors</h3><p><strong>Example 1: Docker Socket Mounting</strong></p><pre>docker run -v /var/run/docker.sock:/var/run/docker.sock myimage</pre><p>Root inside this container can now control the Docker daemon and launch privileged containers, effectively owning the host.</p><p><strong>Example 2: Sysfs/Procfs Access</strong> Even in “isolated” containers, root can read sensitive information:</p><pre>cat /proc/sys/kernel/core_pattern  # Might reveal host paths<br>cat /sys/class/net/eth0/address    # MAC address, network info</pre><p><strong>Example 3: Device Access</strong> With certain misconfigurations, root can access block devices:</p><pre>ls -la /dev/sda  # Host disk<br># With write access, could modify host filesystem</pre><h3>Breaking the Isolation</h3><p>Running the container as root effectively “breaks” the isolation. Here’s how:</p><h3>Without Additional Protections:</h3><ol><li><strong>AppArmor/SELinux disabled</strong>: Root has fewer restrictions</li><li><strong>Seccomp disabled</strong>: Root can make dangerous syscalls</li><li><strong>Capabilities not dropped</strong>: Root retains powerful Linux capabilities</li><li><strong>User namespaces not used</strong>: Container root = host root</li></ol><h3>The Sidecar Container Dilemma</h3><p>Sometimes you <em>deliberately</em> need elevated privileges, such as:</p><ul><li><strong>Network proxies</strong> (Istio, Linkerd) that need CAP_NET_ADMIN</li><li><strong>Log shippers</strong> that need to read other containers’ logs</li><li><strong>Monitoring agents</strong> that need host metrics</li></ul><p>This creates a security vs. functionality trade-off.</p><h3>Mitigation Strategies</h3><h3>1. Run as Non-Root User</h3><pre>FROM ubuntu<br>RUN useradd -m -u 1000 appuser<br>USER appuser<br>CMD [&quot;myapp&quot;]</pre><h3>2. Use User Namespaces</h3><p>Maps container UID 0 to non-privileged host UID:</p><pre>dockerd --userns-remap=default</pre><h3><strong>3. Drop Capabilities</strong></h3><pre>docker run --cap-drop=ALL --cap-add=NET_BIND_SERVICE myimage</pre><h3>4. <strong>Read-Only Root Filesystem</strong></h3><pre>docker run --read-only myimage</pre><h3>5. Security Profiles</h3><p>Enable AppArmor/SELinux and custom seccomp profiles to restrict what root can do.</p><h3>The Bottom Line</h3><p>Running as root is “insecure-by-default” because:</p><ul><li>It assumes containers are fully trusted</li><li>It provides maximum compatibility at the expense of security</li><li>Combined with misconfigurations, it can completely negate container isolation</li><li>The blast radius of a compromise is much larger</li></ul><p>The container isolation provides defense-in-depth, but it’s not foolproof. Running as root means you’re relying entirely on namespace isolation, cgroups, and capability restrictions — all of which can be bypassed through kernel vulnerabilities or misconfigurations. Defense-in-depth requires running as non-root users as one critical layer of protection.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26e483ebd50c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jenkins Interview questions]]></title>
            <link>https://medium.com/@ramanamuttana/jenkins-interview-questions-22f7ef0327f9?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/22f7ef0327f9</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Sun, 01 Feb 2026 13:46:52 GMT</pubDate>
            <atom:updated>2026-02-01T13:46:52.525Z</atom:updated>
            <content:encoded><![CDATA[<p>Here are the 100 Jenkins interview questions with answers, organized by difficulty level and topic.</p><h3>BASIC LEVEL (1–25)</h3><ol><li><strong>What is Jenkins?</strong></li></ol><p>Jenkins is an open-source automation server written in Java that helps automate parts of the software development process including building, testing, and deploying applications. It supports continuous integration and continuous delivery (CI/CD).</p><p><strong>2. What are the key features of Jenkins?</strong></p><ul><li>Easy installation and configuration</li><li>Hundreds of plugins available</li><li>Distributed builds support</li><li>Easy upgrades</li><li>Support for various version control systems</li><li>Extensive community support</li><li>Platform independent (runs on any OS with Java)</li></ul><p><strong>3. What is Continuous Integration (CI)?</strong></p><p>CI is a development practice where developers integrate code into a shared repository frequently. Each integration is verified by automated builds and tests to detect integration errors quickly.</p><p><strong>4. What is Continuous Deployment (CD)?</strong></p><p>CD is the practice of automatically deploying every change that passes automated tests to production environments.</p><p><strong>5. What are Jenkins Jobs?</strong></p><p>A Jenkins job is a runnable task that Jenkins can execute. It can be a build job, test job, deployment job, or any automated task.</p><p><strong>6. What is a Jenkins Pipeline?</strong></p><p>A Jenkins Pipeline is a suite of plugins that supports implementing and integrating continuous delivery pipelines into Jenkins. It’s defined in a Jenkinsfile using either Declarative or Scripted syntax.</p><p><strong>7. What is a Jenkinsfile?</strong></p><p>A Jenkinsfile is a text file that contains the definition of a Jenkins Pipeline and is checked into source control.</p><p><strong>8. What are the types of Jenkins Pipelines?</strong></p><ul><li>Declarative Pipeline: More structured, easier to read and write</li><li>Scripted Pipeline: More flexible, uses Groovy syntax</li></ul><p><strong>9. What is Jenkins Master?</strong></p><p>The Jenkins Master is the main server that manages job scheduling, dispatching builds to slaves/agents, monitoring slaves, and recording build results.</p><p><strong>10. What is Jenkins Agent/Slave?</strong></p><p>A Jenkins agent (formerly called slave) is a machine that connects to the Jenkins master and executes tasks when directed by the master.</p><p><strong>11. What is a Jenkins Plugin?</strong></p><p>A plugin extends Jenkins functionality. There are plugins for source code management, build tools, testing frameworks, deployment, notifications, and more.</p><p><strong>12. How do you install a Jenkins plugin?</strong></p><p>Navigate to Manage Jenkins → Manage Plugins → Available tab → search for the plugin → select and click “Install without restart” or “Download now and install after restart”.</p><p><strong>13. What is Jenkins Workspace?</strong></p><p>A workspace is a directory on the agent where Jenkins executes builds. Each job has its own workspace.</p><p><strong>14. What is a Build Trigger in Jenkins?</strong></p><p>Build triggers determine when a Jenkins job should be executed (e.g., SCM polling, webhook, scheduled builds, manual trigger).</p><p><strong>15. What is SCM in Jenkins?</strong></p><p>SCM (Source Code Management) refers to version control systems like Git, SVN, Mercurial that Jenkins can integrate with to pull source code.</p><p><strong>16. What is a Freestyle Project in Jenkins?</strong></p><p>A Freestyle project is a traditional Jenkins job type where you configure build steps through the UI without writing code.</p><p><strong>17. What port does Jenkins run on by default?</strong></p><p>Jenkins runs on port 8080 by default.</p><p><strong>18. How do you change the default Jenkins port?</strong></p><p>Edit the Jenkins configuration file (varies by OS) or start Jenkins with java -jar jenkins.war --httpPort=9090.</p><p><strong>19. What is Jenkins Home Directory?</strong></p><p>The Jenkins home directory stores all Jenkins data including job configurations, build logs, plugins, and workspace. Default location is ~/.jenkins on Linux.</p><p><strong>20. What is Blue Ocean in Jenkins?</strong></p><p>Blue Ocean is a modern, user-friendly UI for Jenkins Pipeline that provides better visualization and easier pipeline creation.</p><p><strong>21. What is the difference between Maven and Jenkins?</strong></p><p>Maven is a build automation tool primarily for Java projects. Jenkins is a CI/CD automation server that can use Maven (or other build tools) to build projects.</p><p><strong>22. What is the role of the Jenkinsfile in a Pipeline?</strong></p><p>The Jenkinsfile defines the entire build pipeline as code, making it version-controlled and allowing teams to review and iterate on the delivery pipeline.</p><p><strong>23. How do you secure Jenkins?</strong></p><ul><li>Enable security and authentication</li><li>Use role-based access control (RBAC)</li><li>Configure authorization strategies</li><li>Use HTTPS</li><li>Keep Jenkins and plugins updated</li><li>Use credentials plugin for secrets</li></ul><p><strong>24. What is Jenkins CLI?</strong></p><p>Jenkins CLI (Command Line Interface) allows you to access Jenkins from a script or terminal, enabling automation of administrative tasks.</p><p><strong>25. What is the difference between Agent and Node?</strong></p><p>Node is a machine that is part of the Jenkins environment. Agent is a Java program that runs on a node and executes tasks sent by the master.</p><h3>INTERMEDIATE LEVEL (26–60)</h3><p><strong>26. Explain the Jenkins Pipeline syntax.</strong> Declarative syntax:</p><pre>pipeline {<br>    agent any<br>    stages {<br>        stage(&#39;Build&#39;) {<br>            steps {<br>                // build steps<br>            }<br>        }<br>    }<br>}</pre><p><strong>27. What is a Multibranch Pipeline?</strong></p><p>A Multibranch Pipeline automatically creates a pipeline for each branch in your repository that contains a Jenkinsfile.</p><p><strong>28. What is Jenkins Shared Library?</strong></p><p>A Shared Library is a collection of reusable Groovy scripts that can be shared across multiple pipelines to avoid code duplication.</p><p><strong>29. How do you parameterize a Jenkins job?</strong></p><p>Check “This project is parameterized” and add parameters (String, Boolean, Choice, File, etc.) that can be passed at runtime.</p><p><strong>30. What are Build Parameters?</strong></p><p>Build parameters allow users to pass input values when triggering a build (e.g., branch name, environment, version).</p><p><strong>31. What is Webhook in Jenkins?</strong></p><p>A webhook is an HTTP callback that triggers a Jenkins build automatically when specific events occur in the SCM (like a code push).</p><p><strong>32. What is Poll SCM?</strong></p><p>Poll SCM is a build trigger that periodically checks the repository for changes and triggers a build if changes are detected.</p><p><strong>33. What is the difference between Poll SCM and Webhook?</strong></p><p>Poll SCM checks periodically (less efficient), while webhooks trigger immediately when changes occur (more efficient and real-time).</p><p><strong>34. What is Jenkins DSL?</strong></p><p>Job DSL (Domain Specific Language) is a plugin that allows you to define Jenkins jobs programmatically using Groovy scripts.</p><p><strong>35. What is the purpose of the </strong><strong>post section in a Pipeline?</strong></p><p>The post section defines actions to run after the pipeline or stage completes, regardless of success or failure (always, success, failure, etc.).</p><p><strong>36. What is Jenkins Environment Variable?</strong></p><p>Environment variables store data that can be accessed throughout the build process. Jenkins provides built-in variables like BUILD_NUMBER, JOB_NAME, etc.</p><p><strong>37. How do you access environment variables in a Pipeline?</strong></p><p>Use env.VARIABLE_NAME or ${env.VARIABLE_NAME} in Declarative Pipeline, or env.VARIABLE_NAME in Scripted Pipeline.</p><p><strong>38. What is Jenkins Credentials Plugin?</strong></p><p>The Credentials Plugin provides a standardized way to store and use sensitive information like passwords, API tokens, SSH keys in Jenkins.</p><p><strong>39. What types of credentials can Jenkins store?</strong></p><ul><li>Username with password</li><li>Secret text</li><li>Secret file</li><li>SSH Username with private key</li><li>Certificates</li><li>Docker credentials</li></ul><p><strong>40. What is the </strong><strong>agent directive in Jenkins Pipeline?</strong></p><p>The agent directive specifies where the pipeline or stage should execute (any, none, label, docker, etc.).</p><p><strong>41. What is the difference between </strong><strong>agent any and </strong><strong>agent none?</strong></p><p>agent any executes on any available agent. agent none means no global agent; each stage must define its own agent.</p><p><strong>42. What is Jenkins Build History?</strong></p><p>Build History shows all previous builds of a job with their status, duration, and build number.</p><p><strong>43. What is the Blue Ocean Pipeline Editor?</strong></p><p>A visual pipeline editor in Blue Ocean that allows creating pipelines through a graphical interface instead of writing code.</p><p><strong>44. What is Jenkins Archive Artifacts?</strong></p><p>Archiving artifacts saves build outputs (JARs, WARs, reports) so they can be retrieved later even after workspace cleanup.</p><p><strong>45. How do you trigger one job from another in Jenkins?</strong></p><p>Use the “Build other projects” post-build action in Freestyle jobs or the build step in Pipeline jobs.</p><p><strong>46. What is Upstream and Downstream projects?</strong></p><p>Upstream projects trigger downstream projects. If Job A triggers Job B, A is upstream and B is downstream.</p><p><strong>47. What is Jenkins Distributed Build?</strong></p><p>Distributed builds distribute job execution across multiple machines (agents) to improve performance and handle different environments.</p><p><strong>48. What is a Jenkins Label?</strong></p><p>A label is a tag assigned to agents that allows jobs to run on specific agents matching certain criteria.</p><p><strong>49. How do you configure a Jenkins Agent?</strong></p><p>Manage Jenkins → Manage Nodes and Clouds → New Node → Configure (name, remote root directory, labels, launch method).</p><p><strong>50. What are different ways to launch a Jenkins Agent?</strong></p><ul><li>Launch agent via SSH</li><li>Launch agent via Java Web Start</li><li>Launch agent via execution of command on master</li><li>Let Jenkins control this Windows agent as a service</li></ul><p><strong>51. What is Jenkins Master-Slave architecture?</strong></p><p>Jenkins uses a master-slave architecture where the master schedules jobs, monitors agents, and records results, while agents execute the actual build tasks.</p><p><strong>52. What is the purpose of the </strong><strong>when directive?</strong></p><p>The when directive allows conditional execution of stages based on specific conditions (branch, environment, expression, etc.).</p><p><strong>53. What is Jenkins Pipeline Syntax Generator?</strong></p><p>A tool in Jenkins that helps generate Pipeline code snippets for various steps and plugins.</p><p><strong>54. What is the difference between Scripted and Declarative Pipeline?</strong> Declarative is more structured, easier to read, and has built-in validation. Scripted offers more flexibility and uses full Groovy capabilities.</p><p><strong>55. What is Jenkins Global Tool Configuration?</strong></p><p>Global Tool Configuration allows you to configure tools (JDK, Maven, Gradle, Git, etc.) that can be used across all jobs.</p><p><strong>56. What is the </strong><strong>input step in Jenkins Pipeline?</strong></p><p>The input step pauses the pipeline and waits for user approval or input before continuing.</p><p><strong>57. What is Jenkins Build Queue?</strong></p><p>The Build Queue shows jobs waiting to be executed when no suitable agent is available or executors are busy.</p><p><strong>58. What is an Executor in Jenkins?</strong></p><p>An executor is a slot for executing jobs on an agent. Each agent can have multiple executors to run jobs in parallel.</p><p><strong>59. What is Jenkins Throttle Concurrent Builds?</strong></p><p>Throttle Concurrent Builds plugin limits the number of concurrent executions of a job to prevent resource overload.</p><p><strong>60. What is Jenkins Lockable Resources?</strong></p><p>Lockable Resources plugin allows jobs to lock shared resources (databases, test environments) to prevent concurrent access conflicts.</p><h3>ADVANCED LEVEL (61–100)</h3><p><strong>61. How do you implement parallel execution in Jenkins Pipeline?</strong></p><pre>parallel {<br>    stage(&#39;Test A&#39;) {<br>        steps { sh &#39;run test A&#39; }<br>    }<br>    stage(&#39;Test B&#39;) {<br>        steps { sh &#39;run test B&#39; }<br>    }<br>}</pre><p><strong>62. What is Jenkins Configuration as Code (JCasC)?</strong></p><p>JCasC plugin allows defining Jenkins configuration in YAML files, enabling version control and automated setup of Jenkins instances.</p><p><strong>63. How do you implement retry logic in Jenkins Pipeline?</strong></p><pre>retry(3) {<br>    sh &#39;command that might fail&#39;<br>}</pre><p><strong>64. What is the </strong><strong>stash and </strong><strong>unstash step?</strong></p><p>stash saves files from one stage to be used in another stage (potentially on different agents). unstash retrieves them.</p><p><strong>65. What is Jenkins Pipeline Unit Testing?</strong></p><p>Pipeline Unit is a testing framework for validating Jenkins Pipeline code before running it on Jenkins.</p><p><strong>66. How do you handle secrets in Jenkins Pipeline?</strong></p><p>Use the Credentials Plugin with the withCredentials block:</p><pre>withCredentials([string(credentialsId: &#39;my-secret&#39;, variable: &#39;SECRET&#39;)]) {<br>    sh &quot;echo $SECRET&quot;<br>}</pre><p><strong>67. What is Jenkins Matrix Project?</strong></p><p>Matrix projects allow running the same build with different configurations (multiple OS, Java versions, etc.) in parallel.</p><p><strong>68. What is the difference between </strong><strong>sh and </strong><strong>bat steps?</strong></p><p>sh executes shell commands on Unix/Linux systems. bat executes batch commands on Windows systems.</p><p><strong>69. What is Jenkins Docker Pipeline?</strong></p><p>Docker Pipeline plugin allows using Docker containers as build agents or running steps inside Docker containers.</p><p><strong>70. How do you use Docker in Jenkins Pipeline?</strong></p><pre>agent {<br>    docker {<br>        image &#39;maven:3.8.1-jdk-11&#39;<br>    }<br>}</pre><p><strong>71. What is Jenkins Kubernetes Plugin?</strong></p><p>The Kubernetes Plugin allows Jenkins to dynamically provision agents as Kubernetes pods that are destroyed after builds complete.</p><p><strong>72. What is the purpose of </strong><strong>cleanWs() step?</strong></p><p>cleanWs() cleans the workspace directory to ensure a clean build environment.</p><p><strong>73. How do you implement timeout in Jenkins Pipeline?</strong></p><pre>timeout(time: 30, unit: &#39;MINUTES&#39;) {<br>    // pipeline steps<br>}</pre><p><strong>74. What is Jenkins Role-Based Access Control?</strong></p><p>Role-Based Access Control (RBAC) plugin allows defining roles with specific permissions and assigning users to roles.</p><p><strong>75. What is Jenkins Audit Trail?</strong></p><p>Audit Trail plugin logs all user actions in Jenkins for compliance and security auditing.</p><p><strong>76. How do you backup Jenkins?</strong></p><ul><li>Backup JENKINS_HOME directory</li><li>Use ThinBackup plugin</li><li>Use Backup plugin</li><li>Version control job configurations</li></ul><p><strong>77. What is Jenkins Pipeline Milestone?</strong></p><p>Milestones ensure that older builds don’t override newer builds, especially useful with concurrent builds.</p><p><strong>78. How do you implement Blue-Green deployment in Jenkins?</strong></p><p>Use Pipeline with stages for deploying to green environment, testing, switching traffic, and keeping blue as rollback.</p><p><strong>79. What is Jenkins Build Discarder?</strong></p><p>Build Discarder automatically deletes old builds based on criteria (number of builds, days) to save disk space.</p><p><strong>80. What is the </strong><strong>checkout scm step?</strong></p><p>checkout scm checks out source code from the SCM configured for the Multibranch or Pipeline job.</p><p><strong>81. How do you integrate Jenkins with Git?</strong></p><p>Install Git plugin, configure Git in Global Tool Configuration, and use Git in job SCM settings or checkout scm in Pipeline.</p><p><strong>82. What is Jenkins GitHub Integration?</strong></p><p>GitHub plugins enable features like automatic webhook creation, PR status updates, GitHub authentication, and triggering builds on GitHub events.</p><p><strong>83. What is Jenkins SonarQube Integration?</strong></p><p>SonarQube plugin integrates code quality analysis into Jenkins builds, displaying quality gate results.</p><p><strong>84. How do you send email notifications from Jenkins?</strong></p><p>Configure SMTP in System Configuration and use Email Extension plugin for customizable email notifications in jobs.</p><p><strong>85. What is Jenkins Slack Integration?</strong></p><p>Slack Notification plugin sends build status notifications to Slack channels.</p><p><strong>86. What is the </strong><strong>script block in Declarative Pipeline?</strong></p><p>The script block allows using Scripted Pipeline syntax within a Declarative Pipeline for complex logic.</p><p><strong>87. How do you handle build failures in Pipeline?</strong></p><pre>try {<br>    // build steps<br>} catch (Exception e) {<br>    // handle failure<br>    throw e<br>}</pre><p><strong>88. What is Jenkins Groovy Sandbox?</strong></p><p>Groovy Sandbox restricts Pipeline script execution for security, limiting access to Jenkins internals.</p><p><strong>89. What are Pipeline Libraries and how do you use them?</strong></p><p>Pipeline Libraries are reusable code repositories. Configure in System Configuration and use @Library(&#39;my-library&#39;) _ in Jenkinsfile.</p><p><strong>90. What is Jenkins Build Promotion?</strong></p><p>Build promotion moves successful builds through different stages (dev, staging, prod) using manual or automated approval.</p><p><strong>91. How do you implement manual approval in Pipeline?</strong></p><pre>input message: &#39;Deploy to production?&#39;, ok: &#39;Deploy&#39;</pre><p><strong>92. What is Jenkins Declarative Pipeline </strong><strong>options directive?</strong></p><p>Options configure pipeline-wide settings like timeout, timestamps, buildDiscarder, retry, etc.</p><p><strong>93. How do you use credentials in Jenkinsfile without exposing them?</strong></p><pre>withCredentials([usernamePassword(credentialsId: &#39;cred-id&#39;, usernameVariable: &#39;USER&#39;, passwordVariable: &#39;PASS&#39;)]) {<br>    // use $USER and $PASS<br>}</pre><p><strong>94. What is Jenkins Pipeline Global Variable?</strong></p><p>Global variables (like env, currentBuild, params) are available throughout the pipeline without declaration.</p><p><strong>95. How do you implement canary deployment in Jenkins?</strong></p><p>Use Pipeline to deploy to a small subset of servers, run tests, gradually increase traffic, and rollback if issues detected.</p><p><strong>96. What is Jenkins Build Wrapper?</strong></p><p>Build wrappers provide pre and post-build actions like setting environment variables, using timestamps, or timeout configuration.</p><p><strong>97. What is the difference between </strong><strong>node and </strong><strong>stage?</strong></p><p>node allocates an executor and workspace (Scripted). stage is a logical grouping of steps for visualization (both Declarative and Scripted).</p><p><strong>98. How do you migrate from Freestyle to Pipeline jobs?</strong></p><ul><li>Analyze Freestyle job configuration</li><li>Create Jenkinsfile with equivalent stages</li><li>Use Pipeline Syntax Generator for complex steps</li><li>Test in a separate job before replacing</li></ul><p><strong>99. What is Jenkins Pipeline Resume Feature?</strong></p><p>Pipeline Resume allows restarting a failed pipeline from the point of failure rather than from the beginning (available in certain conditions).</p><p><strong>100. What are best practices for Jenkins Pipeline?</strong></p><ul><li>Use Declarative Pipeline when possible</li><li>Store Jenkinsfile in SCM</li><li>Use shared libraries for common code</li><li>Implement proper error handling</li><li>Use meaningful stage names</li><li>Secure credentials properly</li><li>Keep pipelines simple and modular</li><li>Use parallel execution for independent tasks</li><li>Implement proper logging</li><li>Clean workspaces regularly</li></ul><p>These 100 questions cover the full spectrum of Jenkins concepts from basic to advanced. Good luck with your interview!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22f7ef0327f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selectors and Labels in Kubernetes]]></title>
            <link>https://medium.com/@ramanamuttana/selectors-and-labels-in-kubernetes-0f00d2323612?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f00d2323612</guid>
            <category><![CDATA[labels]]></category>
            <category><![CDATA[selectors]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[mainfest]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Wed, 21 Jan 2026 13:39:38 GMT</pubDate>
            <atom:updated>2026-01-21T13:39:38.653Z</atom:updated>
            <content:encoded><![CDATA[<p>In Kubernetes manifest files, <strong>selectors</strong> and <strong>labels</strong> work together as a fundamental mechanism for identifying and grouping resources. Here’s how they’re used:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TWvNWX3QpGWEh7XO4s9QDQ.png" /></figure><h3>Labels</h3><p>Labels are key-value pairs attached to Kubernetes objects (like Pods, Services, Deployments). They’re used to organize and identify resources in a flexible way.</p><pre>metadata:<br>  labels:<br>    app: nginx<br>    environment: production<br>    tier: frontend</pre><p>Labels can be anything meaningful to you — there are no restrictions on what you can use them for.</p><h3>Selectors</h3><p>Selectors are used by Kubernetes controllers and services to identify which resources they should manage or route traffic to. They match against the labels on objects.</p><h3>Common Use Cases</h3><ol><li><strong>Service to Pods</strong> — A Service uses selectors to determine which Pods should receive traffic:</li></ol><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: my-service<br>spec:<br>  selector:<br>    app: nginx  # Routes traffic to Pods with this label<br>  ports:<br>    - port: 80</pre><p><strong>2. Deployment to Pods</strong> — A Deployment uses selectors to know which Pods it’s managing:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: nginx-deployment<br>spec:<br>  selector:<br>    matchLabels:<br>      app: nginx  # Manages Pods with this label<br>  template:<br>    metadata:<br>      labels:<br>        app: nginx  # These labels must match the selector</pre><p><strong>3. ReplicaSets</strong> — They use selectors to maintain the desired number of Pod replicas with matching labels.</p><h3>Why They Matter</h3><ul><li><strong>Loose coupling</strong>: Services don’t need to know specific Pod names, just their labels</li><li><strong>Dynamic grouping</strong>: As Pods are created/destroyed, selectors automatically find the right ones</li><li><strong>Flexibility</strong>: You can target resources based on multiple criteria</li><li><strong>Organization</strong>: Makes it easy to query and manage related resources</li></ul><p>The selector-label relationship is how Kubernetes maintains the connections between different resource types in a declarative way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f00d2323612" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ReentrantLock: Lock deeper, safely.]]></title>
            <link>https://medium.com/@ramanamuttana/reentrantlock-lock-deeper-safely-a01ebaf3c890?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/a01ebaf3c890</guid>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[reentrant-lock]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[locks]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Tue, 08 Jul 2025 16:36:30 GMT</pubDate>
            <atom:updated>2025-07-15T09:12:57.028Z</atom:updated>
            <content:encoded><![CDATA[<p>A <strong>Reentrant Lock</strong> in Java is a type of lock that allows the <strong>same thread</strong> to acquire the lock <strong>multiple times</strong> without causing a deadlock.</p><h3>✅ In Simple Terms:</h3><p>If a thread already holds the lock and tries to acquire it again (e.g., via a nested method call), it <strong>won’t block itself</strong> — instead, it just increases a <strong>hold count</strong> and continues.</p><p>When the thread is done, it must release the lock the <strong>same number of times</strong> it acquired it.</p><p>📘 Java Example using ReentrantLock: without fairness</p><pre>import java.util.concurrent.locks.ReentrantLock;<br><br>public class MyClass {<br>    private final ReentrantLock lock = new ReentrantLock();<br><br>    public void outer() {<br>        lock.lock();<br>        try {<br>            System.out.println(&quot;In outer method&quot;);<br>            inner(); // calls another method that also locks<br>        } finally {<br>            lock.unlock();<br>        }<br>    }<br><br>    public void inner() {<br>        lock.lock();<br>        try {<br>            System.out.println(&quot;In inner method&quot;);<br>        } finally {<br>            lock.unlock();<br>        }<br>    }<br><br>    public static void main(String[] args) {<br>        MyClass obj = new MyClass();<br>        obj.outer();<br>    }<br>}</pre><h3>🔁 What happens here:</h3><ul><li>The same thread acquires the lock in outer().</li><li>Then it calls inner(), which <strong>tries to lock the same lock again</strong>.</li><li>Since it’s a <strong>ReentrantLock</strong>, it <strong>succeeds</strong>, because it’s the <strong>same thread</strong>.</li></ul><h3>🔐 Key Features of ReentrantLock:</h3><ul><li>Allows <strong>re-entrance</strong> by the same thread.</li><li>Supports <strong>fairness</strong> (optional: first-come-first-serve).</li><li>Can be used with tryLock() (non-blocking attempt).</li><li>More flexible than synchronized, e.g., for timed or interruptible lock attempts.</li></ul><h3>🆚 ReentrantLock vs synchronized</h3><p>FeaturesynchronizedReentrantLockReentrant?✅ Yes✅ YesFairness?❌ No✅ OptionalTry without blocking?❌ No✅ tryLock()Interruptible?❌ No✅ lockInterruptibly()Unlock required?❌ No (auto)✅ Yes (manual unlock)</p><h3>Try With Reentrant Lock</h3><h3>🔒 1. Deadlock Example Without Reentrant Lock</h3><p>When a lock is <strong>not reentrant</strong>, recursive or nested acquisition by the same thread causes a deadlock.</p><blockquote><strong><em>Note:</em></strong><em> Java’s </em><em>ReentrantLock and even </em><em>synchronized blocks are </em>reentrant<em>, so they </em><strong><em>avoid</em></strong><em> this problem. But let’s simulate what would happen </em>if<em> it wasn’t reentrant.</em></blockquote><h3>❌ Hypothetical Non-Reentrant Lock (pseudo-code):</h3><pre>lock.acquire();  // thread acquires lock<br><br>// Somewhere inside a nested call:<br>lock.acquire();  // same thread tries again — DEADLOCK here!</pre><p>Because the thread is waiting on a lock it already holds — it will wait forever. That’s a <strong>self-deadlock</strong></p><h3>✅ 2. Fair vs Unfair Lock with ReentrantLock</h3><h3>✨ Fair Lock</h3><p>Ensures <strong>first-come-first-served</strong> order. Threads are queued and granted access <strong>in the order</strong> they requested the lock.</p><h3>⚡ Unfair Lock (Default)</h3><p>Allows <strong>barging</strong> — a thread can acquire the lock even if others have been waiting longer.</p><h3>🔁 Example Code Comparing Fairness</h3><pre>import java.util.concurrent.locks.ReentrantLock;<br><br>public class FairnessTest {<br>    private static ReentrantLock lock = new ReentrantLock(true); // fair = true<br><br>    public static void main(String[] args) {<br>        Runnable task = () -&gt; {<br>            String name = Thread.currentThread().getName();<br>            for (int i = 0; i &lt; 2; i++) {<br>                lock.lock();<br>                try {<br>                    System.out.println(name + &quot; acquired the lock&quot;);<br>                    try { Thread.sleep(100); } catch (InterruptedException ignored) {}<br>                } finally {<br>                    lock.unlock();<br>                }<br>            }<br>        };<br><br>        // Start multiple threads<br>        for (int i = 0; i &lt; 5; i++) {<br>            new Thread(task, &quot;Thread-&quot; + i).start();<br>        }<br>    }<br>}</pre><p>🧾 Output (Fair Mode):</p><pre>Thread-0 acquired the lock<br>Thread-1 acquired the lock<br>Thread-2 acquired the lock<br>Thread-3 acquired the lock<br>Thread-4 acquired the lock<br></pre><blockquote><em>In </em><strong><em>fair mode</em></strong><em>, threads acquire the lock in the order they requested it.</em></blockquote><p>If you use new ReentrantLock() (default unfair mode), the output might show the same thread acquiring the lock <strong>again</strong> before others get a turn, due to <strong>thread scheduling and barging</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a01ebaf3c890" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Type Guards in Typescript]]></title>
            <link>https://medium.com/@ramanamuttana/type-guards-in-typescript-529e209fd949?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/529e209fd949</guid>
            <category><![CDATA[type-guards]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[typescript-with-react]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Wed, 02 Jul 2025 13:48:15 GMT</pubDate>
            <atom:updated>2025-07-02T13:48:15.560Z</atom:updated>
            <content:encoded><![CDATA[<p>In <strong>TypeScript</strong>, a <strong>type guard</strong> is a technique used to <strong>narrow down the type</strong> of a variable <strong>within a conditional block</strong>, so TypeScript can infer and treat it more precisely.</p><h3>✅ Why Use Type Guards?</h3><p>Type guards help you write <strong>type-safe code</strong> when dealing with union types, unknown types, or custom type checking.</p><h3>🔍 Common Type Guards</h3><h3>1. typeof Type Guard</h3><p>Used for <strong>primitive types</strong> (string, number, boolean, etc.)</p><pre>function printId(id: number | string) {<br>  if (typeof id === &quot;string&quot;) {<br>    console.log(&quot;It&#39;s a string:&quot;, id.toUpperCase());<br>  } else {<br>    console.log(&quot;It&#39;s a number:&quot;, id.toFixed(2));<br>  }<br>}</pre><h3>2. instanceof Type Guard</h3><p>Used for <strong>classes</strong> or <strong>object instances</strong>.</p><pre>class Dog {<br>  bark() {<br>    console.log(&quot;Woof!&quot;);<br>  }<br>}</pre><pre>class Cat {<br>  meow() {<br>    console.log(&quot;Meow!&quot;);<br>  }<br>}</pre><pre>function speak(pet: Dog | Cat) {<br>  if (pet instanceof Dog) {<br>    pet.bark();<br>  } else {<br>    pet.meow();<br>  }<br>}</pre><h3>3. Custom Type Guard (with is keyword)</h3><p>Used for <strong>user-defined types or interfaces</strong>.</p><pre>interface Admin {<br>  role: &quot;admin&quot;;<br>  accessLevel: number;<br>}</pre><pre>interface User {<br>  role: &quot;user&quot;;<br>  name: string;<br>}</pre><pre>function isAdmin(person: Admin | User): person is Admin {<br>  return (person as Admin).accessLevel !== undefined;<br>}</pre><pre>function handlePerson(p: Admin | User) {<br>  if (isAdmin(p)) {<br>    console.log(&quot;Admin level:&quot;, p.accessLevel);<br>  } else {<br>    console.log(&quot;User name:&quot;, p.name);<br>  }<br>}</pre><h3>4. in Operator Type Guard</h3><p>Used to check if a <strong>property exists</strong> in an object.</p><pre>function logDetails(obj: Admin | User) {<br>  if (&quot;accessLevel&quot; in obj) {<br>    console.log(&quot;Admin access:&quot;, obj.accessLevel);<br>  } else {<br>    console.log(&quot;User name:&quot;, obj.name);<br>  }<br>}</pre><h3>🔑 Summary regarding Type Guard</h3><p>Type Guard Use Case typeof Primitive types instanceof Class instances in Object property existence check Custom (is) Complex or interface-based checks</p><h3>Example :In <strong>React + TypeScript</strong>, <strong>type guards</strong> are very useful when dealing with:</h3><ul><li>Props with union types</li><li>Component composition</li><li>Conditional rendering</li><li>Complex state objects (from APIs, etc.)</li></ul><h3>✅ Example: Type Guard in React Props</h3><h3>🔹 Step 1: Define Union Props</h3><pre>type ButtonProps =<br>  | { variant: &quot;link&quot;; href: string }<br>  | { variant: &quot;submit&quot;; onClick: () =&gt; void };</pre><h3>🔹 Step 2: Use a Type Guard in the Component</h3><pre>const Button: React.FC&lt;ButtonProps&gt; = (props) =&gt; {<br>  if (props.variant === &quot;link&quot;) {<br>    // props is narrowed to { variant: &quot;link&quot;; href: string }<br>    return &lt;a href={props.href}&gt;Go&lt;/a&gt;;<br>  } else {<br>    // props is narrowed to { variant: &quot;submit&quot;; onClick: () =&gt; void }<br>    return &lt;button onClick={props.onClick}&gt;Submit&lt;/button&gt;;<br>  }<br>};</pre><p>This uses <strong>discriminated unions</strong>, and the variant field automatically acts as a <strong>type guard</strong>.</p><h3>✅ Example: Type Guard for API Data</h3><p>Suppose you’re fetching from an API and don’t know if the response is an error or valid data.</p><h3>🔹 Define the Types</h3><pre>type User = { name: string; age: number };<br>type ApiError = { error: string };</pre><pre>function isUser(obj: any): obj is User {<br>  return typeof obj?.name === &quot;string&quot; &amp;&amp; typeof obj?.age === &quot;number&quot;;<br>}</pre><h3>🔹 Use in a Component</h3><pre>const UserProfile: React.FC&lt;{ data: User | ApiError }&gt; = ({ data }) =&gt; {<br>  if (isUser(data)) {<br>    return &lt;div&gt;{data.name} is {data.age} years old.&lt;/div&gt;;<br>  } else {<br>    return &lt;div&gt;Error: {data.error}&lt;/div&gt;;<br>  }<br>};</pre><h3>✅ Summary</h3><p>Use Case Type Guard Example Props with union types if (props.variant === &quot;...&quot;) API responses (error vs data) isUser(obj): obj is User Conditional rendering Type guards inside JSX</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=529e209fd949" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add .sql file to liquibase Changelog.xml fiel]]></title>
            <link>https://medium.com/@ramanamuttana/how-to-add-sql-file-to-liquibase-changelog-xml-fiel-fccfd9c94d5f?source=rss-71fdfec1f7aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/fccfd9c94d5f</guid>
            <category><![CDATA[liquibase]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[changelog]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[xml]]></category>
            <dc:creator><![CDATA[Ramanamuttana]]></dc:creator>
            <pubDate>Fri, 28 Mar 2025 11:41:57 GMT</pubDate>
            <atom:updated>2025-03-28T11:41:57.204Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to add .sql file to liquibase Changelog.xml fiel</h3><p>To add a .sql file to a Liquibase changelog.xml, you can use the &lt;sqlFile&gt; tag. This tag allows you to reference an external .sql file that contains the SQL changes, which will then be executed as part of the Liquibase migration process.</p><h3>Steps to Add a .sql File to changelog.xml:</h3><ol><li><strong>Create the </strong><strong>.sql file</strong>: Make sure you have your SQL file created. For example, let’s say the file is named database_changes.sql.</li><li><strong>Add the </strong><strong>&lt;sqlFile&gt; Tag to Your </strong><strong>changelog.xml</strong>: In the Liquibase changelog XML file, use the &lt;sqlFile&gt; tag to reference the .sql file. You can either provide the absolute or relative path to the .sql file.</li></ol><h3>Example:</h3><p>Let’s assume your .sql file (database_changes.sql) contains the following SQL:</p><pre>-- Create a new table for storing employee details<br>CREATE TABLE employees (<br>    id INT PRIMARY KEY,<br>    name VARCHAR(100) NOT NULL,<br>    position VARCHAR(100)<br>);<br><br>-- Insert some sample data<br>INSERT INTO employees (id, name, position) VALUES (1, &#39;John Doe&#39;, &#39;Developer&#39;);<br>INSERT INTO employees (id, name, position) VALUES (2, &#39;Jane Smith&#39;, &#39;Manager&#39;);</pre><p>Now, in your changelog.xml, you would add a reference to this file using the &lt;sqlFile&gt; tag:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br><br>&lt;databaseChangeLog<br>    xmlns=&quot;http://www.liquibase.org/xml/ns/dbchangelog&quot;<br>    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>    xsi:schemaLocation=&quot;http://www.liquibase.org/xml/ns/dbchangelog<br>        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd&quot;&gt;<br><br>    &lt;!-- Reference the external SQL file --&gt;<br>    &lt;changeSet id=&quot;1&quot; author=&quot;yourname&quot;&gt;<br>        &lt;sqlFile path=&quot;path/to/database_changes.sql&quot; /&gt;<br>    &lt;/changeSet&gt;<br><br>&lt;/databaseChangeLog&gt;</pre><h3>Key Points:</h3><ul><li><strong>&lt;sqlFile&gt;</strong>: This tag tells Liquibase to execute the SQL from an external file.</li><li><strong>path</strong>: The path attribute specifies where Liquibase should look for the SQL file. If the file is in the same directory as the changelog.xml, you can simply use the file name (e.g., path=&quot;database_changes.sql&quot;). If it’s in a different folder, provide the relative or absolute path (e.g., path=&quot;sql/database_changes.sql&quot;).</li><li><strong>&lt;changeSet&gt;</strong>: A &lt;changeSet&gt; is required to wrap the SQL file reference. It should include a unique id and author.</li></ul><h3>Example Directory Structure:</h3><p>Assume the following directory structure:</p><pre>project/<br>│<br>├── changelog/<br>│   └── db.changelog.xml<br>│<br>└── sql/<br>    └── database_changes.sql</pre><p>The db.changelog.xml would reference the SQL file like this:</p><pre>&lt;changeSet id=&quot;1&quot; author=&quot;yourname&quot;&gt;<br>    &lt;sqlFile path=&quot;sql/database_changes.sql&quot; /&gt;<br>&lt;/changeSet&gt;</pre><h3>Running Liquibase with SQL File:</h3><p>Once you’ve added the SQL file to your changelog, you can run the Liquibase migration as usual:</p><pre>liquibase --changeLogFile=changelog/db.changelog.xml update</pre><p>This will execute the SQL commands from database_changes.sql as part of the migration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fccfd9c94d5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>