Skip to main content

On This Page

Kloak: Securing Kubernetes Secrets at the Kernel Level with eBPF

3 min read
Share

These articles are AI-generated summaries. Please check the original sources for full details.

Kloak: interceptor eBPF que oculta secretos a tus pods en Kubernetes

Kloak is an open-source Kubernetes HTTPS interceptor that prevents applications from ever seeing real credentials in RAM, logs, or stack traces. The system replaces opaque ULID placeholders with real secrets at the kernel level just before encrypted packages leave the host. This approach ensures that a compromised process cannot leak credentials it never possessed.

Why This Matters

Traditional secret management in Kubernetes relies on injecting cleartext credentials into the pod’s environment or filesystem, leaving them vulnerable to memory dumps and log leaks. Kloak addresses the supply chain vulnerabilities seen in 2025 and 2026 by moving the security boundary to the kernel’s data plane. This shift eliminates the trade-off between security and operational overhead by providing an agentless model that avoids the resource costs of sidecar proxies.

Key Insights

  • Kernel-Level Interception: Kloak uses eBPF programs in the ‘tc’ (traffic control) layer to replace ‘kloak:’ headers before TLS encryption occurs.
  • Agentless Architecture: By running as a host-level DaemonSet rather than a per-pod sidecar, Kloak significantly reduces the memory footprint in large clusters.
  • Domain-Specific Injection: The ‘getkloak.io/hosts’ label restricts secret translation to specific external domains, preventing data exfiltration to unauthorized hosts.
  • Performance Efficiency: Kloak introduces microsecond-level latency, a significant improvement over the millisecond overhead typical of sidecar proxies like Envoy.
  • Language Agnostic: Because the system operates beneath the application layer in the kernel, it works across all programming languages without requiring specific SDKs.

Working Examples

Kubernetes Secret manifest with Kloak labels for domain-specific injection.

apiVersion: v1
kind: Secret
metadata:
  name: openai-api-key
  labels:
    getkloak.io/enabled: "true"
    getkloak.io/hosts: "api.openai.com"
type: Opaque
stringData:
  token: sk-live-xyz123abc456

Application configuration using a ULID placeholder instead of a real API key.

openai:
  endpoint: https://api.openai.com/v1/chat/completions
  authorization: "kloak:MPZVR3GHWT4E6YBCA01JQXK5N8"

Standard Helm installation commands for deploying Kloak to a cluster.

helm repo add kloak https://chart.getkloak.io
helm repo update
helm install kloak kloak/kloak -n kloak-system --create-namespace --set demo.enabled=true

Practical Applications

  • Securing AI and Payment Gateways: Using placeholders for Stripe or OpenAI keys prevents exposure during accidental ‘console.log’ or process inspection.
  • Compliance Auditing: Implementing Kloak helps meet PCI-DSS and ISO 27001 standards by ensuring long-lived secrets never enter the application runtime environment.
  • Pitfall - Protocol Support: Kloak currently targets HTTPS; using it for non-HTTP protocols or custom TLS implementations that bypass kernel buffers will result in failed translations.
  • Pitfall - Host Misconfiguration: Incorrectly setting ‘getkloak.io/hosts’ will prevent the eBPF program from injecting the secret, causing outgoing requests to fail with placeholder errors.

References:

Continue reading

Next article

Building a Secure Local Password Manager with Python and Typer

Related Content