Skip to content
Mutual TLS (mTLS)

Mutual TLS (mTLS)

Why mTLS

Without encryption, any pod on the cluster network that can observe traffic between the gateway and a workspace pod can read it. Without authentication, a pod that obtains a workspace’s Service address could pose as that workspace and receive forwarded requests. mTLS addresses both:

  • Encryption. All gateway-to-workspace traffic is TLS. Neither side pins a protocol version, so the Go and Envoy defaults apply: TLS 1.2 or later, with TLS 1.3 negotiated between them.
  • Server authentication. The gateway verifies that the workspace endpoint presents a certificate signed by the internal CA and valid for the Service hostname it dialed.
  • Client authentication. The Envoy sidecar in each workspace pod requires the gateway’s client certificate on both of its listeners, so any other client is rejected before any HTTP is exchanged.

mTLS is opt-in. It is controlled by the single top-level mtls.enabled value of the kornercode chart (config/helm), which switches it on for the operator and the gateway together. When it is disabled, workspaces have no Envoy sidecar and no certificate resources, and the gateway connects to code-server over plain HTTP. All mTLS code paths are gated by the MTLS_ENABLED environment variable in both binaries.


Architecture

 Browser
   │
   │ HTTPS (ingress terminates TLS)
   ▼
 Gateway pod (gateway namespace)
   │   TLS credentials: kornercode-gateway-mtls Secret
   │   loaded by tlsclient.Loader
   │
   │ mTLS (mutual certificate authentication)
   │   SNI = workspace-<name>.<ns>.svc.cluster.local
   ▼
 Service: workspace-<name>  port 8443 → targetPort 9443
   │
   ▼
 Workspace pod (team namespace)
   ├─ Envoy sidecar "mtls-proxy" (port 9443, client certificate required)
   │    certificate: workspace-<name>-tls Secret (mounted at /etc/envoy/tls)
   │    → forwards to 127.0.0.1:8080 (code-server, loopback only)
   │
   └─ Envoy test listener (port testPort+10000, client certificate required)
        → forwards to 127.0.0.1:testPort (user application)

Certificate chain

The internal PKI consists of resources from three sources:

ResourceKindCreated by
kornercode-selfsigned-bootstrapClusterIssuerChart (config/helm/templates/mtls-ca.yaml)
kornercode-internal-caCertificate (CA)Chart (mtls-ca.yaml)
kornercode-internal-ca-issuerClusterIssuer (CA)Chart (mtls-ca.yaml)
kornercode-gateway-mtlsCertificateChart (config/helm/templates/gateway/mtls-certificate.yaml)
kornercode-ingress-clientCertificate (client auth, DNS name kornercode-ingress)Chart (config/helm/templates/gateway/client-certificates.yaml), only with clientCertificates.enabled
workspace-<workspace>-tlsCertificate, one per WorkspaceOperator, at runtime (ReconcileCertificate)

The workspace certificates exist only when mtls.enabled is true. The internal CA, its issuers and the gateway certificate are rendered when mtls.enabled or clientCertificates.enabled is true: the client-certificate gate uses the same CA for the ingress’s client certificate and the gateway’s client-certificate listener (port 8444), without turning on mTLS to workspaces. See Client-certificate gate.

1. Bootstrap ClusterIssuer: kornercode-selfsigned-bootstrap

A self-signed issuer whose only purpose is to issue the internal CA certificate.

# config/helm/templates/mtls-ca.yaml
kind: ClusterIssuer
metadata:
  name: kornercode-selfsigned-bootstrap
spec:
  selfSigned: {}

2. Internal CA certificate: kornercode-internal-ca

An ECDSA P-256 CA certificate valid for 10 years. It is created in the cert-manager controller namespace (mtls.certManagerNamespace, default cert-manager), because a CA ClusterIssuer reads its secret from cert-manager’s cluster resource namespace, not from the release namespace.

kind: Certificate
metadata:
  name: kornercode-internal-ca
  namespace: cert-manager        # mtls.certManagerNamespace
spec:
  isCA: true
  secretName: kornercode-internal-ca
  duration: 87600h               # 10 years
  renewBefore: 720h
  commonName: kornercode-internal-ca
  subject:
    organizations: [kornercloud]
  privateKey:
    algorithm: ECDSA
    size: 256
  issuerRef:
    name: kornercode-selfsigned-bootstrap
    kind: ClusterIssuer
    group: cert-manager.io

3. CA ClusterIssuer: kornercode-internal-ca-issuer

The issuer for all operational certificates: the gateway certificate and the workspace certificates.

kind: ClusterIssuer
metadata:
  name: kornercode-internal-ca-issuer
spec:
  ca:
    secretName: kornercode-internal-ca

The chart always creates the issuer under this name, and the gateway certificate always references it. The operator uses mtls.issuerName (default kornercode-internal-ca-issuer, passed as MTLS_ISSUER_NAME) for workspace certificates; keep the default unless you provide a different CA issuer yourself.

4. Gateway certificate: kornercode-gateway-mtls

Created by the chart’s gateway templates. The gateway presents it as its client certificate when it dials workspaces, and as its server certificate when it serves HTTPS itself.

# config/helm/templates/gateway/mtls-certificate.yaml
kind: Certificate
spec:
  secretName: kornercode-gateway-mtls
  duration: "2160h"      # 90 days
  renewBefore: "360h"    # 15 days
  isCA: false
  privateKey:
    algorithm: ECDSA
    size: 256
  usages: [server auth, client auth]
  dnsNames:
    - kornercode-gateway
    - kornercode-gateway.<namespace>
    - kornercode-gateway.<namespace>.svc
    - kornercode-gateway.<namespace>.svc.cluster.local
  issuerRef:
    name: kornercode-internal-ca-issuer
    kind: ClusterIssuer
    group: cert-manager.io

The duration and renewal window are fixed in the template; they are not chart values.

5. Per-workspace certificates

ReconcileCertificate (operator/internal/controllers/v1alpha1/workspace/apply/reconcilecertificate.go) creates one cert-manager Certificate per Workspace. It uses the Kubernetes dynamic client with server-side apply (field manager kornercode-operator), so the operator does not depend on the cert-manager Go module.

Name / Secret: workspace-<workspace-name>-tls
Duration:      720h  (30 days, helpers.MtlsCertDuration)
RenewBefore:   48h   (helpers.MtlsCertRenewBefore)
Algorithm:     ECDSA P-256
Usages:        server auth
Secret labels: the kornercode owner and managed-by labels (secretTemplate)
DNS SANs:
  - workspace-<name>
  - workspace-<name>.<namespace>
  - workspace-<name>.<namespace>.svc
  - workspace-<name>.<namespace>.svc.cluster.local
Issuer:        MTLS_ISSUER_NAME (ClusterIssuer)
Owner:         the Workspace (controller reference)

The durations are operator constants in operator/internal/controllers/v1alpha1/workspace/helpers/helpers.go; they are not configurable.

The step requeues every 15 seconds until the Certificate reports Ready=True, and only then writes the Envoy ConfigMap. The pod is created by the next step, so it never starts with a missing certificate.

On Workspace deletion, DeleteCertificate (operator/internal/controllers/v1alpha1/workspace/delete/deletecertificate.go) deletes the Certificate and the Envoy ConfigMap. The certificate Secret is managed by cert-manager, which removes it only when its controller runs with --enable-certificate-owner-ref (Helm value enableCertificateOwnerRef: true); enable it when you turn on mTLS. The operator does not delete the Secret itself, because that would require permission to delete every Secret in the cluster. Without the cert-manager option, leftover Secrets carry the workspace’s owner label and can be removed with kubectl delete secret -l code.kornercloud.dev/managed-by=kornercode-operator once their Workspace is gone. A leftover key cannot authenticate to any workspace: workspace certificates are server-only, and Envoy accepts only the gateway as a client.


Envoy sidecar

code-server serves plain HTTP inside the container. Rather than requiring every workspace image to terminate TLS, the operator adds an Envoy sidecar that terminates TLS and forwards to code-server and to the test application over the pod’s loopback interface:

gateway ──mTLS──► Envoy :9443 ──plain HTTP──► code-server 127.0.0.1:8080
                  (require_client_certificate: true)

gateway ──mTLS──► Envoy :testPort+10000 ──plain HTTP──► user app 127.0.0.1:testPort
                  (require_client_certificate: true)

code-server binding

The operator keeps the image’s upstream ENTRYPOINT and sets the code-server container args (CodeServerArgs in helpers.go), which the entrypoint passes on to code-server:

ModeArguments
Plain--bind-addr 0.0.0.0:8080 --auth none
mTLS--bind-addr 127.0.0.1:8080 --auth none

In mTLS mode code-server listens on the pod’s loopback interface only, so the Envoy sidecar is the only way in: a client that reaches the pod IP directly finds nothing on port 8080, independently of NetworkPolicy. --auth none is safe because the gateway authenticates every request before proxying it. The port is the fixed constant CodeServerContainerPort (8080, code-server’s upstream default) and is not configurable per profile.

Container spec

BuildEnvoySidecar in operator/internal/controllers/v1alpha1/workspace/helpers/helpers.go builds the container. The image is the operator constant helpers.MtlsEnvoyImage (envoyproxy/envoy:v1.32.4), so an Envoy upgrade ships with an operator release.

corev1.Container{
    Name:    "mtls-proxy",
    Image:   envoyImage, // helpers.MtlsEnvoyImage
    Command: []string{"/bin/sh", "-c"},
    Args: []string{`
envoy -c /etc/envoy/config.yaml &
ENVOY_PID=$!
LAST=$(md5sum /etc/envoy/tls/tls.crt | cut -d' ' -f1)
while true; do
  sleep 3600
  NOW=$(md5sum /etc/envoy/tls/tls.crt | cut -d' ' -f1)
  if [ "$NOW" != "$LAST" ]; then
    kill $ENVOY_PID
    wait $ENVOY_PID
    envoy -c /etc/envoy/config.yaml &
    ENVOY_PID=$!
    LAST=$NOW
  fi
done
`},
    Ports: []corev1.ContainerPort{
        {Name: "mtls", ContainerPort: 9443}, // EnvoySidecarContainerPort
    },
    VolumeMounts: []corev1.VolumeMount{
        {Name: "workspace-tls", MountPath: "/etc/envoy/tls", ReadOnly: true},
        {Name: "envoy-conf", MountPath: "/etc/envoy/config.yaml", SubPath: "config.yaml", ReadOnly: true},
    },
    SecurityContext: &corev1.SecurityContext{
        AllowPrivilegeEscalation: &falseVal,
        RunAsNonRoot:             &trueVal,
        RunAsUser:                &uid101, // envoy user
        Capabilities:             &corev1.Capabilities{Drop: []corev1.Capability{"ALL"}},
    },
    Resources: corev1.ResourceRequirements{
        Requests: {cpu: 20m, memory: 32Mi},
        Limits:   {cpu: 200m, memory: 128Mi},
    },
}

Envoy bootstrap configuration

buildEnvoyConfig in reconcilecertificate.go renders the bootstrap, which is stored in a per-workspace ConfigMap workspace-<name>-envoy.

code_server_mtls listener (port 9443)

  • Downstream TLS with the workspace certificate; a client certificate is required.
  • Client certificates are validated against ca.crt from the workspace TLS Secret and must carry the DNS name kornercode-gateway (helpers.MtlsGatewayIdentity).
  • HTTP connection manager with WebSocket upgrades enabled.
  • Upstream cluster code_server: 127.0.0.1:8080 (CodeServerContainerPort).
  • Route timeout 0s (disabled), because IDE connections are long-lived WebSockets.

test_app_tls listener (port testPort + 10000)

  • Downstream TLS with the workspace certificate; the same client certificate check as the code_server_mtls listener.
  • HTTP connection manager without WebSocket upgrades.
  • Upstream cluster test_app: 127.0.0.1:testPort.

Both clusters are STATIC and point at the loopback address. The Envoy admin interface listens on 127.0.0.1:9901 only and is not exposed by the Service.

Trust model

Envoy accepts a client certificate only if it chains to the internal CA and carries the DNS name kornercode-gateway. That name is in the gateway’s certificate (config/helm/templates/gateway/mtls-certificate.yaml). Workspace certificates come from the same CA but are named workspace-<name>, so a workspace that reads its own certificate cannot use it to reach another workspace’s IDE or test application. NetworkPolicy remains a second layer: the sample policies admit ingress to workspace pods only from the gateway. See Network isolation.

Volumes

ReconcilePod adds two volumes when mTLS is enabled:

VolumeSourceMount path
workspace-tlsSecret workspace-<name>-tls (managed by cert-manager)/etc/envoy/tls
envoy-confConfigMap workspace-<name>-envoy (managed by the operator)/etc/envoy/config.yaml

Gateway TLS client

tlsclient.Loader

gateway/internal/tlsclient/loader.go provides a thread-safe credential store. It reads three files from MTLS_CERT_DIR (Helm key mtls.certDir, default /etc/kornercode/tls), where the chart mounts the kornercode-gateway-mtls Secret:

FileContent
tls.crtGateway leaf certificate (ECDSA P-256)
tls.keyGateway private key
ca.crtInternal CA certificate

The Loader keeps the certificate and the CA pool behind a sync.RWMutex. The gateway starts StartReloader with a 5-minute interval; on every tick it reloads all three files and swaps them in. If a reload fails, the previous credentials stay in use and a warning is logged.

MutualTLSConfig(): dev and test proxies

Used by DevProxy for HTTP and WebSocket connections to code-server, and by TestProxy for connections to the user’s application:

&tls.Config{
    InsecureSkipVerify: true, // built-in verification replaced by VerifyConnection
    GetClientCertificate: func(*tls.CertificateRequestInfo) (*tls.Certificate, error) {
        // returns the current gateway certificate under the read lock
    },
    VerifyConnection: l.verifyConnection,
}

InsecureSkipVerify: true disables Go’s built-in verification so that VerifyConnection, which uses the reloadable CA pool, is the only authority. Go calls VerifyConnection on every handshake regardless of InsecureSkipVerify.

verifyConnection: peer verification

func (l *Loader) verifyConnection(cs tls.ConnectionState) error {
    if len(cs.PeerCertificates) == 0 {
        return fmt.Errorf("no peer certificate presented")
    }
    l.mu.RLock()
    pool := l.pool
    l.mu.RUnlock()
    opts := x509.VerifyOptions{
        Roots:   pool,          // internal CA
        DNSName: cs.ServerName, // SNI hostname derived from the dialed address
    }
    if _, err := cs.PeerCertificates[0].Verify(opts); err != nil {
        return fmt.Errorf("peer cert verification failed for %s: %w", cs.ServerName, err)
    }
    return nil
}

This performs two checks:

  1. Chain verification. The peer’s leaf certificate must chain to the internal CA.
  2. Hostname verification. cs.ServerName is the SNI value that http.Transport (HTTP requests) and tls.Dialer (WebSocket tunnels) derive from the upstream address workspace-<name>.<namespace>.svc.cluster.local. It must match one of the certificate’s DNS SANs.

ServerTLSConfig(): gateway listener

When GATEWAY_TLS_ENABLED=true and mTLS is enabled, the gateway also serves HTTPS on port 8443 with the same certificate, selected per handshake so that rotations apply without a restart. See Helm configuration.


Port mapping reference

LayerPortDescription
Service8443EnvoySidecarServicePort: code-server port in mTLS mode (targets Envoy 9443)
ServicetestPortTest port (targets Envoy testPort+10000 in mTLS mode)
Container (Envoy)9443EnvoySidecarContainerPort: mTLS listener
Container (Envoy)testPort+10000Test TLS listener (MtlsTestPortOffset = 10000)
Container (code-server)8080CodeServerContainerPort: code-server’s own port, bound to 127.0.0.1 in mTLS mode and 0.0.0.0 in plain mode
Container (code-server)testPortUser application port
Envoy admin9901Loopback only, not exposed by the Service

In plain mode the Service maps port 8080 to code-server’s 8080 and the test port to itself. ReconcileService records the port the gateway must dial in status.codeServerPort: 8443 with mTLS, 8080 without.

The Workspace webhook rejects spec.testPort 8080, and ReconcileCertificate fails a Workspace whose testPort + 10000 would exceed 65535.


WebSocket tunnelling with mTLS

httputil.ReverseProxy handles ordinary HTTP requests over an http.Transport configured with MutualTLSConfig. WebSocket upgrades are handled separately: DevProxy.ServeHTTP detects Upgrade: websocket, rejects the upgrade if its Origin is not a gateway host or if Sec-Fetch-Site is cross-site, and then calls tunnelWebSocket:

// gateway/internal/proxy/ws.go
dialer := &tls.Dialer{
    NetDialer: &net.Dialer{Timeout: 5 * time.Second},
    Config:    tlsCfg, // MutualTLSConfig()
}
upstreamConn, err = dialer.DialContext(r.Context(), "tcp", upstreamAddr)

tls.Dialer.DialContext derives the SNI hostname from the address when Config.ServerName is empty, matching the hostname http.Transport uses, so VerifyConnection performs the same checks for WebSocket connections.

After the handshake, the gateway writes a new HTTP/1.1 upgrade request upstream that carries only Upgrade, Connection, the Sec-WebSocket-* headers and User-Agent; cookies and Authorization are never forwarded. Envoy proxies the upgrade to code-server (upgrade_configs: [{upgrade_type: websocket}]), and the gateway then copies bytes in both directions inside the TLS connection.


Certificate rotation

cert-manager renewal

cert-manager renews certificates before renewBefore elapses (48 hours before expiry for workspace certificates, 15 days for the gateway certificate) and updates the Secrets in place. It does not restart pods.

Gateway reload

The gateway’s reloader re-reads its credential files every 5 minutes and uses the new certificate and CA pool for all subsequent connections. Kubernetes propagates Secret updates to the mounted files with some delay, so a rotation is picked up within a few minutes.

Envoy reload

The sidecar’s entrypoint compares the md5sum of tls.crt once an hour. When it changes, the script stops Envoy and starts it again with the same configuration. The pod is not restarted. Connections open during the restart are reset; code-server clients reconnect automatically.

Because workspace certificates are renewed 48 hours before expiry, the hourly check leaves ample margin.

Re-issuing workspace certificates after a CA change

When the internal CA changes, for example because helm uninstall removed the kornercode-internal-ca Secret (cert-manager deletes it with its Certificate when it runs with enableCertificateOwnerRef: true) and the next install issued a new one, workspaces started before the change hold certificates from the old CA, which the gateway refuses. Restarting a workspace does not help: the operator leaves the existing Certificate in place and cert-manager does not re-issue a leaf when its CA changes. Check whether the CA Secret survived with kubectl -n cert-manager get secret kornercode-internal-ca; if it did, nothing changed and there is nothing to do.

Otherwise, re-issue every workspace certificate. The operator labels workspace Certificates code.kornercloud.dev/managed-by=kornercode-operator; deleting a certificate’s Secret makes cert-manager issue a new one from the current CA (kubectl wait --for=create needs kubectl 1.31 or newer):

kubectl get certificates -A -l code.kornercloud.dev/managed-by=kornercode-operator \
  -o jsonpath='{range .items[*]}{.metadata.namespace} {.metadata.name} {.spec.secretName}{"\n"}{end}' |
while read -r ns cert secret; do
  kubectl -n "$ns" delete secret "$secret"
  kubectl -n "$ns" wait "secret/$secret" --for=create --timeout=5m
  kubectl -n "$ns" wait "certificate/$cert" --for=condition=Ready --timeout=5m
done

Then restart each workspace from the dashboard (Restart) so its Envoy sidecar loads the new certificate at once; otherwise the sidecar’s hourly check picks it up within an hour (see Envoy reload).


Reconciler chain ordering

The Workspace apply steps, wired in operator/cmd/controllers/kornercode/main.go, run in this order:

ReconcilePVC
  → ReconcileServiceAccount
  → ReconcileCertificate     waits until cert-manager reports Ready=True (no-op without mTLS)
  → ReconcilePod             creates the pod only after the certificate exists
  → ReconcileService         sets status.codeServerPort (8443 with mTLS)
  → ReconcileNetworkPolicy
  → ReconcileLifecycle

While the certificate is pending, ReconcileCertificate returns operators.Requeue(15*time.Second, "waiting for workspace TLS cert"). The Workspace’s CertificateReconciled condition stays False with reason RequeueRequested, and status.message shows the wait. ReconcilePod is not reached, so a pod never starts with a missing certificate volume.


Helm configuration

Values (config/helm/values.yaml)

One mtls block serves both components.

mtls:
  enabled: false                         # master switch for the operator and the gateway
  certManagerNamespace: cert-manager     # namespace for the internal CA certificate
  issuerName: kornercode-internal-ca-issuer # ClusterIssuer for workspace certificates

The chart passes the operator’s share of these through the ConfigMap kornercode-operator-controller-default-env as MTLS_ENABLED and, when enabled, MTLS_ISSUER_NAME. Certificate durations, internal ports and the Envoy image are operator constants.

The same block carries the gateway settings:

mtls:
  certDir: /etc/kornercode/tls # where the kornercode-gateway-mtls Secret is mounted
  gatewayTLSEnabled: true   # serve HTTPS on the gateway's own listener

With mtls.enabled the gateway loads the certificates and dials workspaces over mTLS.

mtls.gatewayTLSEnabled (default true) only takes effect when mtls.enabled is true. The chart sets GATEWAY_TLS_ENABLED only in that case, and the gateway’s HTTPS listener uses the kornercode-gateway-mtls certificate, which exists only with mTLS. When both are true:

  • the gateway serves HTTPS on port 8443;
  • the chart creates a Traefik ServersTransport named kornercode-gateway-tls with insecureSkipVerify: true, because Traefik does not trust the internal CA; the connection is still encrypted;
  • the kornercode-gateway Service is annotated with traefik.ingress.kubernetes.io/service.serverstransport: <namespace>-kornercode-gateway-tls@kubernetescrd;
  • the Ingress is annotated with traefik.ingress.kubernetes.io/backend-protocol: HTTPS and targets Service port 8443.

The resulting path is browser → HTTPS → Traefik → HTTPS → gateway → mTLS → workspace.

The gateway keeps a plain-HTTP listener on port 8080 for in-cluster callers, and the Service always exposes it as the http port. Session cookies are marked Secure, so browsers do not send them over this listener.

The chart decides the probe scheme, the probe port and the Ingress backend from gatewayTLSEnabled alone. When you run with mtls.enabled: false, also set mtls.gatewayTLSEnabled: false; otherwise probes and the Ingress target port 8443, where the gateway does not listen.


Operator RBAC for cert-manager

The operator creates, reads and deletes cert-manager Certificate resources. The permission is declared with a kubebuilder RBAC marker in operator/cmd/controllers/kornercode/main.go:

// +kubebuilder:rbac:groups=cert-manager.io,resources=certificates,verbs=get;list;watch;create;update;patch;delete

No cert-manager Go module is imported. Certificates are applied through k8s.io/client-go/dynamic as unstructured objects.


Local development

On the shared korner-kind cluster:

  1. korner-kind up installs cert-manager in the cert-manager namespace.
  2. hack/local-dev/bootstrap.sh installs the chart with mTLS enabled (hack/local-dev/values.yaml). It creates the bootstrap issuer, the CA certificate, the CA issuer and the gateway certificate.
  3. On the first Workspace, ReconcileCertificate creates its certificate, which cert-manager usually issues within seconds.

Traefik’s websecure entry point (port 8443 on localhost) serves its default self-signed certificate for the *.kornercode.local hosts, so browsers show a warning that you need to accept. The internal CA kornercode-internal-ca is separate from Traefik’s certificate and is intentionally not trusted by browsers: it signs only internal service-to-service certificates.


Troubleshooting

Gateway logs http: TLS handshake error, or Traefik returns 502 or 400.

The gateway serves HTTPS but the ingress controller sends plain HTTP, or the reverse. Check that the Ingress carries traefik.ingress.kubernetes.io/backend-protocol: HTTPS (kubectl get ingress kornercode-gateway -n <gateway-namespace> -o yaml) and that mtls.enabled and mtls.gatewayTLSEnabled are both true. If only one of them is set, see Helm configuration.

Workspace never gets a pod and reports waiting for workspace TLS cert.

Run kubectl describe certificate workspace-<name>-tls -n <namespace>. Common causes:

  • The kornercode-internal-ca-issuer ClusterIssuer is not Ready. Check that the kornercode-internal-ca Secret exists in the cert-manager namespace.
  • mtls.issuerName names an issuer that does not exist.

Gateway logs peer cert verification failed.

The gateway’s CA pool does not match the CA that signed the workspace certificate, for example right after the internal CA was replaced. The gateway reloads its files every 5 minutes; restart the gateway pod to reload immediately. If the CA itself changed, workspace certificates must be re-issued as well: the operator does not do this and cert-manager does not re-issue a leaf when its CA changes. See Re-issuing workspace certificates after a CA change.

Gateway logs no peer certificate presented, or the dev proxy returns upstream error.

The gateway uses mTLS but the workspace has no Envoy sidecar, which happens when the gateway runs with mTLS but the operator does not (for example, after an operator pod was not restarted following a change of mtls.enabled). Check status.codeServerPort on the Workspace: it must be 8443. If it is 8080, the operator runs with MTLS_ENABLED=false; check the kornercode-operator-controller-default-env ConfigMap. Existing pods keep their old spec until they are restarted; see Pod security.