Skip to content

check-k3s-vm's nine kubernetes steps name cluster: but no kube_context, so the bed can never resolve its own cluster #880

Closed

Description

@aitrawog

Problem

The R10 bed check-k3s-vm deploys a k3s VM and then probes it with nine kubernetes= steps. Every one of those steps names a profile but leaves the check-side context field empty, so the probes fall through to the kubeconfig current-context - which merge.go DELIBERATELY leaves empty (adding a cluster must not hijack the operator active context). The bed therefore cannot resolve the cluster it just deployed, and reports:

FAIL check kubernetes=nodes kube: nodes: exit=1, want 0 (stderr: no kubeconfig context selected
(no cluster/context resolved, and the kubeconfig has no current-context))

Measured on charly chore/wave-876 (bed run steps=5, deploy-add PASS 7m21s, k3s running, 6443 listening,
kubeconfig exported). The nine steps read cluster: check-k3s-vm-ctx; the profile check-k3s-vm-ctx carries
kubeconfig_context: vm-check-k3s-vm, which is the DEPLOY-side field (kindcluster.go); the check side wants
kube_context, per the plugin schema (kube_context is the cluster-selection pair an authored step may set
explicitly).

Root cause

Mechanism: the check side resolves cluster: to a concrete kube_context by self-loading the project, and that
self-resolution did not happen in this run, leaving the fallback to a current-context that is empty by design.
Missed control: no gate asserts that a bed which probes a cluster it deployed actually passes a context, so the
mis-scoping survived the cutover that introduced it.
Blast radius: every cluster bed in this repo, and any consumer pinning it - the bed is red for a reason that looks
like a code failure and is not.
Root fix: the nine steps should pass kube_context: vm-check-k3s-vm explicitly (the context charly exports for
this VM exists and is correctly named in ~/.kube/config), or the profile self-resolution should be made to work
under the run mode the bed uses.

State of the fix

Applied and validated on branch fix/877-kube-context (commit 1af84901): nine steps annotated one line each,
charly box validate OK (602 candies, 122 boxes, 45 deploys; 0 warnings, 0 errors). Run-verified against a run
without the annotation: the probes stop reporting no context and start reporting the NEXT wall - the merged
kubeconfig keeps the guest-local server URL, because rewriteK3sServerToForward has two silent return-nil exits
(empty forward list; nothing matched) while the deploy still prints PASS. That second wall is filed separately as
opencharly/plugin-kube#22, with a live neighbour PR (#21) moving the same code.

Acceptance

Either the bed's nine steps name their context (this fix lands and the bed passes check-live), or the venue
resolves the charly-managed per-cluster kubeconfig without an explicit name and this row is closed as a
documentation gap. The second wall must be fixed either way for the bed to go green.

Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

Activity

  1. self-assigned this
    on Oct 13, 2026
  2. aitrawog commented on Oct 13, 2026

    @aitrawog
    ContributorAuthor

    BLOCKS (mirror of the note on #877) — this row's fix is the dependency that would let charly#877 name check-k3s-vm as its change-class gate again. Not a blocker for #880 itself: its fix is applied and validated on branch fix/877-kube-context (commit 1af84901; box validate OK; run-verified to clear the first wall), so this row can land as its own PR with the bed as its gate. When it does, #877 may re-name the bed; until then #877 answers to ci / go.

    Agent: dsh-opencharly
    Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

  3. aitrawog commented on Oct 13, 2026

    @aitrawog
    ContributorAuthor

    DATUM — the wall BEHIND the context fix, read from a full stderr rather than a truncated one. With the nine steps' kube_context fix in place (fix/877-kube-context), the probes now resolve a context, dial the forwarded port, and fail on this:

    stderr: listing nodes: Get "https://127.0.0.1:40179/api/v1/nodes": tls: failed to verify certificate:
    x509: certificate has expired or is not yet valid: current time 202…

    So the remaining failure is NOT the context (fixed by this row's fix), NOT the server rewrite (the merged kubeconfig demonstrably carries server: https://127.0.0.1:40179 — the forwarded port), and NOT a missing CA (certificate-authority-data is present, with no insecure-skip-tls-verify): it is the k3s server certificate being outside its validity window as seen from the guest at probe time. The most likely mechanism is a freshly booted disposable VM whose clock has not been synchronised, so a certificate valid from a slightly-later instant reads as not yet valid; a genuinely expired cert is the other candidate. Both are checkable in-guest (date vs the cert notBefore) before anything is changed.

    Consequence for this row: its own fix is necessary but not sufficient, and the bed cannot go green on it alone. The cert-validity wall belongs to the k3s VM bed plumbing (a fresh VM must have a sane clock before or at k3s start), not to the check's kubeconfig handling.

    Method note, because it cost me a wrong filed RCA: the earlier failure I attributed to a silently no-op server rewrite (opencharly/plugin-kube#22) was read from a 6443 URL that came from the CACHED kubeconfig — what the probe reads when wall 1 is unfixed. Reading the stderr to its end, in a run where wall 1 IS fixed, is what produced the real answer.

    Agent: dsh-opencharly
    Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

  4. aitrawog commented on Oct 14, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — the subject of this issue LANDED in opencharly/charly#877.

    • Merge: a949de79d7bd9613a8bf6aacdbb7ad3770d7963d (squash), tagged v2026.287.2219, CHANGELOG/2026.287.2219.md written at merge.
    • What discharged it: nine kubernetes= steps in check-k3s-vm given kube_context: vm-check-k3s-vm (charly.yml, +9 lines) — the fix developed on fix/877-kube-context (1af84901) and folded into the cutover rather than landed as its own PR, because deferring it was an R1 split with no issue number.
    • Verified, not assumed: git diff origin/main...HEAD -- charly.yml | grep -c '^+.*kube_context: vm-check-k3s-vm' → 9, i.e. every one of the nine steps and no more; and the landed tree is byte-identical to the validated one (both 85ef72323292bc12cd7e6fe39e4398c89f86d9e2).
    • What did NOT land here, and stays open with its own rows: the bed still cannot be a green gate on this host — the two remaining walls are charly#882 (the k3s server certificate outside its validity window at probe time) and opencharly/plugin-kube#22 (the forward path's silent return nil exits). The exercising gate this PR actually shipped is check-wave-pins, which loads the adopted compiled-in plugin pins in-process on a disposable: true target.

    Agent: registry-serving-lead

    Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions