<?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 Grazia D&#39;Amico on Medium]]></title>
        <description><![CDATA[Stories by Grazia D&#39;Amico on Medium]]></description>
        <link>https://medium.com/@graziagdamico?source=rss-163019bd51fa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BIJ8rbwS0p-0vSo1HLUJFg.png</url>
            <title>Stories by Grazia D&amp;#39;Amico on Medium</title>
            <link>https://medium.com/@graziagdamico?source=rss-163019bd51fa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 21:47:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@graziagdamico/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[Understanding Shirudo: From eBPF Runtime Security to Cryptographic Trust]]></title>
            <link>https://medium.com/@graziagdamico/understanding-shirudo-from-ebpf-runtime-security-to-cryptographic-trust-c02c07bb9979?source=rss-163019bd51fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/c02c07bb9979</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[runtime-security]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[ebpf]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Grazia D'Amico]]></dc:creator>
            <pubDate>Fri, 27 Nov 2026 08:15:04 GMT</pubDate>
            <atom:updated>2026-11-27T08:24:47.631Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ErnMT-MYm-UsRfINfFNv_Q.png" /></figure><p>How signed eBPF programs, kernel enforcement and TPM-backed attestation can change the way we protect running Linux systems.</p><p>On November 23, 2026, OpenAI and Cisco introduced Shirudo, an open-source runtime security platform designed to protect running Linux systems while permanent software patches are being developed and deployed.</p><p>Having previously studied eBPF, Cilium and Tetragon, I was curious to understand what Shirudo brings to the existing runtime security landscape.</p><p>I completed the Getting Started with Shirudo laboratory and earned its Bronze badge. If you are interested in exploring the technology yourself, Isovalent provides a hands-on environment:</p><p><a href="https://isovalent.com/labs/shirudo-getting-started/">Getting Started with Shirudo — Isovalent Labs</a></p><p>After completing the lab, I wanted to dig a little deeper.</p><p>So, what exactly is Shirudo?</p><p>Shirudo is an eBPF-based runtime security platform for Linux that enables targeted security mitigations without restarting the system.</p><p>But why do we need it?</p><p>Discovering a vulnerability and deploying its permanent fix are two different things.</p><p>Even when a patch is available, testing, validating and distributing it across an infrastructure can take time. Restarting critical services or entire systems may also introduce operational challenges.</p><p>Shirudo aims to address this window of exposure.</p><p>Its protections, referred to as <strong>shields</strong>, use eBPF to introduce additional security checks, block vulnerable execution paths or observe specific kernel activity.</p><p>What Shirudo is not</p><p>Despite its runtime protection capabilities, Shirudo should not be confused with traditional kernel live patching, vulnerability scanners or autonomous security agents.</p><p>The Shirudo runtime itself does not discover vulnerabilities, generate mitigations or guarantee the functional correctness of the code it deploys. Nor does it replace the eBPF verifier or permanent software patches.</p><p>The protection comes from the shield. Shirudo provides the security infrastructure through which that protection is authorized, deployed and measured.</p><p>However, introducing programmable security mechanisms into the kernel raises another question:</p><p><strong>How can we ensure that only authorized modifications are introduced?</strong></p><p>This is where cryptographic trust becomes a fundamental part of Shirudo’s architecture.</p><p>One of the first things I wanted to understand was where Shirudo sits within the Linux architecture.</p><p>Shirudo is not simply a tool that we launch when a vulnerability is discovered. The target system must already be prepared to support its security mechanisms.</p><p>Its architecture spans multiple areas:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UiVn02aAp7f1HddXObjfew.png" /><figcaption>Figure 1 — Shirudo architecture: package distribution, kernel enforcement and TPM-backed attestation. Source: Shirudo official documentation.</figcaption></figure><h4>User space</h4><p>This is where administrative operations take place, including package retrieval, installation, removal and evidence collection.</p><p>The Shirudo runtime executes individual commands rather than relying on a continuously running daemon.</p><h4>Kernel space</h4><p>This is where eBPF programs execute and where Shirudo establishes its enforcement boundary.</p><p>The Linux kernel provides the execution environment, the eBPF verifier and the Linux Security Modules framework.</p><p>Shirudo builds on these mechanisms to restrict unauthorized BPF loading and protect its active programs and associated state.</p><h4>Hardware-backed trust</h4><p>The Trusted Platform Module, or TPM, provides the foundation for protecting cryptographic measurements and producing signed attestation evidence.</p><p>It extends the trust model beyond the information reported by ordinary userspace processes.</p><p>The important distinction is that Shirudo provides the infrastructure for controlled runtime changes, while an individual shield provides the actual security mitigation.</p><p><strong>Before diving into the security model, let’s explore Shirudo’s architecture and the responsibilities of its main components.</strong></p><h3>Operator and Target</h3><p>Shirudo separates two fundamental roles.</p><p>The <strong>Operator</strong> develops, builds, signs and distributes security artifacts. It also verifies the evidence returned by target systems.</p><p>The <strong>Target</strong> is the Linux system on which those artifacts are installed and executed.</p><p>The operator controls the signing keys, while the target holds the public certificates required to verify authorized artifacts.</p><p>This separation establishes a trust boundary between the environment that produces security changes and the environment that executes them.</p><h3>Shield, upatch and package</h3><p>These terms describe different aspects of the deployment lifecycle.</p><ul><li><strong>Shield:</strong> the security protection or mitigation being introduced.</li><li><strong>Upatch:</strong> the signed artifact used to introduce a change into the running system.</li><li><strong>Unload directive:</strong> a signed artifact used to remove an installed upatch.</li><li><strong>Beefile:</strong> the recipe describing the package and its source components.</li><li><strong>BPM:</strong> Shirudo’s package management system.</li><li><strong>.bee package:</strong> a versioned archive containing individually signed upatches and their corresponding unload directives. The package is referenced by its digest in the signed repository index.</li></ul><p>This packaging model allows a security modification to be distributed, installed and subsequently removed through controlled operations.</p><h3>OCI Registry and Signed Index</h3><p>OCI registries are commonly associated with container images, but they can also distribute other types of software artifacts.</p><p>Shirudo uses them to distribute its packages.</p><p>A signed repository index associates package names and versions with their corresponding content.</p><p>The target retrieves and verifies the index, then checks the downloaded artifacts against the expected <strong>digests</strong>.</p><p>A digest is a cryptographic fingerprint of data, generated using a hash function such as SHA-256. Comparing the expected digest with the calculated one allows the target to detect changes in the downloaded content.</p><p>This establishes a controlled distribution mechanism rather than requiring operators to manually transfer individual eBPF programs to every machine.</p><h3>Signed Loader and Kernel Keyring</h3><p>The signed loader is particularly important because it connects cryptographic authorization with kernel execution.</p><p>A <strong>keyring</strong> is a Linux kernel mechanism for managing keys and certificates.</p><p>Shirudo enrolls trusted certificates into a protected BPF keyring. The kernel uses those certificates to verify the signatures of loaders submitted for execution.</p><p>The operator can therefore retain control over which artifacts are authorized without distributing the private signing key to every target.</p><h3>BPF LSM</h3><p>Linux Security Modules (LSM) provide a framework through which additional security checks can be enforced within the kernel.</p><p>BPF LSM allows security logic to be implemented using eBPF programs attached to LSM hooks.</p><p>Shirudo uses these mechanisms to enforce its own trust boundaries.</p><p>This is significant because administrative privileges alone should not be sufficient to bypass its BPF admission policy, provided that the underlying trusted components remain uncompromised.</p><h3>eBPF hooks, maps and pinning</h3><p>An eBPF program can be attached to a specific execution point in the kernel, known as a <strong>hook</strong>.</p><p>For example, <strong>fentry</strong> (function entry) is a type of eBPF hook that allows a program to execute whenever a selected kernel function is entered.</p><p>During execution, the program can use <strong>BPF maps</strong> to store data, maintain state, collect statistics and exchange information with userspace applications.</p><p>But what happens when the userspace process responsible for loading the eBPF program terminates?</p><p>This is where <strong>BPFFS</strong> (BPF File System) comes into play. It is a virtual filesystem that allows references to eBPF objects, such as programs, maps and attachment links, to be retained through a mechanism called <strong>pinning</strong>.</p><p>In Shirudo, pinning allows installed programs to remain attached and their maps to remain accessible without requiring a continuously running userspace daemon.</p><h4><strong>Shirudo’s main responsibilities</strong></h4><p>Now that we have explored the architecture, let’s see what Shirudo is actually responsible for.</p><ul><li><strong>Runtime protection:</strong> introduce targeted security mitigations into running systems.</li><li><strong>Controlled distribution:</strong> package and distribute security changes.</li><li><strong>Cryptographic authorization:</strong> restrict deployment to appropriately signed artifacts.</li><li><strong>Integrity verification:</strong> detect unauthorized modifications to distributed content.</li><li><strong>Kernel enforcement:</strong> restrict unauthorized BPF operations and protect active security mechanisms.</li><li><strong>Measurement:</strong> maintain a cryptographically anchored record of relevant changes.</li><li><strong>Attestation:</strong> allow operators to verify evidence of the measured system state.</li></ul><p>These responsibilities are related, but they provide different security guarantees.</p><p>Understanding those differences is essential.</p><p>While studying Shirudo, I found myself repeatedly returning to four distinct concepts.</p><blockquote>Authenticity concerns the origin of an artifact.</blockquote><p>A valid digital signature demonstrates that the content was signed using the corresponding private key.</p><p>Establishing trust in the signer additionally requires a trusted association with that key.</p><blockquote>Integrity concerns whether the content has been modified.</blockquote><p>By comparing digests and verifying signatures, Shirudo can detect alterations to the artifacts it receives.</p><blockquote>Authorization determines whether an operation is permitted.</blockquote><p>A cryptographically valid signature is not sufficient if the signing key is not trusted by the target’s security policy.</p><p>Shirudo therefore establishes a relationship between signature verification and the certificates authorized to introduce BPF changes.</p><blockquote>Functional correctness concerns whether software behaves according to its intended requirements.</blockquote><p>This is a different problem.</p><p>A program can be authentic, unmodified and authorized while still containing incorrect or harmful logic.</p><p>Neither a digital signature nor successful cryptographic verification proves that a security mitigation works as intended.</p><p>This is why code review, testing and independent approval remain important.</p><p>The eBPF verifier already checks whether a program satisfies the kernel’s BPF safety constraints. So, what does Shirudo add?</p><p>Each security mechanism addresses a different question:</p><ul><li><strong>eBPF verifier:</strong> Can the program execute safely within the kernel’s BPF constraints?</li><li><strong>Signature verification:</strong> Is the artifact authentic and unmodified?</li><li><strong>Shirudo enforcement:</strong> Is the BPF operation authorized?</li><li><strong>Code review and testing:</strong> Does the program behave as intended?</li><li><strong>Attestation:</strong> Does the measured state match the expected state?</li></ul><p>A program can pass the eBPF verifier and be correctly signed while still containing flawed or harmful logic.</p><p>These mechanisms complement each other, but none replaces the others.</p><p>Shirudo uses a <strong>Trusted Platform Module (TPM)</strong> to maintain a cryptographically verifiable record of runtime changes.</p><blockquote>A TPM is a security component that provides protected cryptographic operations, key management and measurement capabilities.</blockquote><p>Shirudo relies on TPM 2.0 to maintain a protected measurement register. Each upatch loading or unloading event extends the measurement chain, allowing the recorded changes to be independently verified.</p><h3>How does the measurement chain work?</h3><p>A <strong>hash chain</strong> accumulates measurements by combining the previous measurement value with the digest of a new event.</p><p>Conceptually:</p><ul><li>H₀ — Initial measured state.</li><li>H₁ = Hash(H₀ || Digest(Load A))</li><li>H₂ = Hash(H₁ || Digest(Unload A))</li></ul><p>The double vertical bar (||) represents concatenation.</p><p>Each measurement depends on the previous one, preserving the chronological sequence of measured events.</p><p>Removing an upatch does not restore the initial measurement value, since unloading is itself a measured event.</p><p>Consequently, two systems with identical active upatches can have different measurement histories.</p><p>Two mechanisms work together:</p><ul><li><strong>Measurement register:</strong> maintains the accumulated cryptographic measurement.</li><li><strong>Event log:</strong> records the individual events that contributed to that measurement.</li></ul><p>The hash value alone does not reveal the original events. However, the event log can be replayed to reconstruct the measurement chain and verify its consistency.</p><p>Shirudo also restricts who can extend the measurement register, combining kernel-level authorization with TPM policy checks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0zSDmw0nEXiR34uHdajh4A.png" /><figcaption>Figure 2 — One write of the register. The TPM checks the policy, the kernel checks who sends the extension. Source: Shirudo official documentation.</figcaption></figure><h3>Measured boot and runtime measurements</h3><p>A TPM contains <strong>Platform Configuration Registers (PCRs)</strong>, which accumulate cryptographic measurements.</p><p>A <strong>Unified Kernel Image (UKI)</strong> combines the Linux kernel, initial RAM filesystem (initramfs) and other boot-related components into a single bootable image.</p><p>While measured boot records measurements of the system’s startup components and boot phases, Shirudo extends this trust model to runtime BPF changes through its TPM-backed measurement register.</p><p>This establishes two complementary areas of measurement:</p><ul><li><strong>Boot measurements:</strong> what was measured during system startup.</li><li><strong>Runtime measurements:</strong> which upatch operations were performed while the system was running.</li></ul><p>Recording measurements is only one part of the trust model. The operator must also be able to verify them independently through <strong>attestation</strong>.</p><p>The main participants in this process are:</p><p>- <strong>Nonce</strong>(<em>number used once</em>)<strong>:</strong> a fresh value associated with a specific verification request.<br>- <strong>Attestation Key:</strong> a TPM key used to sign attestation data.<br>- <strong>Evidence:</strong> the information returned for verification.<br>- <strong>Expected Chain:</strong> the measurement value calculated from the events the operator expects.<br>- <strong>Measured Chain:</strong> the value derived from the events recorded by the target.</p><p>The verifier checks the signed evidence, the identity of the trusted attestation key, the nonce and the expected measurements.</p><h4>Why is the nonce necessary?</h4><p>Imagine that a target returned valid evidence yesterday, when its measured state matched the operator’s expectations.</p><p>Today, an unexpected security change has been introduced.</p><p>If the old report could simply be reused, the operator might incorrectly accept it as evidence of the current state.</p><p>This is known as a replay attack.</p><p>A fresh nonce connects the signed attestation to a new request. An old report containing a different nonce will not satisfy that verification.</p><h4>What does attestation actually prove?</h4><p>This was another important distinction in my learning process.</p><p>A successful attestation does not automatically demonstrate that the entire system is healthy, uncompromised or free from malicious software.</p><p>It provides assurance about the measured state under the assumptions of the trust model.</p><p>In the laboratory, a software TPM demonstrates the measurement and verification process. <strong>It does not establish hardware-backed machine identity or the integrity of a complete production boot sequence</strong>.</p><blockquote>Attestation can only provide evidence about what has actually been measured.</blockquote><p>Isovalent presents an interesting way of understanding the evolution of eBPF-based security through three generations.</p><p>I found this perspective particularly useful because it clarifies the relationship between traditional eBPF observability, Tetragon and Shirudo.</p><h3>Generation 1 — Observation</h3><p>The first approach focuses on collecting information from the kernel.</p><p>eBPF probes observe selected events and forward information to userspace applications for analysis and detection.</p><p>The limitation is that an operation may already have completed by the time the userspace component reacts.</p><p>Observation provides visibility, but visibility alone is not always sufficient to prevent unwanted behavior.</p><h3>Generation 2 — Policy-driven enforcement</h3><p>Tetragon introduces a model in which security policies can define actions directly associated with kernel events.</p><p>A Tetragon TracingPolicy describes:</p><p>- <strong>Hook:</strong> where to observe an operation.<br>- <strong>Selector:</strong> which conditions must match.<br>- <strong>Action:</strong> what should happen when those conditions are satisfied.</p><p>This enables security decisions and supported enforcement actions to occur close to the observed operation.</p><p>The policy model makes runtime security accessible without requiring users to implement every protection directly in eBPF.</p><p>However, its expressiveness depends on the capabilities exposed through the policy interface.</p><h3>Generation 3 — Signed programmable security</h3><p>Shirudo approaches the problem from a different direction.</p><p>Instead of restricting mitigation development to a predefined policy language, it enables the distribution of custom eBPF logic through signed artifacts.</p><p>It combines that flexibility with kernel-level admission controls and TPM-backed measurement.</p><p>The distinction can be summarized as follows:</p><pre>| Generation  | Primary focus |<br>| - -         | - -           |<br>| eBPF probes | Observe kernel activity |<br>| Tetragon    | Observe and enforce security policies |<br>| Shirudo     | Deploy and attest authorized programmable security changes |</pre><p>This is Isovalent’s conceptual framework for describing the evolution of these approaches, rather than a universal classification of all eBPF technologies.</p><p><strong>It does not mean that Shirudo makes Tetragon obsolete.</strong></p><p>The relationship between programmable security and artificial intelligence becomes clearer once these architectural differences are understood.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Tjbx-plVDcpBJ5g14-Eqw.png" /><figcaption><em>Figure 3 — AI-driven runtime protection with Shirudo and eBPF. Source: </em><a href="https://openai.com/index/introducing-shirudo/"><em>OpenAI and Cisco introduce Shirudo</em></a><em>.</em></figcaption></figure><p>An AI-driven security operator could investigate a vulnerability, generate a targeted mitigation and test its effectiveness.</p><p>Allowing an agent to produce custom eBPF code provides greater flexibility than limiting it to a predefined set of policy actions.</p><p>However, this also introduces an important security question:</p><p>Should the same AI agent be responsible for generating, testing, approving, signing and deploying its own code?</p><p>From an architectural perspective, concentrating all these responsibilities in a single agent creates significant risks.</p><p>A compromised agent, an incorrectly interpreted requirement or a software defect could propagate through the entire deployment pipeline.</p><p>A possible architecture would instead separate:</p><p>- AI-driven investigation and code generation.<br>- Independent validation and testing.<br>- Approval and cryptographic signing.<br>- Controlled deployment through Shirudo.<br>- Runtime monitoring and attestation.</p><p>This follows established security principles such as Separation of Duties, Least Privilege and Defense in Depth.</p><p>Shirudo can contribute to this architecture, but it does not independently guarantee that these principles are respected.</p><p>The surrounding infrastructure must enforce them.</p><p>While studying Shirudo, I also questioned whether its additional complexity was justified.</p><p>It introduces requirements involving kernel compatibility, trusted boot components, signing keys, certificates, TPM configuration and artifact distribution.</p><p>Its enforcement model also affects compatibility with other applications that independently load eBPF programs.</p><p>Furthermore, Shirudo does not eliminate the need for permanent software patches, nor does it protect against every form of system compromise.</p><p>Its guarantees depend on an underlying trusted computing base and a properly maintained trust infrastructure.</p><p>For me, these limitations are not reasons to dismiss the technology. They are necessary considerations when evaluating where its adoption makes sense.</p><p>The relevant question is not simply whether Shirudo provides additional security, but whether its particular guarantees address the threat model of the infrastructure in which it will operate.</p><h3>References</h3><ol><li><strong>OpenAI and Cisco introduce Shirudo</strong> — <a href="https://openai.com/index/introducing-shirudo/">https://openai.com/index/introducing-shirudo/</a></li><li><strong>What is Shirudo?</strong> — <a href="https://docs.shirudo.dev/start/what-is-shirudo.html">https://docs.shirudo.dev/start/what-is-shirudo.html</a></li><li><strong>How Shirudo works</strong> — <a href="https://docs.shirudo.dev/start/how-it-works.html">https://docs.shirudo.dev/start/how-it-works.html</a></li><li><strong>Getting Started with Shirudo — Isovalent Labs</strong> — <a href="https://isovalent.com/labs/shirudo-getting-started/">https://isovalent.com/labs/shirudo-getting-started/</a></li><li><strong>How Shirudo compares</strong> — <a href="https://docs.shirudo.dev/concepts/comparisons.html">https://docs.shirudo.dev/concepts/comparisons.html</a></li><li><strong>Shirudo Threat Model</strong> — <a href="https://docs.shirudo.dev/security/threat-model.html">https://docs.shirudo.dev/security/threat-model.html</a></li><li><strong>Shirudo Architecture Overview</strong> — <a href="https://docs.shirudo.dev/internals/architecture.html">https://docs.shirudo.dev/internals/architecture.html</a></li><li><strong>Shirudo System Requirements</strong> — <a href="https://docs.shirudo.dev/operate/plan/system-requirements.html">https://docs.shirudo.dev/operate/plan/system-requirements.html</a></li><li><strong>TPM 2.0 and how Shirudo uses it</strong> — <a href="https://docs.shirudo.dev/concepts/background/tpm.html">https://docs.shirudo.dev/concepts/background/tpm.html</a></li><li><strong>Operator and Target</strong> — <a href="https://docs.shirudo.dev/concepts/operator-and-target.html">https://docs.shirudo.dev/concepts/operator-and-target.html</a></li><li><strong>Upatches, Directives and Packages</strong> — <a href="https://docs.shirudo.dev/concepts/upatches-and-packages.html">https://docs.shirudo.dev/concepts/upatches-and-packages.html</a></li><li><strong>Shirudo Glossary</strong> — <a href="https://docs.shirudo.dev/concepts/glossary.html">https://docs.shirudo.dev/concepts/glossary.html</a></li><li><strong>OCI Registries</strong> — <a href="https://docs.shirudo.dev/concepts/background/oci.html">https://docs.shirudo.dev/concepts/background/oci.html</a></li><li><strong>Package and Index Formats</strong> — <a href="https://docs.shirudo.dev/reference/formats/bpm-formats.html">https://docs.shirudo.dev/reference/formats/bpm-formats.html</a></li><li><strong>NIST — Hash Functions</strong> — <a href="https://csrc.nist.gov/projects/hash-functions">https://csrc.nist.gov/projects/hash-functions</a></li><li><strong>Kernel Keyrings</strong> — <a href="https://docs.shirudo.dev/concepts/background/keyrings.html">https://docs.shirudo.dev/concepts/background/keyrings.html</a></li><li><strong>BPF LSM</strong> — <a href="https://docs.shirudo.dev/concepts/background/bpf-lsm.html">https://docs.shirudo.dev/concepts/background/bpf-lsm.html</a></li><li><strong>fentry and fexit Attachments</strong> — <a href="https://docs.shirudo.dev/concepts/background/fentry-fexit.html">https://docs.shirudo.dev/concepts/background/fentry-fexit.html</a></li><li><strong>Linux Kernel Documentation — BPF Maps</strong> — <a href="https://docs.kernel.org/bpf/maps.html">https://docs.kernel.org/bpf/maps.html</a></li><li><strong>NIST — FIPS 186–5: Digital Signature Standard (DSS)</strong> — <a href="https://csrc.nist.gov/pubs/fips/186-5/final">https://csrc.nist.gov/pubs/fips/186-5/final</a></li><li><strong>Shirudo Cryptography</strong> — <a href="https://docs.shirudo.dev/security/cryptography.html">https://docs.shirudo.dev/security/cryptography.html</a></li><li><strong>Linux Kernel Documentation — eBPF Verifier</strong> — <a href="https://docs.kernel.org/bpf/verifier.html">https://docs.kernel.org/bpf/verifier.html</a></li><li><strong>Shirudo Measurement Register</strong> — <a href="https://docs.shirudo.dev/concepts/measurement-register.html">https://docs.shirudo.dev/concepts/measurement-register.html</a></li><li><strong>Measurement Register and Attestation</strong> — <a href="https://docs.shirudo.dev/internals/measurement-register.html">https://docs.shirudo.dev/internals/measurement-register.html</a></li><li><strong>Boot Process and Measured Boot</strong> — <a href="https://docs.shirudo.dev/concepts/background/boot.html">https://docs.shirudo.dev/concepts/background/boot.html</a></li><li><strong>Attest Targets</strong> — <a href="https://docs.shirudo.dev/operate/run/attest.html">https://docs.shirudo.dev/operate/run/attest.html</a></li><li><strong>Cisco/Isovalent — </strong><a href="https://isovalent.com/labs/shirudo-getting-started/">Getting Started with Shirudo: A Hands-on Lab, version 1.0.3</a> (PDF reference guide, available for download within the hands-on lab)</li><li><strong>Cisco/Isovalent — Raphaël Pinson</strong> — <a href="https://lnkd.in/p/dSdY3MQV">Three Generations of eBPF Security, LinkedIn, reposted by Isovalent.</a></li><li><strong>Tetragon — Tracing Policy</strong> — <a href="https://tetragon.io/docs/concepts/tracing-policy/">https://tetragon.io/docs/concepts/tracing-policy/</a></li><li><strong>Tetragon — Enforcement</strong> — <a href="https://tetragon.io/docs/concepts/enforcement/">https://tetragon.io/docs/concepts/enforcement/</a></li><li><strong>Isovalent — Cisco and OpenAI introduce Shirudo</strong> — <a href="https://isovalent.com/blog/post/cisco-openai-shirudo/">https://isovalent.com/blog/post/cisco-openai-shirudo/</a></li><li><strong>NIST — Separation of Duty</strong> — <a href="https://csrc.nist.gov/glossary/term/separation_of_duty">https://csrc.nist.gov/glossary/term/separation_of_duty</a></li><li><strong>NIST — Least Privilege</strong> — <a href="https://csrc.nist.gov/glossary/term/least_privilege">https://csrc.nist.gov/glossary/term/least_privilege</a></li><li><strong>NIST — Defense in Depth</strong> — <a href="https://csrc.nist.gov/glossary/term/defense_in_depth">https://csrc.nist.gov/glossary/term/defense_in_depth</a></li><li><strong>Shirudo Interoperability</strong> — <a href="https://docs.shirudo.dev/operate/plan/interoperability.html">https://docs.shirudo.dev/operate/plan/interoperability.html</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c02c07bb9979" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Snapshot of Zero Trust Architecture]]></title>
            <link>https://medium.com/@graziagdamico/a-snapshot-of-zero-trust-architecture-1f9297b74ad7?source=rss-163019bd51fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f9297b74ad7</guid>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[nist]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[zero-trust-security]]></category>
            <dc:creator><![CDATA[Grazia D'Amico]]></dc:creator>
            <pubDate>Tue, 24 Nov 2026 08:02:39 GMT</pubDate>
            <atom:updated>2026-11-24T08:02:39.611Z</atom:updated>
            <content:encoded><![CDATA[<p>A service’s position within a network does not prove its identity or its right to access another service.</p><p>Trust is not automatically granted.</p><p>This principle lies at the foundation of Zero Trust Architecture (ZTA), a security model that challenges one of the traditional assumptions of network security: that systems operating inside a trusted network perimeter can be considered inherently trustworthy.</p><p>In modern cloud-native environments, applications are increasingly distributed across containers, Kubernetes clusters, cloud providers, and on-premises infrastructure. Microservices communicate continuously, workloads are frequently recreated, and network addresses change dynamically.</p><p>Under these conditions, network location alone cannot provide sufficient information to determine whether a service should be allowed to access another.</p><p>The National Institute of Standards and Technology (NIST) addresses this challenge in NIST SP 800–207, Zero Trust Architecture, and extends the architectural model to cloud-native applications.</p><p>The objective is not to eliminate network security, but to combine it with identity-based controls capable of protecting applications regardless of where their components are deployed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S073jzvg3PffXLUR7igrYg.png" /><figcaption>Flexibility provided by multi-tier policies — A Zero Trust Architecture Model for Access Control in Cloud-Native Applications in Multi-Location Environments</figcaption></figure><p>Traditional network security relies heavily on segmentation and isolation through parameters such as IP addresses, subnets, ports, and network perimeters.</p><p>For example, a firewall rule might allow communication between two endpoints:</p><pre>Source:      10.0.1.10<br>Destination: 10.0.2.20<br>Port:        8080<br>Action:      ALLOW</pre><p>This rule determines whether traffic can pass between two network locations.</p><p>However, it does not establish which application is running behind either address, whether the calling service is authentic, or which operations it is authorized to perform.</p><p>In Kubernetes, the problem becomes more apparent.</p><p>Pods are ephemeral. A Pod can be terminated, rescheduled onto another node, and assigned a different IP address while continuing to represent the same logical application.</p><p>Security rules tied exclusively to static IP addresses become difficult to maintain in such environments.</p><p>Modern Container Network Interfaces (CNIs), including Cilium, partially address this limitation by allowing policies to be expressed using Kubernetes labels and workload identities rather than fixed IP addresses.</p><p>Nevertheless, an identity derived from workload metadata does not automatically provide cryptographic proof of the caller’s identity.</p><blockquote>Identity-Tier security introduces authentication and authorization based on the identities of services and users, rather than relying solely on their network locations.</blockquote><p>A policy can express a more meaningful requirement:</p><pre>Source:      frontend-service<br>Destination: orders-service<br>Method:      GET<br>Path:        /orders<br>Action:      ALLOW</pre><p>This rule describes the intended interaction between applications.</p><p>Network connectivity establishes whether communication is possible, while identity-based authorization determines whether a verified caller is permitted to perform a particular operation.</p><p>Implementing Zero Trust across distributed applications requires infrastructure capable of defining, distributing, and enforcing security policies.</p><p>NIST SP 800–207A describes an architectural model involving a management plane, control planes, and data planes.</p><p>The Control Plane is responsible for <strong>configuring </strong>the infrastructure that governs service communication.</p><p>In a service mesh, it distributes configuration and security policies to the proxies responsible for handling application traffic.</p><p>For example, an authorization policy may specify that a frontend service is allowed to communicate with a backend service under particular conditions.</p><p>The Control Plane ensures that the relevant enforcement components receive the configuration.</p><p>It does not necessarily process every application request.</p><p>The Data Plane <strong>handles </strong>actual communication between services.</p><p>It contains the components that intercept traffic, apply policies, and enforce security controls.</p><p>Depending on the implementation, these components may include sidecar proxies, gateways, or kernel-level networking mechanisms.</p><p>For example, an Envoy proxy can enforce HTTP authorization policies, while Cilium uses eBPF programs to enforce networking and security policies within the Linux kernel.</p><p>These mechanisms operate differently, but both can contribute to the enforcement infrastructure.</p><p>The Management Plane <strong>provides </strong>the interfaces and operational mechanisms used to administer policies.</p><p>It may expose APIs, command-line interfaces, configuration tools, and automation workflows.</p><p>In a multi-cluster environment, an enterprise-level management infrastructure can help maintain consistent security policies across multiple control planes.</p><p>The responsibilities can be summarized as follows:</p><p>- <strong>Management Plane:</strong> provides the interfaces and workflows for administering policies.<br>- <strong>Control Plane:</strong> distributes configuration and policies to enforcement components.<br>- <strong>Data Plane:</strong> processes traffic and applies the configured controls.</p><p>This separation is essential because defining a security policy is not equivalent to enforcing it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgfYjMmQ7hXo5uvpZY6ipQ.png" /><figcaption>Enterprise infrastructure layer for uniform policy deployment — A Zero Trust Architecture Model for Access Control in Cloud-Native Applications in Multi-Location Environments</figcaption></figure><p>The NIST reference architecture describes three types of proxies that participate in the enforcement of Zero Trust policies.</p><p>An ingress proxy controls traffic entering a cluster from external clients or services.</p><p>It may enforce authentication, authorization, routing restrictions, and other security policies before requests reach internal applications.</p><p>For example:</p><pre>External Client<br>      |<br>      v<br>Ingress Proxy<br>      |<br>      v<br>Frontend Service</pre><p>A sidecar proxy operates alongside an application workload and can intercept communication between services.</p><p>In a traditional service mesh architecture, sidecars provide a consistent enforcement layer without requiring each application to implement every networking and security feature independently.</p><p>For example:</p><pre>Frontend<br>    |<br>Frontend Proxy<br>    |<br>    | mTLS<br>    v<br>Backend Proxy<br>    |<br>Backend</pre><p>The proxies can authenticate workloads, evaluate authorization policies, and collect telemetry.</p><p>An egress proxy controls outgoing communication from a cluster toward external services.</p><p>For example:</p><pre>Backend Service<br>      |<br>      v<br>Egress Proxy<br>      |<br>      v<br>External API</pre><p>This allows organizations to restrict which external systems an application can contact.</p><p>All three proxy types can act as <strong>Policy Enforcement Points </strong>(PEPs).</p><blockquote>A PEP is responsible for applying access-control decisions to actual communication.</blockquote><p>These three proxy categories describe the service-mesh architecture presented by NIST. They do not imply that every Zero Trust implementation must deploy a sidecar for every workload.</p><p>NIST SP 800–207A identifies several assumptions that guide the design of Zero Trust policies.</p><p>The first three are especially significant for distributed applications.</p><ol><li>Network perimeters can be breached.</li></ol><blockquote>A service should not be considered trustworthy merely because it operates inside a private network.</blockquote><p>2. An attacker may already be inside the network.</p><blockquote>Security policies must account for the possibility that an internal workload has been compromised.</blockquote><p>3. Access decisions must follow least-privilege, per-request, and context-based principles.</p><blockquote>Access must be restricted according to the identities involved, the requested resource, and the relevant security context.</blockquote><p>The document also emphasizes a fourth consideration: API security practices, including versioning, input validation, and output encoding, must remain part of the overall policy framework.</p><p>Together, these assumptions lead toward identity-based segmentation.</p><p>Instead of granting broad access to all services within a subnet, the infrastructure can restrict communication to explicitly authorized interactions between workloads.</p><p><strong>Identity-Based Segmentation</strong>: NIST introduces five recommendations for implementing identity-based segmentation at runtime.</p><h3>ID-SEG-REC-1: Encrypted Connections Between Service Endpoints</h3><p>Communication between services should be encrypted, regardless of whether those services are located in the same cluster, different cloud regions, or on-premises environments.</p><p>Encryption protects data in transit and helps preserve communication integrity.</p><p>However, encryption alone does not establish whether the communicating service is authorized.</p><h3>ID-SEG-REC-2: Service Authentication</h3><p>Each service should present a short-lived, cryptographically verifiable identity credential.</p><p>Mutual TLS (mTLS) is one mechanism for authenticating both endpoints when a connection is established.</p><p>Unlike ordinary one-way TLS authentication, mTLS enables both participating services to verify each other’s identities.</p><p>Authentication at connection establishment can be combined with certificate rotation and limits on connection lifetime.</p><h3>ID-SEG-REC-3: Service-to-Service Authorization</h3><p>After authenticating a workload, the system must determine whether that workload is authorized to access the requested service.</p><p>For example, a verified frontend identity might be allowed to execute</p><pre>GET /orders</pre><p>but prohibited from executing</p><pre>DELETE /orders</pre><p>A valid identity does not automatically grant unrestricted access.</p><p>Granular policies can be enforced by service-mesh proxies or evaluated through external authorization systems when additional context is required.</p><h3>ID-SEG-REC-4: End-User Authentication</h3><p>Service identity and user identity represent two different security concerns.</p><p>Consider the following request:</p><pre>Alice<br> |<br> v<br>Frontend Service<br> |<br> v<br>Orders Service</pre><p>The backend may need to verify both the identity of the calling frontend service and the identity of Alice, the end user initiating the operation.</p><p>User authentication can rely on an Identity and Access Management (IAM) system and cryptographically verifiable tokens, such as JSON Web Tokens (JWTs).</p><p>NIST also emphasizes strong authentication mechanisms, including phishing-resistant multi-factor authentication.</p><h3>ID-SEG-REC-5: End-User-to-Resource Authorization</h3><p>Even after Alice has been authenticated, the backend must determine whether she is permitted to access a particular resource.</p><p>For example:</p><pre>User: Alice<br>Request: GET /orders/123</pre><p>A valid JWT does not necessarily mean that Alice is allowed to retrieve order <em>123</em>.</p><p>The application or an authorization service must verify her permissions against the requested resource.</p><p>This distinction separates authentication from authorization and service identity from user identity.</p><blockquote>Multi-Tier Policies: Combining Different Security Controls</blockquote><p>NIST does not propose replacing all network security controls with identity-based policies.</p><p>Instead, it recommends combining multiple policy layers.</p><blockquote>Network Tier: Which Endpoints Can Communicate?</blockquote><p>Network-Tier policies control connectivity between network elements.</p><p>In Kubernetes, a CiliumNetworkPolicy can restrict access to a backend service by allowing connections only from workloads carrying specific labels.</p><p>For example:</p><pre>frontend → backend:8080 ALLOW<br>unknown → backend:8080 DENY</pre><p>The policy controls communication paths, but a basic Layer 3/4 restriction does not determine which HTTP methods may be executed.</p><blockquote>Identity Tier: Who Is Calling?</blockquote><p>Identity-Tier policies evaluate access based on the authenticated identity of the caller and the target service.</p><p>For example:</p><pre>Identity: frontend-service<br>Target: orders-service<br>GET /orders ALLOW<br>DELETE /orders DENY</pre><p>Such controls require the appropriate identity verification and application-aware enforcement mechanisms.</p><blockquote>Application Tier: Can the User Access This Resource?</blockquote><p>Application-Tier controls can evaluate request content and application-specific rules.</p><p>For example, an orders service may determine whether Alice owns a particular order.</p><pre>User: Alice<br>Resource: Order 123<br>Owner: Bob<br>Decision: DENY</pre><p>Network access, workload authentication, and user authentication may all succeed while the final application-level authorization is denied.</p><p>Acknowledges application-tier policies, although detailed application-payload controls are outside the primary scope of the publication.</p><p>The three layers therefore address complementary questions:</p><ul><li><strong>Network Tier:</strong> Can the endpoints communicate?</li><li><strong>Identity Tier:</strong> Is the caller authenticated and authorized to perform the requested operation?</li><li><strong>Application Tier:</strong> Does the request satisfy application-specific security and business rules?</li></ul><p>Once policies are defined, an architecture must determine how they are evaluated and enforced.</p><p>Three components describe these responsibilities.</p><h4>Policy Decision Point (PDP)</h4><p>The PDP evaluates authorization rules and determines whether access should be granted.</p><p>A decision may depend on the caller’s identity, the requested operation, the target resource, and additional context.</p><p>Open Policy Agent (OPA), for example, can serve as an external policy decision engine.</p><h4>Policy Administration Point (PAP)</h4><p>The PAP manages the application of policy decisions and the configuration of enforcement components.</p><p>In the service-mesh architecture described by NIST, the mesh control plane performs the policy administration role, distributing policy configurations to proxies.</p><h4>Policy Enforcement Point (PEP)</h4><p>The PEP applies the security decision to actual traffic.</p><p>An Envoy proxy, for example, can reject an unauthorized HTTP request before forwarding it to the destination service.</p><p>A simplified architecture is:</p><pre>Policy Definition<br> |<br> v<br>PDP<br>Policy Evaluation<br> |<br> v<br>PAP<br>Policy Administration<br> |<br> v<br>PEP<br>Policy Enforcement<br> |<br> v<br>Protected Service</pre><p>This diagram represents logical responsibilities rather than a mandatory runtime sequence.</p><p>In practice, a PEP may evaluate policies locally using configuration already distributed by the control plane, without consulting a remote PDP for every request.</p><p>The essential distinction remains:</p><blockquote>A PDP determines an authorization decision, a PAP administers its application, and a PEP enforces the resulting controls.</blockquote><p>Identity-based security depends on the ability to identify workloads reliably.</p><p>Kubernetes provides namespaces, labels, and ServiceAccounts to organize applications and define their relationships with the Kubernetes API.</p><p>However, these mechanisms do not automatically establish a portable cryptographic identity for every service-to-service connection.</p><p>This is where SPIFFE and SPIRE become relevant.</p><h4>SPIFFE: A Standard for Workload Identity</h4><p>SPIFFE stands for <strong>Secure Production Identity Framework For Everyone</strong>.</p><p>It defines a framework for assigning and verifying workload identities independently of their network locations.</p><p>A workload can be identified through a SPIFFE ID:</p><pre>spiffe://prod.example.org/ns/frontend/sa/frontend-sa</pre><p>The identifier consists of a trust domain and a workload-specific path.</p><p>In this example:</p><pre>Trust Domain:<br> prod.example.org<br>Workload Path:<br> /ns/frontend/sa/frontend-sa</pre><p>The path follows a convention incorporating a Kubernetes namespace and ServiceAccount. SPIFFE does not require every implementation to use this naming structure.</p><p>The SPIFFE ID identifies the workload, but the identifier alone is not proof of identity.</p><h4>SVID: Cryptographically Verifiable Identity</h4><p>A SPIFFE Verifiable Identity Document (SVID) provides the cryptographic material needed to prove a workload’s identity.</p><p>SPIFFE supports X.509-SVIDs and JWT-SVIDs.</p><p>An X.509-SVID can be used in an mTLS connection, allowing services to authenticate using verifiable credentials rather than relying on IP addresses or self-declared names.</p><p>A trust bundle provides the public cryptographic material necessary to verify credentials issued within the relevant trust domain.</p><p>Authentication still needs to be followed by authorization.</p><h4>SPIRE: Issuing and Managing Workload Identities</h4><p><strong>SPIRE </strong>stands for <strong><em>SPIFFE Runtime Environment</em></strong>.</p><p>It is an implementation of SPIFFE that performs node and workload attestation and issues verifiable identity documents.</p><p>A typical SPIRE deployment contains:</p><ul><li>A SPIRE Server, responsible for managing identities, registration entries, and signing operations.</li><li>SPIRE Agents, running on nodes and identifying workloads through configured attestation mechanisms.</li><li>The SPIFFE Workload API, through which workloads can obtain identity documents and trust material.</li></ul><p>Workload attestation involves collecting attributes about a running process and comparing them against configured registration criteria.</p><p>In Kubernetes, these attributes may include information associated with the workload’s namespace and ServiceAccount.</p><p>Once the workload is successfully identified, SPIRE can provide the corresponding SVID.</p><p>This enables a workload to establish a cryptographically verifiable identity without requiring a manually distributed, long-lived application secret.</p><p><strong>Trust Domains Are Not Kubernetes Namespaces!!!</strong></p><p>A trust domain defines a security boundary associated with an authority responsible for issuing verifiable identities.</p><p>Consider a Kubernetes cluster with three namespaces:</p><pre>Kubernetes Cluster<br>|<br>| - frontend<br>| - backend<br>| - monitoring</pre><p>These namespaces can share a single SPIFFE trust domain:</p><pre>Trust Domain:<br> prod.example.org</pre><p>For example:</p><pre>spiffe://prod.example.org/ns/frontend/sa/frontend-sa<br>spiffe://prod.example.org/ns/backend/sa/backend-sa<br>spiffe://prod.example.org/ns/monitoring/sa/monitor-sa</pre><p>All three identities belong to the same trust domain while remaining distinguishable through their workload-specific paths.</p><blockquote>A separate trust domain is not required for every Kubernetes namespace or every cluster.</blockquote><p>The appropriate boundary depends on the organization’s security requirements, administrative responsibilities, and identity infrastructure.</p><p>Different clusters may share a trust domain when they operate under the same intended trust authority.</p><p>Conversely, development and production environments may benefit from separate trust domains because their security practices and risk profiles differ.</p><p><strong>Sharing a trust domain also does not imply that every workload within it should be authorized to communicate with every other workload.</strong></p><p><strong>Trust establishes the basis for verifying identity. Authorization policies still determine access.</strong></p><p>Cloud-native applications operate in environments where workloads are continuously created, destroyed, moved, and scaled.</p><p>Their network locations are temporary, while their logical responsibilities often remain stable.</p><p>Zero Trust addresses this reality by making identity and authorization central to security decisions.</p><p>Network policies remain necessary, but they are no longer sufficient on their own.</p><p>Control planes distribute security configurations, data planes enforce them, and policy engines evaluate access requirements. Service meshes and gateways provide enforcement capabilities, while frameworks such as SPIFFE and SPIRE establish cryptographically verifiable workload identities.</p><p>The result is a layered security model in which connectivity, authentication, and authorization are treated as distinct but complementary responsibilities.</p><blockquote>Network location determines where a service can be reached. Verified identity helps establish who the service is. Authorization determines what it is allowed to do.</blockquote><p>This distinction is fundamental to building Zero Trust architectures for Kubernetes and distributed microservices.</p><p>— — — —</p><p>References</p><p>1. <strong>NIST SP 800–207 — Zero Trust Architecture</strong> (2020) <br> <a href="https://doi.org/10.6028/NIST.SP.800-207">https://doi.org/10.6028/NIST.SP.800-207</a></p><p>2. <strong>NIST SP 800–207A — A Zero Trust Architecture Model for Access Control in Cloud-Native Applications in Multi-Location Environments</strong> (2023) <br> <a href="https://doi.org/10.6028/NIST.SP.800-207A">https://doi.org/10.6028/NIST.SP.800-207A</a></p><p>3. <strong>SPIFFE — Concepts</strong><br> <a href="https://spiffe.io/docs/latest/spiffe-about/spiffe-concepts/">https://spiffe.io/docs/latest/spiffe-about/spiffe-concepts/</a></p><p>4. <strong>SPIFFE — SPIFFE ID and Verifiable Identity Document Specification</strong> <br> <a href="https://spiffe.io/docs/latest/spiffe-specs/spiffe-id/">https://spiffe.io/docs/latest/spiffe-specs/spiffe-id/</a></p><p>5. <strong>SPIFFE — Trust Domain and Bundle Specification</strong> <br> <a href="https://spiffe.io/docs/latest/spiffe-specs/spiffe_trust_domain_and_bundle/">https://spiffe.io/docs/latest/spiffe-specs/spiffe_trust_domain_and_bundle/</a></p><p>6. <strong>SPIRE — Architecture and Concepts</strong> <br> <a href="https://spiffe.io/docs/latest/spire-about/spire-concepts/">https://spiffe.io/docs/latest/spire-about/spire-concepts/</a></p><p>7. <strong>Kubernetes — Network Policies</strong><br> <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/">https://kubernetes.io/docs/concepts/services-networking/network-policies/</a></p><p>8. <strong>Cilium — Network Policy Documentation</strong> <br> <a href="https://docs.cilium.io/en/stable/security/policy/">https://docs.cilium.io/en/stable/security/policy/</a></p><p>9. <strong>Istio — Authorization Policy</strong><br> <a href="https://istio.io/latest/docs/reference/config/security/authorization-policy/">https://istio.io/latest/docs/reference/config/security/authorization-policy/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f9297b74ad7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Back-to-School: The TCP Learning Cycle with Go, curl, and tcpdump]]></title>
            <link>https://medium.com/@graziagdamico/back-to-school-the-tcp-learning-cycle-with-go-curl-and-tcpdump-6b16d3101179?source=rss-163019bd51fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b16d3101179</guid>
            <dc:creator><![CDATA[Grazia D'Amico]]></dc:creator>
            <pubDate>Wed, 21 Oct 2026 08:05:00 GMT</pubDate>
            <atom:updated>2026-10-21T08:05:00.362Z</atom:updated>
            <content:encoded><![CDATA[<p>When we open a website, we usually think of it as a simple operation: type a URL, press Enter, and wait for the page to load.</p><p>But what actually happens between pressing Enter and receiving a response?</p><p>To find out, let’s start small.</p><p>Our TCP connection needs two things to get started: a server waiting for a connection and a client ready to establish one.</p><p>We’ll build both in Go and run them on our own machine. The server will listen on a TCP port, while the client will connect to it and send a message.</p><p>Before we begin, let’s keep three important ideas in mind:</p><ul><li><strong>TCP carries bytes.</strong> It establishes a connection and provides a reliable, ordered stream of bytes. It doesn’t know whether those bytes represent a message, a web page, or an HTTP request.</li><li><strong>HTTP gives those bytes meaning.</strong> It defines how clients and servers structure requests and responses, so both sides understand what they’re sending and receiving.</li><li><strong>HTTPS protects the conversation.</strong> It uses TLS to encrypt HTTP traffic and authenticate the server. This means that when we inspect packets with tcpdump, we can still observe network-level details, but the HTTP content is generally encrypted and cannot be read directly.</li></ul><p>We’ll explore these differences step by step, starting with a simple TCP connection and gradually moving toward a real HTTPS request.</p><p>We’ll start by creating a simple TCP server in Go.</p><p>Note:<br>- <strong>fmt</strong> lets us print messages to the terminal.<br>- <strong>net</strong> provides networking functionality, including TCP connections and servers.</p><p>What’s a listener? It’s the part of the program that waits for incoming connection requests. It doesn’t yet mean a client is connected.</p><p><strong>A note about error handling in Go:</strong> Go commonly returns errors explicitly as values, rather than throwing exceptions automatically.</p><pre>package main<br><br>import (<br>    &quot;fmt&quot;<br>    &quot;net&quot;<br>)<br><br>func main() {<br>    listener, err := net.Listen(&quot;tcp&quot;, &quot;:8080&quot;)<br>    if err != nil {<br>        panic(err)<br>    }<br>    defer listener.Close() // schedules the listener to close when main() finishes.<br><br>    fmt.Println(&quot;Server is listening on port 8080...&quot;)<br><br>    conn, err := listener.Accept() // blocks until a client connects or an error occurs.<br>    // When a client connects, Go returns a `conn` object representing that connection. It lets us communicate with that specific client.<br>    if err != nil {<br>        panic(err)<br>    }<br>    defer conn.Close()<br><br>    fmt.Println(&quot;Client connected:&quot;, conn.RemoteAddr()) // returns the remote network address of the connected client, including its IP address and port.<br>}</pre><p>save the code in tcp_server.go and run it with:</p><pre>go run tcp_server.go</pre><p>you should see</p><pre>Server is listening on port 8080...</pre><p>At this point, the program is listening for incoming connections.</p><p>The call to Accept() blocks until a client connects.</p><p>In another terminal, run:</p><pre>nc localhost 8080</pre><p>The server should display a client address similar to:</p><pre>Client connected: 127.0.0.1:33020</pre><p>The two ports have different roles:</p><ul><li>8080 is the server&#39;s listening port.</li><li>33020 is an ephemeral client port selected for that connection.</li></ul><p>The client needs a local port so that the operating system can distinguish this connection from other network connections.</p><p>One important detail: this example accepts only one connection. Once the program finishes, the listener closes. A production server would normally continue accepting connections.</p><p>So far, our server can accept a connection, but it cannot exchange data with the client.</p><p>To enable data exchange, we create a buffer because TCP sends data as bytes, not as Go strings. The buffer provides a place to store the bytes received from the client.</p><p>After reading the client’s message, we send a response back to demonstrate two-way communication.</p><pre>package main<br><br>import (<br>    &quot;fmt&quot;<br>    &quot;net&quot;<br>)<br><br>func main() {<br>    listener, err := net.Listen(&quot;tcp&quot;, &quot;:8080&quot;)<br>    if err != nil {<br>        panic(err)<br>    }<br>    defer listener.Close()<br><br>    fmt.Println(&quot;Server is listening on port 8080...&quot;)<br><br>    conn, err := listener.Accept()<br>    if err != nil {<br>        panic(err)<br>    }<br>    defer conn.Close()<br><br>    fmt.Println(&quot;Client connected:&quot;, conn.RemoteAddr())<br><br>    buffer := make([]byte, 1024)<br><br>    n, err := conn.Read(buffer)<br>    if err != nil {<br>        panic(err)<br>    }<br><br>    fmt.Println(&quot;Received message:&quot;, string(buffer[:n]))<br><br>    response := &quot;Hello from the server!&quot;<br>    _, err = conn.Write([]byte(response))<br>    if err != nil {<br>        panic(err)<br>    }<br>}</pre><p>Now we can run tcp_server.go and, in another terminal, run:</p><pre>nc localhost 8080</pre><p>Then type:</p><pre>hello</pre><p>The client should display a response similar to:</p><pre>Hello from the server!</pre><p>We now have a complete client-server exchange.</p><p>However, remember that TCP doesn’t define what the bytes mean.</p><p>TCP provides a reliable, ordered byte stream. It doesn’t know whether the bytes represent a greeting, a JSON document, a database query, or an HTTP request.</p><p>The application protocol defines how those bytes should be interpreted.</p><p>There is another subtlety: TCP is a stream, not a message-oriented protocol. A single call to Read() isn&#39;t guaranteed to return a complete application message. Our example works for a simple demonstration, but real protocols need a way to determine message boundaries, such as a length prefix, a delimiter, or a defined message format.</p><h3>Watch the TCP handshake with tcpdump</h3><p>So, what happens beneath the Go code? We can use tcpdump to observe the network traffic:</p><pre>sudo tcpdump -i lo -nn &#39;tcp port 8080&#39;</pre><p>The options mean:</p><ul><li>-i lo captures traffic on the loopback interface.</li><li>-nn prevents name and port-number resolution.</li><li>&#39;tcp port 8080&#39; filters traffic to TCP port 8080.</li></ul><p>Here is a simplified version of the outputs:</p><pre>127.0.0.1.34612 &gt; 127.0.0.1.8080: Flags [S] — The client initiates the connection.<br>127.0.0.1.8080 &gt; 127.0.0.1.34612: Flags [S.] — The server responds with SYN-ACK.<br>127.0.0.1.34612 &gt; 127.0.0.1.8080: Flags [.] — The client acknowledges the server.</pre><p>These three packets represent the TCP three-way handshake.</p><p><strong>First: SYN</strong></p><p>The client sends a SYN packet to initiate the connection.</p><p><strong>Second: SYN-ACK</strong></p><p>The server responds with SYN and ACK. It acknowledges the client’s initial sequence number and provides its own initial sequence number.</p><p><strong>Third: ACK</strong></p><p>The client acknowledges the server’s sequence number.</p><p>The TCP connection is now established.</p><p>The flags shown by <strong>tcpdump</strong> provide clues about what is happening on the connection.</p><p>[S]SYN: initiates a connection.</p><p>[S.]SYN + ACK: acknowledges the SYN and sends the server&#39;s SYN.</p><p>[.]ACK: acknowledges received data or control information.</p><p>[P.]PSH + ACK: carries data with the push flag set.</p><p>[F.]FIN + ACK: acknowledges data and indicates that the sender is closing its sending direction.</p><p>[R]RST: resets a connection or indicates that a connection cannot be established.</p><p>The PSH flag is worth understanding carefully. It encourages data to be delivered to the receiving application promptly, but it doesn’t mark the end of a message or guarantee that one <em>Read()</em> call will receive the complete message.</p><p>Similarly, FIN doesn’t necessarily close both directions immediately. TCP supports half-closed connections, where one side has finished sending but can still receive data.</p><p>These flags describe TCP control information, not the meaning of the application data.</p><p>After the handshake a client sending six bytes example:</p><pre>Flags [P.], seq 1:7, ack 1, length 6</pre><p>Those six bytes were hello\n: the five letters plus the newline character.</p><p>In this exampletcpdump annotated some payloads with HTTP. However, that label did not mean TCP application was speaking HTTP. The payload was still just hello\n or Hello from the server!\n.</p><p>To investigate the next layer, we need to create a real HTTP server.</p><h3>Move from raw TCP to HTTP</h3><p>Go provides the net/http package, which implements HTTP handling for us.</p><p>We need a separate file, http_server.go:</p><pre>package main<br><br>import (<br>    &quot;fmt&quot;<br>    &quot;net/http&quot;<br>)<br><br>func main() {<br>    http.HandleFunc(&quot;/&quot;, func(w http.ResponseWriter, r *http.Request) {<br>        fmt.Fprintln(w, &quot;Hello from HTTP!&quot;)<br>    })<br><br>    fmt.Println(&quot;HTTP server listening on :8080&quot;)<br>    err := http.ListenAndServe(&quot;:8080&quot;, nil)<br>    if err != nil {<br>        panic(err)<br>    }<br>}</pre><p>http.HandleFunc() registers a function to handle HTTP requests for the / path.</p><p>The function takes two arguments:</p><ul><li>w http.ResponseWriter lets us write the HTTP response back to the client.</li><li>r *http.Request contains information about the incoming HTTP request, such as its method, URL, and headers.</li></ul><p>fmt.Fprintln(w, &quot;Hello from HTTP!&quot;) writes Hello from HTTP! to the response body, followed by a newline.</p><p>Unlike our raw TCP server, we don’t need to read the incoming bytes and interpret them ourselves. Go’s net/http package parses the HTTP request and provides its information through r parameter.</p><p>http.ListenAndServe(&quot;:8080&quot;, nil) starts an HTTP server listening on port 8080.</p><p>The first argument specifies the address and port to listen on. Here, :8080 means port 8080 on the machine&#39;s available network interfaces.</p><p>The second argument, nil, tells Go to use the default HTTP request multiplexer, which routes requests to the handlers registered with functions such as http.HandleFunc().</p><p>ListenAndServe() keeps the server running and handles incoming HTTP requests. If it returns an error, the if statement checks it, and panic(err) terminates the program.</p><p><strong>What has changed compared with raw TCP?</strong></p><p>With our raw TCP server, we accepted a connection, read bytes into a buffer, and wrote a response manually.</p><p>With net/http, Go parses the HTTP request, invokes the appropriate handler, and constructs the HTTP response.</p><p>TCP still transports the data. HTTP defines how that data is structured as requests and responses.</p><p>Start the server:</p><pre>go run http_server.go</pre><p>Then, in another terminal, ran:</p><pre>curl -v http://localhost:8080/</pre><pre>sudo tcpdump -i lo -nn -A &#39;tcp port 8080&#39;</pre><p>The -A option attempts to display packet payloads as ASCII text. Because this request uses unencrypted HTTP, the request and response contents should be readable.</p><p>The captured request may resemble:</p><pre>GET / HTTP/1.1<br>Host: localhost:8080<br>User-Agent: curl/8.5.0<br>Accept: */*</pre><p>The exact headers can vary depending on the version of curl and its configuration.</p><p>The server’s response may look like this:</p><pre>HTTP/1.1 200 OK<br>Date: Fri, 09 Oct 2026 09:43:43 GMT<br>Content-Length: 17<br>Content-Type: text/plain; charset=utf-8</pre><pre>Hello from HTTP!</pre><p>The date and other response details may differ. The body shown above includes a trailing newline.</p><p>200 OK indicated that the request was successful. Content-Type described the body as plain text, and Content-Length: 17 specified the number of bytes in the response body, including the newline added by fmt.Fprintln().</p><p>The HTTP server used TCP underneath, but the application was no longer exchanging arbitrary bytes without an agreed structure. It was exchanging requests and responses according to HTTP’s rules.</p><h3>Follow an HTTPS request to example.com</h3><p>So far, our HTTP traffic has been unencrypted. Let’s now examine a request to a public HTTPS website.</p><p>Run:</p><pre>curl -v https://example.com/</pre><p><strong>1. DNS resolution</strong></p><p>Curl resolves example.com to IP addresses and selects one to connect to. DNS provides address information, but the selected address may belong to a CDN or reverse proxy rather than the origin server.</p><p><strong>2. TCP connection</strong></p><p>For HTTPS over TCP, the client establishes a TCP connection to port 443.</p><p><strong>3. TLS handshake</strong></p><p>The client and server negotiate TLS parameters, establish encryption keys, and authenticate the server using its certificate. Successful certificate verification confirms that the certificate is trusted and valid for the requested hostname.</p><p><strong>4. Application protocol negotiation</strong></p><p>Curl may report:</p><pre>ALPN: curl offers h2,http/1.1<br>ALPN: server accepted h2<br>using HTTP/2</pre><p>ALPN (Application-Layer Protocol Negotiation) allows the client and server to select an application protocol during the TLS handshake. Here, they selected HTTP/2.</p><p>HTTP/2 uses binary frames rather than HTTP/1.1’s plain-text request lines. Curl displays the logical request fields in a readable format:</p><pre>:method: GET<br>:scheme: https<br>:authority: example.com<br>:path: /</pre><p><strong>5. HTTP response</strong></p><p>The server returns an HTTP response, potentially through a CDN or reverse proxy. Response headers such as server, age, and cf-cache-status can provide clues about caching and intermediary services.</p><p>These headers can provide clues about the software, caching, or intermediary services involved. Their presence alone doesn’t prove the exact route the request took.</p><p>The key point is that HTTPS still uses HTTP at the application layer. TLS protects the communication, while HTTP defines the request and response.</p><h3>Inspect HTTPS traffic with tcpdump</h3><p>Now that we’ve followed an HTTPS request using curl, let&#39;s examine what happens at the network level.</p><p>Earlier, we used tcpdump to inspect an unencrypted HTTP request. By adding the -A option, we could read the HTTP headers and response body directly from the captured packets.</p><p>But what changes when the communication is protected by TLS?</p><p>First, we need to identify the network interface used to reach example.com.</p><p>On Linux, we can check the routing table with:</p><pre>ip route</pre><p>Choose the appropriate network interface. For example, if the route uses eth0, run:</p><pre>sudo tcpdump -i eth0 -nn -s 0 -A &#39;tcp port 443&#39;</pre><p>The options mean:</p><ul><li>-i eth0 captures packets on the selected network interface.</li><li>-nn prevents IP addresses and port numbers from being translated into names.</li><li>-s 0 captures the complete packet rather than truncating it to a smaller snapshot length.</li><li>&#39;tcp port 443&#39; filters TCP traffic using port 443, the default port for HTTPS over TCP.</li></ul><p>keep tcpdump running and, in another terminal, send the HTTPS request:</p><pre>curl -v https://example.com/</pre><p>Unlike plain HTTP, HTTPS application data is encrypted by TLS. The capture can still reveal IP addresses, ports, TCP flags, packet sizes, and timing, but the HTTP headers and body aren’t normally readable in the captured payload.</p><p>Encryption protects the contents of the communication, not the existence of the network connection.</p><h3>Let’s summarize</h3><ol><li><strong>URL:</strong> Identifies the hostname and requested resource.</li><li><strong>DNS:</strong> Resolves the hostname to IP addresses when resolution is needed.</li><li><strong>TCP:</strong> Establishes a transport connection for HTTP/1.1 or HTTP/2 over TCP.</li><li><strong>TLS:</strong> Protects the connection when HTTPS is used.</li><li><strong>HTTP:</strong> Defines the request and response exchanged by the application.</li><li><strong>Intermediaries:</strong> A CDN or reverse proxy may handle the request before it reaches the origin server.</li></ol><p>This is a simplified overview of how a typical HTTPS request works. HTTP/3 takes a different approach by using QUIC instead of TCP. QUIC is a transport protocol built on top of UDP that provides reliable data delivery, supports multiple independent streams, and integrates TLS 1.3 for secure communication. It was designed to reduce connection establishment time and improve performance, particularly on networks experiencing latency or packet loss. Unlike TCP, where a lost packet can delay data delivery across multiple HTTP/2 streams, QUIC allows other streams to continue independently.</p><p>Additionally, DNS caching and connection reuse can eliminate the need to repeat certain steps for every request.</p><p>So, <strong>TCP transports bytes. TLS protects communication. HTTP defines the application request and response. DNS helps the client find an address.</strong></p><p>Once those responsibilities are separated, a web request becomes less mysterious. It’s no longer just a browser loading a page; it’s a sequence of operations that can be observed, measured, and understood.</p><h3>References</h3><ul><li><a href="https://pkg.go.dev/net">Go </a><a href="https://pkg.go.dev/net">net package</a></li><li><a href="https://pkg.go.dev/net/http">Go </a><a href="https://pkg.go.dev/net/http">net/http package</a></li><li><a href="https://www.rfc-editor.org/rfc/rfc9293">RFC 9293 — Transmission Control Protocol (TCP)</a></li><li><a href="https://www.rfc-editor.org/rfc/rfc8446">RFC 8446 — The Transport Layer Security (TLS) Protocol Version 1.3</a></li><li><a href="https://www.rfc-editor.org/rfc/rfc7301">RFC 7301 — TLS Application-Layer Protocol Negotiation (ALPN)</a></li><li><a href="https://www.rfc-editor.org/rfc/rfc9113">RFC 9113 — HTTP/2</a></li><li><a href="https://www.rfc-editor.org/rfc/rfc9000">RFC 9000 — QUIC: A UDP-Based Multiplexed and Secure Transport</a></li><li><a href="https://www.rfc-editor.org/rfc/rfc9001">RFC 9001 — Using TLS to Secure QUIC</a></li><li><a href="https://www.rfc-editor.org/rfc/rfc9114">RFC 9114 — HTTP/3</a></li><li><a href="https://www.rfc-editor.org/rfc/rfc1034">RFC 1034 — Domain Names: Concepts and Facilities</a></li><li><a href="https://man7.org/linux/man-pages/man8/tcpdump.8.html">tcpdump(8) — Linux Manual Page</a></li><li><a href="https://man7.org/linux/man-pages/man8/ip-route.8.html">ip-route(8) — Linux Manual Page</a></li><li><a href="https://everything.curl.dev/">curl — Everything curl</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b16d3101179" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Can Scaling Kubernetes Pods Overload Your Database?]]></title>
            <link>https://medium.com/@graziagdamico/why-can-scaling-kubernetes-pods-overload-your-database-649afd75ed3c?source=rss-163019bd51fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/649afd75ed3c</guid>
            <category><![CDATA[kubernetes-hpa]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[connection-pool]]></category>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[hikaricp]]></category>
            <dc:creator><![CDATA[Grazia D'Amico]]></dc:creator>
            <pubDate>Thu, 24 Sep 2026 08:59:58 GMT</pubDate>
            <atom:updated>2026-09-24T08:59:58.297Z</atom:updated>
            <content:encoded><![CDATA[<p>Horizontal scaling is one of the most familiar ideas in Kubernetes.</p><p>Traffic increases, application Pods become busy, and Kubernetes adds replicas. More Pods mean more application capacity.</p><p>But there is a dependency that does not automatically scale with them: the database.</p><p>If every application Pod maintains its own database connection pool, increasing the number of replicas can also increase the total number of connections opened toward the database.</p><p>To observe this behaviour directly, I built a small Kubernetes lab using Spring Boot, HikariCP, PostgreSQL, and Kind.</p><p>With a connection pool configured to allow up to five connections per Pod, scaling the application produced the following result:</p><pre>1 Pod  →  5 database connections<br>3 Pods → 15 database connections<br>5 Pods → 25 database connections</pre><p>The pattern is straightforward: each new application replica introduces another connection pool. As Kubernetes scales the application horizontally, the potential number of database connections scales with it.</p><p>This means that adding Pods does not only increase application capacity. It also increases the pressure the application can place on a shared database.</p><p>To see why this happens, it helps to look at what Kubernetes actually changes when an application scales horizontally.</p><p>For this purpose, Kubernetes provides the HorizontalPodAutoscaler, which adjusts the number of replicas of a workload according to observed metrics.</p><p>Horizontal scaling means adding more Pods rather than giving additional CPU or memory to the existing ones.</p><p>Kubernetes can make scaling decisions based on metrics such as CPU utilization, memory utilization, or custom metrics.</p><p>Conceptually:</p><pre>Traffic increases<br>        ↓<br>Application load increases<br>        ↓<br>HPA increases replicas<br>        ↓<br>More application Pods</pre><p>This makes sense if the application itself is the bottleneck.</p><p>However, each new application instance can also create additional load on external dependencies.</p><p><strong>A database is one of them</strong>.</p><p>Most applications do not create a new database connection for every query.</p><p>Opening a database connection has a cost, so applications commonly maintain a <strong>connection pool</strong>: a collection of database connections that can be borrowed and reused by incoming requests.</p><p>In this experiment, the Spring Boot application used HikariCP as its database connection pool. Each application instance therefore maintained its own pool of PostgreSQL connections.</p><p>This setup makes the effect of horizontal scaling easy to observe: when Kubernetes creates additional Pods, it also creates additional application instances, each with its own connection pool.</p><p>The relevant HikariCP configuration was:</p><pre>maximum-pool-size: 5<br>minimum-idle: 0<br>connection-timeout: 2000<br>idle-timeout: 60000</pre><p>HikariCP defines maximumPoolSize as the maximum number of connections that can exist in the pool, including both idle and in-use connections. If the pool has reached that limit and no connection is immediately available, a caller waits until a connection is returned to the pool or until connectionTimeout expires.</p><p>In this case, each application instance could therefore maintain up to five database connections.</p><p>With a single Pod, there is a single Spring Boot instance and a single HikariCP pool:</p><pre>Pod A<br>└── HikariCP<br>    └── up to 5 PostgreSQL connections</pre><p>When Kubernetes creates another replica, however, it does not extend the existing connection pool. It starts another instance of the application, and that instance creates a pool of its own.</p><p>With three Pods, the situation becomes:</p><pre>Pod A → up to 5 connections<br>Pod B → up to 5 connections<br>Pod C → up to 5 connections</pre><p>The database does not see one shared pool of five connections. It sees connections coming from three independent application instances, each allowed to open up to five.</p><p>The aggregate upper bound therefore becomes:</p><pre>number of Pods × pool size per Pod</pre><p>With a pool size of five, this gives:</p><pre>1 × 5 = 5<br>3 × 5 = 15<br>5 × 5 = 25</pre><p>Here, <strong>upper bound</strong> means the maximum number of database connections that the application could open under this configuration.</p><p>It does not mean that all of those connections will always exist at the same time. For example, five Pods with a maximumPoolSize of five are allowed to open up to twenty-five connections in total, but they may use fewer if the workload does not require the pools to grow to their maximum size.</p><p>The actual number of open connections therefore depends on the workload and on how the connection pools are being used.</p><p>This distinction becomes important when we look at what happened during the experiment.</p><h3>The experiment</h3><p>The lab used:</p><ul><li>Kubernetes running with Kind</li><li>a Java Spring Boot application</li><li>HikariCP</li><li>PostgreSQL</li><li>one Kubernetes Service in front of the application Pods</li><li>one PostgreSQL instance inside the cluster</li></ul><p>The application exposed two HTTP endpoints that were used to generate different types of database activity.</p><p>When a client sends a request to the Spring Boot application, the application may need to execute a query against PostgreSQL. To do that, it borrows a database connection from its local HikariCP pool, uses that connection for the query, and then returns it to the pool so that it can be reused by another request.</p><p>The first endpoint was:</p><pre>GET /users</pre><p>This endpoint executed a normal query against a small users table. The query completed quickly, so the database connection was held only for a short period of time before being returned to the pool.</p><p>The second endpoint was designed to behave differently:</p><pre>GET /slow</pre><p>When this endpoint received a request, the application executed the following PostgreSQL query:</p><pre>SELECT pg_sleep(3);</pre><p>pg_sleep(3) instructs PostgreSQL to wait for three seconds before completing the query.</p><p>During those three seconds, the Spring Boot request is still waiting for the database operation to finish, and the HikariCP connection used for that query remains in use. It cannot be returned to the pool and reused by another request until the query completes.</p><p>This behaviour was intentionally artificial. The goal was not to simulate a realistic business query, but to create a simple and predictable way to keep database connections occupied long enough to observe what happens when several requests arrive at the same time.</p><p>HikariCP was configured with:</p><pre>maximumPoolSize = 5<br>minimumIdle     = 0</pre><p>Using minimumIdle=0 was useful for the experiment because the application could start with zero database connections and create them only when demand appeared.</p><p>PostgreSQL was configured with:</p><pre>max_connections = 40</pre><p>PostgreSQL defines max_connections as the maximum number of concurrent connections allowed to the server. Its documentation also notes that some resources are sized directly according to this value and that increasing it causes additional resource allocation, including shared memory.</p><p>For each test, the same load was generated:</p><pre>50 concurrent workers<br>20 requests per worker<br>1000 requests in total</pre><p>The application was then tested with:</p><pre>1 Pod<br>3 Pods<br>5 Pods</pre><p>Before every test, previous idle connections were allowed to disappear so that each experiment started with zero application connections.</p><p>The observed results were:</p><pre>| Application Pods | Theoretical   | Observed DB | Successful | Failed   |<br>|                  | pool capacity | connections | requests   | requests |<br>| ---------------: | ------------: | ----------: | ---------: | -------: |<br>|                1 |             5 |           5 |        100 |      900 |<br>|                3 |            15 |          15 |        292 |      708 |<br>|                5 |            25 |          25 |        519 |      481 |</pre><p>Under the same load, every configuration eventually reached the aggregate connection-pool ceiling.</p><p>With one application Pod, only five database connections were available.</p><p>Once those five connections were in use, additional requests had to wait for a connection to become available. Because the HikariCP connectionTimeout was configured to two seconds while the /slow query kept each connection occupied for three seconds, many waiting requests timed out before they could obtain a connection.</p><p>When the application was scaled to three Pods, Kubernetes started three independent application instances. Each instance had its own HikariCP pool of five connections, increasing the aggregate application-side capacity to fifteen connections.</p><p>The same pattern appeared again with five Pods, where the aggregate pool capacity reached twenty-five connections.</p><p>The PostgreSQL observations matched these theoretical limits: five, fifteen, and twenty-five open connections respectively.</p><p>As the number of Pods increased, more requests could therefore hold database connections at the same time, and the number of successful requests increased from 100 to 292 and then to 519.</p><p>What is interesting, however, is that the number of successful requests did <strong>not increase perfectly linearly</strong>.</p><p>Increasing the number of available connections from five to fifteen tripled the theoretical connection capacity, but successful requests increased from 100 to 292 rather than exactly 300. Increasing the capacity again to twenty-five connections resulted in 519 successful requests rather than the 500 that a simple proportional relationship might suggest.</p><p>This is because connection capacity is only one part of the system. The outcome also depends on when requests arrive, how they are distributed among Pods, how long connections remain occupied, and whether waiting requests reach the configured timeout before a connection becomes available.</p><p>The experiment therefore does not show a fixed relationship between the number of Pods and the number of successful requests. It shows that horizontal scaling increases the number of database connections the application can use concurrently, which in turn gives more requests an opportunity to complete.</p><p>At the same time, those additional connections are all directed toward the same PostgreSQL instance. Kubernetes is increasing the concurrency of the application, not the capacity of the database itself.</p><p>The application logs show what this looked like from inside a Pod when its local HikariCP pool became exhausted.</p><p>One timeout reported:</p><pre>Connection is not available,<br>request timed out after 2000ms<br>(total=5, active=5, idle=0, waiting=42)</pre><p>This single message describes the state of the pool at that moment.</p><p>total=5 means that the pool had already reached its configured maximum size of five connections.</p><p>active=5 means that all five connections were currently being used by application requests, while idle=0 confirms that none was immediately available for reuse.</p><p>At the same time, waiting=42 means that forty-two other application threads were waiting for a connection to become available.</p><p>Because the pool could not grow beyond five connections, those waiting requests had only two possibilities: obtain a connection when another request released one, or exceed the configured two-second connectionTimeout and fail.</p><p>This is what <strong>application-side connection-pool saturation</strong> looks like: the application has more concurrent work than its local database connection pool can serve.</p><p>It is important, however, not to confuse this with database overload.</p><p>The timeout tells us that the application could not obtain a connection from HikariCP within the configured time. It does not, by itself, tell us that PostgreSQL had exhausted its own connection capacity or was unable to process more work.</p><p>These are two different limits: one belongs to the application connection pool, the other to the database itself.</p><p>Adding Pods reduced request failures:</p><pre>1 Pod  → 900 failed requests<br>3 Pods → 708 failed requests<br>5 Pods → 481 failed requests</pre><p>That makes sense.</p><p>With one Pod, at most five database connections were available to service the workload.</p><p>With five Pods, there were potentially twenty-five.</p><p>More requests could therefore obtain a connection instead of timing out.</p><p>But that improvement came with another effect:</p><pre>5 PostgreSQL connections<br>        ↓<br>15 PostgreSQL connections<br>        ↓<br>25 PostgreSQL connections</pre><p>Scaling reduced contention in the application while increasing the number of database connections.</p><p>That is the trade-off we are interested in.</p><p>Another useful observation was the difference between <strong>active</strong> and <strong>idle</strong> connections.</p><p>During the five-Pod test, PostgreSQL reported:</p><pre>25 total connections<br>23 active<br>2 idle</pre><p>Immediately after the load finished:</p><pre>25 total connections<br>0 active<br>25 idle</pre><p>So the requests had completed, but the connection pools did not immediately close their database connections.</p><p>They kept them available for reuse.</p><p>Later, after the configured idle period, the application connection count returned to zero.</p><p>This also shows why:</p><blockquote><em>“Five Pods with a pool size of five”</em></blockquote><p>does not always mean:</p><blockquote><em>“PostgreSQL currently has twenty-five connections.”</em></blockquote><p>It means the application has an aggregate capacity of <strong>up to twenty-five connections</strong>.</p><p>The actual number depends on demand and pool configuration.</p><p>In our experiment, PostgreSQL was configured for forty connections and the application reached twenty-five.</p><p>So PostgreSQL itself still had headroom.</p><p>But imagine changing only one parameter:</p><pre>5 Pods × pool size 5<br>= 25 potential connections</pre><p>Now suppose the HPA is allowed to scale the application to twenty Pods:</p><pre>20 × 5<br>= 100 potential connections</pre><p>Or fifty:</p><pre>50 × 5<br>= 250 potential connections</pre><p>The application can scale horizontally much faster than a single database instance changes capacity.</p><p>PostgreSQL also does not treat connections as abstract, free objects.</p><p>Its client/server model creates a backend process when a connection is established; once connected, the client sends queries to that backend, which parses and executes them and sends the results back.</p><p>So the relationship becomes:</p><pre>More Pods<br>   ↓<br>More independent connection pools<br>   ↓<br>More possible database connections<br>   ↓<br>More pressure on a fixed database</pre><p>At some point, <strong>the bottleneck may simply move</strong>.</p><p>The application layer becomes healthier while the database becomes the constrained component.</p><p>This is the most important lesson from the experiment.</p><p>An autoscaler can observe that application Pods are overloaded and correctly decide to create more replicas.</p><p>From Kubernetes’ perspective, that may be exactly the right action.</p><p>But Kubernetes does not automatically know that:</p><p><em>one new Pod</em></p><p>also means:</p><p><em>one new connection pool</em></p><p>and potentially:</p><p><em>five additional database connections</em></p><p>in this configuration.</p><p>If an application is allowed to scale from 5 to 50 replicas, a per-Pod pool configuration should not be evaluated in isolation.</p><p>A useful first approximation is:</p><pre>maximum potential DB connections<br>≈<br>maximum application replicas × maximum pool size per replica</pre><p>This is not a complete database-capacity formula.</p><p>It is simply a useful way to expose a dependency that is easy to miss.</p><p>The experiment did <strong>not</strong> demonstrate PostgreSQL overload.</p><p>That distinction matters because the title asks why scaling Pods <strong>can</strong> overload a database, not whether twenty-five connections necessarily overload one.</p><p>In this lab:</p><pre>PostgreSQL max_connections = 40<br>maximum application connections observed = 25</pre><p>We also did not measure:</p><ul><li>PostgreSQL CPU saturation</li><li>disk I/O saturation</li><li>memory pressure</li><li>lock contention</li><li>production query latency</li><li>maximum sustainable throughput</li></ul><p>The workload itself was deliberately artificial: pg_sleep(3) holds a connection but performs very little database work.</p><p>The experiment was also performed on a local single-node Kind cluster and only one run was performed for each replica count.</p><p>It should therefore not be interpreted as a PostgreSQL benchmark.</p><p>What it <strong>does</strong> demonstrate is much narrower and more useful:</p><blockquote><em>increasing the number of application Pods increased the number of independent connection pools and, under sufficient demand, increased the number of database connections from 5 to 15 to 25.</em></blockquote><p>That mechanism is enough to explain why database capacity must be considered when scaling an application horizontally.</p><p>Horizontal scaling does not happen in isolation.</p><p>In our experiment:</p><pre>More Pods<br>→ more HikariCP pools<br>→ more available database connections<br>→ fewer application-side connection timeouts<br>→ more PostgreSQL connection slots consumed</pre><p>Scaling improved one part of the system while increasing pressure on another.</p><p>That is why the question:</p><blockquote><em>“How many connections should one Pod have?”</em></blockquote><p>is incomplete.</p><p>A better question is:</p><blockquote><em>“How many connections can the entire deployment create when it reaches its maximum number of replicas?”</em></blockquote><p>When configuring Kubernetes autoscaling, connection pools and database capacity need to be considered together.</p><p>Otherwise, scaling may not eliminate the bottleneck.</p><p>It may simply move it.</p><h3>References</h3><ol><li><strong>Kubernetes Documentation — Horizontal Pod Autoscaling.</strong><br>Used for the behavior of horizontal scaling and HPA metrics.</li><li><strong>HikariCP — Official Configuration Documentation.</strong><br>Used for maximumPoolSize, minimumIdle, connectionTimeout, and connection-pool behavior when no idle connections are available.</li><li><strong>PostgreSQL 18 Documentation — Connections and Authentication, Connection Settings.</strong><br>Used for max_connections and its relationship with PostgreSQL resource allocation.</li><li><strong>PostgreSQL 18 Documentation — How Connections Are Established.</strong><br>Used for PostgreSQL’s client/server and backend-process connection model.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=649afd75ed3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker, containerd, and Kubernetes: What Happened After the Removal of dockershim?]]></title>
            <link>https://medium.com/@graziagdamico/docker-containerd-and-kubernetes-what-happened-after-the-removal-of-dockershim-217da56302ba?source=rss-163019bd51fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/217da56302ba</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[dockershim]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[containerd]]></category>
            <dc:creator><![CDATA[Grazia D'Amico]]></dc:creator>
            <pubDate>Tue, 22 Sep 2026 12:21:59 GMT</pubDate>
            <atom:updated>2026-09-22T12:21:59.596Z</atom:updated>
            <content:encoded><![CDATA[<p>What is the relationship between Docker, containerd, and Kubernetes today?</p><p>This question is less straightforward than it may seem. Docker is still widely used to build and run containers, containerd is part of the Docker stack, and Kubernetes commonly uses containerd as a container runtime. At the same time, Kubernetes removed <em>dockershim</em> in version 1.24, a change that was often summarized as “Kubernetes is dropping Docker.”</p><p>That description, however, hides what actually changed.</p><p>The removal of dockershim did not make Docker images incompatible with Kubernetes, nor did it mean that Docker stopped being useful to developers. The real change happened in the architecture between the Kubernetes <em>kubelet</em> and the container runtime. To understand it, we first need to distinguish the components involved:</p><p>- A <strong>container runtime</strong> is the software responsible for executing containers and managing container images on a node. Kubernetes introduced the <strong>Container Runtime Interface (CRI)</strong> so that the kubelet could interact with different container runtimes through a common interface rather than requiring a custom integration for each one.</p><p>- <strong>Docker Engine</strong> provides a broader container platform. When a user runs a command such as <em>docker run</em>, the Docker CLI communicates with the Docker daemon, which handles the request and delegates container management to <em>containerd</em>.</p><p>- <strong>containerd</strong> has a narrower scope. It manages container images and the container lifecycle and is designed to be embedded into larger systems. Docker Engine itself is built on top of containerd, but containerd can also be used independently by systems such as Kubernetes.</p><p>At a lower level, <strong>runc</strong> implements the OCI runtime specification and is used by containerd and other runtimes to actually create and start containers.</p><p>Finally, <strong>dockershim</strong> was an adapter inside Kubernetes that allowed the kubelet to use Docker Engine even though Docker Engine did not implement CRI directly.</p><p>These components belong to different layers, which is why describing the situation simply as “Docker versus containerd” can be misleading.</p><p>In the early days of Kubernetes, Docker Engine was the main supported container runtime. As the container ecosystem grew, Kubernetes needed to support additional runtimes without maintaining separate integrations for each one. This led to the introduction of CRI.</p><p>The problem was that Docker Engine predated CRI and did not implement it.</p><p>To preserve compatibility, Kubernetes introduced dockershim as an adapter between the kubelet and Docker Engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hGpfOqYptAJGWxBY4sGpYA.png" /><figcaption>Figure 1. Comparison between the Docker-based runtime path using dockershim and the direct containerd integration through CRI. Source: Kubernetes Blog, “Kubernetes Containerd Integration Goes GA” (2018).</figcaption></figure><p>This meant that Kubernetes could continue using Docker Engine while moving toward a more general runtime interface.</p><p>Meanwhile, containerd evolved into an independent project and gained CRI support, allowing Kubernetes to use containerd without requiring Docker Engine. Kubernetes documentation from that period explicitly described this as removing an additional hop from the runtime stack.</p><p>Why dockershim was removed?</p><p>Dockershim was never intended to be a permanent architectural solution.</p><p>Because it was maintained inside the kubelet, Kubernetes had to keep Docker-specific code alongside the standardized CRI path. Over time, this added complexity and maintenance burden. Some integrations also behaved differently when Docker was used through the shim.</p><p>The Kubernetes project therefore moved toward a cleaner model in which runtimes communicate with the kubelet through CRI instead of relying on vendor-specific integration code.</p><p>The removal also made it easier for the ecosystem to evolve around newer runtime capabilities. The Kubernetes documentation specifically mentioned features such as cgroups v2 and user namespaces as areas where newer CRI runtimes could evolve without the limitations associated with dockershim.</p><p>Dockershim was deprecated with Kubernetes 1.20 and ultimately removed in Kubernetes 1.24.</p><p>After dockershim was removed, the architecture became simpler.</p><p>Docker Engine can still be used as a Kubernetes container runtime after the removal of the in-tree dockershim. The difference is that the adapter is no longer part of Kubernetes itself. An external CRI-compatible adapter, <strong>cri-dockerd</strong>, can be installed between the kubelet and Docker Engine. This preserves Docker Engine support while keeping Docker-specific integration outside the kubelet.</p><p>Instead of relying on a Docker-specific integration inside the kubelet, Kubernetes communicates with container runtimes through the <strong>Container Runtime Interface (CRI)</strong>.</p><p>In containerd 1.0, Kubernetes used a separate <em>cri-containerd</em> daemon between the kubelet and containerd. In containerd 1.1, that daemon was replaced by a <strong>CRI plugin built directly into containerd</strong>, enabled by default. This removed another communication hop and allowed Kubernetes to use containerd directly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OgmuaaVXzXm-KyUIKs8YJQ.png" /><figcaption>Figure 2. Evolution of containerd’s CRI integration: in containerd 1.0, CRI support relied on the separate cri-containerd component; in containerd 1.1, the CRI plugin was integrated directly into containerd. Source: Kubernetes Blog, “Kubernetes Containerd Integration Goes GA” (2018).</figcaption></figure><p>The important point is that Kubernetes did not replace Docker with one mandatory runtime. The architectural shift was toward a common interface between the kubelet and the runtime.</p><p>This distinction is especially important with containerd, because it can exist in two contexts at the same time. Docker Engine is built on top of containerd, while Kubernetes can communicate directly with the same underlying containerd through its CRI plugin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*NsSH6unHDSrHlZK1e63CBA.png" /><figcaption>Figure 3. Docker CE container runtime architecture, showing Docker Engine using containerd and runc underneath. Source: Kubernetes Blog, “Kubernetes Containerd Integration Goes GA” (2018).</figcaption></figure><p>What did not change?</p><p>The removal of dockershim did not mean that Docker images stopped working with Kubernetes.</p><p>Images produced with <em>docker build</em> continued to work with CRI-compatible runtimes because the container ecosystem relies on standards such as the <strong>Open Container Initiative (OCI)</strong>.</p><p>OCI defines specifications for container images and runtimes, while CRI defines how Kubernetes communicates with container runtimes.</p><p>Docker also remained useful as a development tool. Developers could continue to build, test, and distribute images with Docker even if Kubernetes used containerd directly on the cluster nodes.</p><p>In fact, Docker Engine and Kubernetes can coexist on the same node while using the same underlying containerd. containerd uses namespaces to keep the two environments separated, preventing Docker Engine and kubelet from seeing or interfering with each other’s containers and images.</p><p>Docker Engine itself can also still be used as a Kubernetes container runtime through the external <em>cri-dockerd</em> adapter. The difference is that this integration is no longer maintained inside the kubelet.</p><p>The migration mainly affected tooling and operational assumptions around the nodes.</p><p>When Docker Engine was used as the Kubernetes runtime, administrators could inspect workloads with commands such as:</p><pre>docker ps<br>docker inspect<br>docker images<br>docker info</pre><p>With a CRI-compatible runtime such as containerd, Kubernetes recommends using <em>crictl</em> for troubleshooting pods, containers, and images on cluster nodes. <em>crictl</em> is runtime-independent and provides a Kubernetes-oriented view of workloads.</p><p>This distinction is important because Docker and Kubernetes may use separate containerd namespaces. As a result, Kubernetes-managed containers do not appear in <em>docker ps</em>, and images pulled by Kubernetes do not appear in <em>docker images</em>. Conversely, containers and images created through Docker are not automatically visible to Kubernetes.</p><p>This has practical consequences for:</p><ul><li>scripts that invoke the <em>docker CLI</em>;</li><li>tools that access the Docker socket;</li><li>node troubleshooting workflows;</li><li>monitoring and security agents;</li><li>logging configuration;</li><li>registry mirrors and insecure registry configuration.</li></ul><p>It also explains why building an image with:</p><pre>docker build</pre><p>is not the same as making that image available to the runtime used by Kubernetes. In many setups, the image must be pushed to a registry or otherwise imported into the runtime used by the cluster.</p><p>The removal of dockershim did not mean that Kubernetes replaced Docker with containerd. The real change was architectural: Kubernetes removed a Docker-specific integration from the kubelet and standardized communication with container runtimes through CRI.</p><p>Docker remains relevant for building and managing containers, while runtimes such as containerd and CRI-O can integrate directly with Kubernetes. The result is a cleaner separation of responsibilities: Kubernetes focuses on orchestration, CRI defines how it communicates with runtimes, and the underlying runtime is free to evolve independently.</p><p>The key takeaway is therefore simple: <strong>Docker did not disappear from the Kubernetes ecosystem; Kubernetes simply stopped requiring special treatment for it.</strong></p><h3>References</h3><ul><li>Kubernetes. <em>Containerd Brings More Container Runtime Options for Kubernetes.</em> Kubernetes Blog, November 2, 2017.</li><li>Kubernetes. <em>Kubernetes Containerd Integration Goes GA.</em> Kubernetes Blog, May 24, 2018.</li><li>Kubernetes. <em>Dockershim Deprecation FAQ.</em> Kubernetes Blog, December 2, 2020.</li><li>Kubernetes SIG Node. <em>Removing dockershim from kubelet (#2221).</em> Kubernetes Enhancements, December 29, 2020.</li><li>Kubernetes. <em>Kubernetes is Moving on From Dockershim: Commitments and Next Steps.</em> Kubernetes Blog, January 7, 2022.</li><li>Kubernetes. <em>Updated: Dockershim Removal FAQ.</em> Kubernetes Blog, February 17, 2022.</li><li>Kubernetes. <em>Dockershim: The Historical Context.</em> Kubernetes Blog, May 3, 2022.</li><li>Kubernetes Documentation. <em>Migrating from dockershim.</em></li><li>Kubernetes Documentation. <em>Check whether dockershim removal affects you.</em></li><li>Kubernetes Documentation. <em>Container Runtimes.</em></li><li>Savannah Ostrowski. <em>containerd vs. Docker: Understanding Their Relationship and How They Work Together.</em> Docker Blog, March 27, 2024.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=217da56302ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>