5. Mutual TLS between the gateway and workspaces
- Status: Accepted
- Date: 2026-04
Context
Pods share the cluster network. code-server trusts whoever reaches it, since authentication happens at the gateway. NetworkPolicies reduce who can reach a workspace, but their enforcement depends on the CNI plugin, and a single mistake in a policy would expose IDEs.
Decision
When mTLS is enabled, cert-manager runs an internal CA that issues a
certificate per workspace (30 days, renewed 48 hours before expiry). An Envoy
sidecar in each workspace pod terminates TLS in front of code-server and the
test port. Both listeners require a client certificate signed by the internal
CA and carrying the gateway’s DNS name, kornercode-gateway; the gateway presents
it and reloads it without a restart when it rotates.
Consequences
- Reaching a workspace pod’s address is not enough to use its IDE.
- Each workspace runs an extra container (about 20 MiB of memory) and the operator depends on cert-manager.
- Workspace certificates come from the same CA. Pinning the gateway’s name keeps one workspace from using its own certificate to reach another.
- See mTLS for the certificate chain and rotation.