Kubernetes Egress Control with Squid proxy ΒΆ 2025-12-28 This Way to the Egress! β Sign at P.T. Barnumβs Americam Museum Kubernetes ingress gets a lot of attention β Gateway API, Ingress controllers, service meshes β compared with the Egress, mostly ignored until someone asks βwhat exactly is our cluster talking to?β, or, in even simple deployments, βCan we see what we are talking to?β. This is a (very) simple approach to that, using the venerable Squid proxy and a NetworkPolicy, without reaching for heavier machinery (but beginning to understand why we would). This is the overview of the thing Iβm about to describe: Squid as egress proxy in k3s Why do I care ΒΆ Most Kubernetes tutorials focus on getting traffic into your cluster, which is fair since thatβs where it usually starts... but traffic flows both ways, and once your workloads start making outbound calls to APIs, databases, and services beyond your cluster boundary, thereβs a discussion on visibility and security to be had. I ran into this while working with OpenShiftβs egress policies years ago, in so-called βregulated industriesβ: while not the most flexible at the time, they were the most straightforward answer to security requirements that defined that outbound traffic should go through a proxy. Iβm using Kubernetes through k3s (mostly) and kind (often, for develpment) for my own personal stuff (see Projects), so I went back to basics on this: what if we just used Squid β a proxy thatβs been solving this problem since 1996! β and enforced its usage with a NetworkPolicy? Nothing fancy, nothing βnext-gen cloud-nativeβ just a proxy with logs, and see where that got me? Squid and k3s: the solution ΒΆ The architecture is deliberately simple: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β Cluster β β β β βββββββββββββββββββββββ ββββββββββββββββββββββββββ β β β workload namespace β β egress-proxy namespace β β β β β β β β β β βββββββ β :3128β βββββββββ β β β β β pod β HTTP_PROXY ββββββββΌββΆβ squi...
First seen: 2025-12-29 13:00
Last seen: 2025-12-29 19:01