Running Kubernetes in production means every request, every header, every error can flow into your logging stack. When ingress traffic carries Personally Identifiable Information (PII)—names, emails, phone numbers—it can end up stored in plain text. That’s a compliance risk, a privacy risk, and a liability you can’t ignore.
Kubernetes Ingress sits at the edge, routing traffic into your cluster. Most setups use NGINX or HAProxy ingress controllers. By default, these controllers log full request paths and sometimes query parameters. If your API or site accepts PII in those parameters, your production logs may hold sensitive data for months or years.
Masking PII at the ingress layer is the first defense. Instead of trying to scrub logs downstream, configure the ingress controller to filter or replace sensitive fields before they ever hit disk. This can be done with custom Lua scripts in NGINX, ingress annotations, or external plugins that preprocess the request metadata. Patterns for detection should match known formats—email regex, phone regex, user ID formats—and swap them with placeholder text.