redact-proxy pre-release
Docs menu

Kubernetes

kubectl in the agent container works against a real cluster, while the cluster's address, its CA, the client certificate and its private key stay out of the sandbox. The agent's kubeconfig holds markers and working stand-ins; the proxy puts the real values back on the way to the API server.

Setting it up#

Mount the kubeconfig as a credential file and allow the API server:

shell
redactproxy launch -workspace . -policy-file policy.json \
  -mount ~/.kube/sandbox-config:/home/node/.kube/config
policy.json
{"allow": ["kubernetes.docker.internal:6443"]}

kubectl auth whoami in the sandbox shows the identity the cluster sees: the real one.

What the agent's kubeconfig holds#

FieldIn the sandbox
serverhttps://<marker>:6443: a hostname or IP marker, scheme and port kept
certificate-authority-dataThe proxy CA (stand-in)
client-certificate-data, client-key-dataA dummy pair signed by the proxy CA (stand-in)
tokenOne marker for the whole token

Base64 values stay base64, so kubectl loads the file without complaint.

How a request reaches the cluster#

  1. kubectl resolves the server's marker. The sinkhole answers with a synthetic address, and the gateway maps it back to the real host.
  2. The proxy terminates kubectl's TLS with a certificate for the marker name, signed by the proxy CA, which kubectl trusts through its kubeconfig.
  3. kubectl presents the dummy client certificate. The proxy presents the real certificate and key in its own handshake with the API server, and verifies the server against the real CA.
  4. A token's marker in Authorization: Bearer is replaced by the real token, like any marker in a credential header.

What the agent sees#

What was tested#

Known limits#