<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Containers on Ethan-ZYF</title><link>https://ethanzyf.com/tags/containers/</link><description>Recent content in Containers on Ethan-ZYF</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 21 May 2026 00:00:00 -0700</lastBuildDate><atom:link href="https://ethanzyf.com/tags/containers/index.xml" rel="self" type="application/rss+xml"/><item><title>Week2 Day 4: K8s security — AppArmor</title><link>https://ethanzyf.com/blog/week2-day4-apparmor/</link><pubDate>Thu, 21 May 2026 00:00:00 -0700</pubDate><guid>https://ethanzyf.com/blog/week2-day4-apparmor/</guid><description>&lt;p&gt;AppArmor as the path-based complement to seccomp&amp;rsquo;s syscall-based filtering — and a hands-on lesson in why that complement is harder to deploy. This post covers how K8s wraps AppArmor (&lt;code&gt;securityContext.appArmorProfile&lt;/code&gt;, symmetric with seccomp&amp;rsquo;s three types), why an AppArmor profile is heavier than a seccomp one (it must be pre-loaded into the node&amp;rsquo;s kernel via &lt;code&gt;apparmor_parser&lt;/code&gt;, not just dropped as a file), why &lt;code&gt;deny /data/** w&lt;/code&gt; blocks every syscall that writes there (closing the hole where &lt;code&gt;touch&lt;/code&gt; bypassed yesterday&amp;rsquo;s mkdir block), and the day&amp;rsquo;s most valuable lesson: &lt;strong&gt;the experiment couldn&amp;rsquo;t run at all&lt;/strong&gt; because a Mac/Docker-Desktop kind node has no AppArmor LSM in its kernel — a firsthand encounter with the fail-open trap and the portability problem of AppArmor-based mitigations.&lt;/p&gt;</description></item><item><title>Week2 Day 3: K8s security — seccomp</title><link>https://ethanzyf.com/blog/week2-day3-seccomp/</link><pubDate>Wed, 20 May 2026 00:00:00 -0700</pubDate><guid>https://ethanzyf.com/blog/week2-day3-seccomp/</guid><description>&lt;p&gt;Where Week 1 and Week 2 meet: K8s seccomp is the &lt;em&gt;same&lt;/em&gt; kernel seccomp from Week 1, except runc installs the BPF filter for you instead of your application. This post traces the full kubelet → containerd → runc chain (and what runc actually does — namespaces, cgroups, NNP, caps, seccomp, AppArmor, then exec), the three profile types (Unconfined / RuntimeDefault / Localhost), why the profile JSON is just the declarative form of the cBPF you&amp;rsquo;d hand-write, why &lt;code&gt;SCMP_ACT_ERRNO&lt;/code&gt; lets the process survive while &lt;code&gt;mkdir&lt;/code&gt; returns EPERM, and the crucial limitation: seccomp blocks &lt;em&gt;syscalls&lt;/em&gt;, not &lt;em&gt;intent&lt;/em&gt; — block &lt;code&gt;mkdir&lt;/code&gt; and &lt;code&gt;touch&lt;/code&gt; (which uses &lt;code&gt;openat&lt;/code&gt;) still creates files. Plus &lt;code&gt;/proc/&amp;lt;pid&amp;gt;/status&lt;/code&gt; as the ground-truth proof a filter is loaded.&lt;/p&gt;</description></item><item><title>Week2 Day 2: K8s security — NetworkPolicy + Secrets</title><link>https://ethanzyf.com/blog/week2-day2-networkpolicy-secrets/</link><pubDate>Tue, 19 May 2026 00:00:00 -0700</pubDate><guid>https://ethanzyf.com/blog/week2-day2-networkpolicy-secrets/</guid><description>&lt;p&gt;Hands-on with the network and secret-data layers of Kubernetes security: why the default flat network is a lateral-movement risk, the deeply counterintuitive &amp;ldquo;selective activation&amp;rdquo; model of NetworkPolicy (one allow rule silently flips a pod to default-deny), why Ingress and Egress are independent dimensions (and why locking egress breaks DNS), the YAML trap where a single &lt;code&gt;-&lt;/code&gt; flips AND into OR, why NetworkPolicy needs a CNI that actually enforces it (kindnet doesn&amp;rsquo;t — another fail-open), and the truth about Secrets: they&amp;rsquo;re base64, not encrypted — RBAC is what protects them — plus the atomic-symlink-swap trick that powers volume-mounted secret rotation.&lt;/p&gt;</description></item><item><title>Week2 Day 1: K8s security — Pod Security Standards + RBAC</title><link>https://ethanzyf.com/blog/week2-day1-k8s-psa-rbac/</link><pubDate>Mon, 18 May 2026 00:00:00 -0700</pubDate><guid>https://ethanzyf.com/blog/week2-day1-k8s-psa-rbac/</guid><description>&lt;p&gt;A first hands-on pass at Kubernetes-native security: how Pod Security Admission (PSA) actually attaches to namespaces via labels (and silently fails-open when the label is misspelled), why &lt;code&gt;runAsNonRoot: true&lt;/code&gt; is necessary but not sufficient (the image&amp;rsquo;s &lt;code&gt;USER&lt;/code&gt; still has to be non-root), the four-field minimum a pod needs to clear the &lt;code&gt;restricted&lt;/code&gt; profile, and the full RBAC mental model — &lt;code&gt;Role&lt;/code&gt;/&lt;code&gt;ClusterRole&lt;/code&gt; × &lt;code&gt;RoleBinding&lt;/code&gt;/&lt;code&gt;ClusterRoleBinding&lt;/code&gt; as &lt;strong&gt;two independent dimensions&lt;/strong&gt; that produce four combinations (one of which K8s rejects outright), why RBAC evaluation is &lt;strong&gt;union, not override&lt;/strong&gt;, and the asymmetry that makes RBAC fail-closed while PSA fails open.&lt;/p&gt;</description></item><item><title>Day 5: AppArmor + layered sandbox design</title><link>https://ethanzyf.com/blog/day5-apparmor/</link><pubDate>Sat, 16 May 2026 00:00:00 -0700</pubDate><guid>https://ethanzyf.com/blog/day5-apparmor/</guid><description>&lt;p&gt;How AppArmor actually attaches to a process (via the &lt;code&gt;bprm_check_security&lt;/code&gt; LSM hook at &lt;code&gt;execve&lt;/code&gt; time, keyed on binary path), why &lt;code&gt;bash script.sh&lt;/code&gt; silently runs &lt;em&gt;unconfined&lt;/em&gt; while &lt;code&gt;./script.sh&lt;/code&gt; does not, the six exec modifiers (&lt;code&gt;ix&lt;/code&gt;/&lt;code&gt;Px&lt;/code&gt;/&lt;code&gt;Cx&lt;/code&gt;/&lt;code&gt;Ux&lt;/code&gt; and their setuid-preserving uppercase forms), the hardlink and bind-mount tricks that bypass path-based MAC, and why a production sandbox layers &lt;strong&gt;namespace + capability + seccomp + AppArmor + cgroup&lt;/strong&gt; — with the argument that, if you can only afford two, &lt;strong&gt;seccomp + AppArmor&lt;/strong&gt; is the highest-ROI pair.&lt;/p&gt;</description></item><item><title>Day 4: seccomp BPF Filter (filter mode deep dive)</title><link>https://ethanzyf.com/blog/day4-seccomp-filter/</link><pubDate>Thu, 14 May 2026 00:00:00 -0700</pubDate><guid>https://ethanzyf.com/blog/day4-seccomp-filter/</guid><description>&lt;p&gt;A deep dive into seccomp filter mode: the BPF data layout, why pointer args can&amp;rsquo;t be dereferenced (TOCTOU &lt;em&gt;and&lt;/em&gt; atomic context), the cBPF instruction skeleton, the multi-ABI bypasses every filter must defend against, and the eight &lt;code&gt;SECCOMP_RET_*&lt;/code&gt; actions that power modern container security — including the &lt;code&gt;USER_NOTIF&lt;/code&gt; + fd-injection pattern that runc/crun use.&lt;/p&gt;</description></item></channel></rss>