Repository navigation
Description
Found while testing the #1066 VSIX (CI run 42252782123, ab9ce33) on Windows 11 / VS Code 1.143.1 against the kind lab from scripts/k8s-test-setup.sh (DKO 1.0.0, ClusterIP service, port-forward).
When the Kubernetes side fails behind the port-forward tunnel, Diagnose Connection… blames the wrong layer. The manual says an unreachable Kubernetes API is reported in Connection settings and the check stops there (diagnose-connection.md).
API server unreachable (podman stop documentdb-dev-control-plane, then Diagnose on the discovered my-documentdb). Same result in a fresh session and with an existing tunnel:
- Connection settings: warning, "Port forward ready", "Stored password unavailable"
- TLS: failed, "Secure handshake closed … A firewall or IP allowlist may be blocking this connection"
- Result: Connection not tested, "Connect to the cluster and enter the password, then run the diagnosis again"
No ready pods behind the service (selector patched to match nothing):
- Result: Connection failed at Secure connection (TLS), "Secure handshake closed", plus the firewall hint
In both cases the real cause is only in the DocumentDB output channel, not in the panel or the report:
Port-forward backend resolution failed for documentdb-ns/documentdb-service-my-documentdb: request to https://127.0.0.1:<api-port>/api/v1/namespaces/documentdb-ns/endpoints/documentdb-service-my-documentdb failed, reason: connect ECONNREFUSED
Port-forward backend resolution failed for documentdb-ns/documentdb-service-my-documentdb: No ready pods found backing service "documentdb-service-my-documentdb" in namespace "documentdb-ns".
These lines carry no run= tag, so filtering the log by the report's run ID hides them. In the no-pods case, Authentication also runs after TLS has failed and waits out the driver's 30 s server-selection timeout.
A second tester reproduced all three runs (API down with a fresh tunnel, API down with an existing tunnel, no ready pods) in a separate VS Code profile.
Likely cause. The tunnel binds locally and resolves its backend pod on each incoming connection, so prepare reports success without contacting the API. The diagnostic credential read (KubernetesResourceItem → resolveDocumentDBCredentials, kubernetesClient.ts) catches every Secret/API error and returns undefined, so an API failure turns into "Stored password unavailable".
Expected. In diagnostic mode, prepare checks the backend (ready pod, through the API) before reporting the tunnel as ready, and fails Connection settings with the Kubernetes error. The credential read tells "API unreachable / forbidden" apart from "Secret has no password".
Recovery works: once the API or the selector is restored, a re-run passes.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(diagnostics): name the Kubernetes port forward in Connection sett…
feat(diagnostics): show Kubernetes port-forward details and redact ku…
docs(diagnostics): document Kubernetes port-forward reporting
chore: sync diagnostics localization
tnaum-ms commentedon Nov 9, 2026
Status: addressed in #1066. The PR is open and ready for review, not merged yet.
Root causes
preparereported Port forward ready as soon as it bound a local listener. The tunnel resolves its Kubernetes backend only when a connection arrives, sopreparenever contacted the Kubernetes API or the service's endpoints.127.0.0.1.What changed, by reported case
API server unreachable (fresh or existing tunnel)
0168783a(WI-K2): in diagnostic mode,preparechecks the Kubernetes backend (a ready pod on the service port, through the API) before it starts or reuses the tunnel. If the check fails, no new tunnel is started and an existing shared tunnel is left open.b1c184a9(WI-K3, l10n60ccb72a): newprepare.failedfinding with a bounded reason (sourceUnreachable,accessDenied,targetNotFound,noReadyBackend,sourceMissing,other) and Kubernetes wording, reported under Connection settings. The probes and Authentication that depend on it are skipped. No raw messages or names enter the results, and the finding code appears in the run's Output trace.bc124a25(WI-K1): strict diagnostic credential read, so Kubernetes API failures are no longer shown as a missing password. A Secret that can't be read (403/404) gives a specific Authentication skip instead of "enter the password". Ordinary connect, copy and save keep their best-effort behavior. Operator-approved exception: for generic services only, a 403 on the DKO resource list is ignored and the read continues to the annotated Secret. Network failures still propagate, and DKO services stay strict.No ready pods behind the service
preparecheck: reported as no ready backend under Connection settings. TLS and Authentication no longer run, so the 30 s server-selection wait is gone too.TLS / firewall wording
1cd90a0f(WI-G1): transport findings now record the address class. The TLS-closed title and explanation are neutral for every address. When every failing target is loopback, there is no firewall hint and the next steps are loopback-specific. This also fixes direct loopback connections, such as a stopped DocumentDB Local container. Public, mixed and unknown addresses keep the previous advice.Tests and docs
e9a8ae9e(WI-K4):TDD: Kubernetes diagnosisregression tests for the three cases (API down with a fresh tunnel, API down with an existing tunnel, no ready pods). They use the real runner, provider, tunnel manager and loopback sockets, and assert that no TLS, firewall or missing-password headline appears.99a34497(WI-D1): user manual, feature design, reachability-provider contract and decision record.2fd30d49(type-only lint fix) and0c54e890(localization and formatting).Follow-up from manual testing today
3d5e18e6,ba52502f,6df3937f,13753953:kubeContextidentifier kind), the namespace and the service.Not done / limitations
/readyzok, pod and EndpointSlice ready. Actual Diagnose runs under the outage cases are unverified, because inducing outages on the shared lab was judged unsafe. The fixed behavior is covered by automated tests, which are not a substitute for the manual outage experiment.How to verify
On the kind lab from
scripts/k8s-test-setup.sh, diagnose the discoveredmy-documentdb:docker stop documentdb-dev-control-plane(orpodman). Run Diagnose with and without an existing tunnel. Expected: the run fails at Connection settings with the Kubernetes API reason, and there is no TLS, firewall or missing-password headline. Start the container again afterwards.kubectl -n documentdb-ns get svc documentdb-service-my-documentdb -o jsonpath='{.spec.selector}'), patch it to match nothing, then run Diagnose. Expected: a no-ready-pods reason under Connection settings and no 30 s Authentication wait. Restore the selector afterwards; the operator may reconcile it back, so check before diagnosing.