Files
Holocron/plugins/gitops/.apm/skills/flux-diagnose/references/diagnose.md
T
Defame1297andClaude Opus 5.5 2a6eea3db1 feat(gitops): add flux-diagnose for read-only Flux reconcile checks
flux-diagnose reports source, Kustomization and HelmRelease state,
answers "has this commit been applied yet?" with bounded polling (a cap
counted in 60-second kubectl wait pauses, never flux reconcile), and
walks a failure down the source -> Kustomization -> HelmRelease chain,
handing workload problems to k8s-diagnose. Read tier only; it uses the
caller's kubeconfig and never looks for credentials.

gitops 0.2.0; the package description now covers live reconcile state.

Refs: #194

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-24 20:34:42 +00:00

4.3 KiB

source_keys
source_keys
adr-0032-action-tiers
delivery-guard-flux-allowlist

Diagnose flow

Find why a Flux object is failing, walking the dependency chain from source to Kustomization to HelmRelease. Read tier only; every command here is in the SKILL.md tier table.

1 — Find the object

  • Given a Flux object (source, Kustomization, HelmRelease) → start from it.
  • Given a workload or other Kubernetes object → flux trace <kind> <name> -n <ns> names the Kustomization or HelmRelease that owns it and the source revision; start from that owner. Not Flux-managed → say so and stop.
  • Given only a symptom ("Flux is stuck") → flux get all -A --status-selector ready=false; take every failing object as a candidate.

2 — Rule out the controllers

Run flux stats -A. When most objects are failing, or nothing has reconciled for longer than its interval, run flux check. A controller reported not ready ends the walk: the finding is the controller, handed off as a workload in flux-system. If flux check itself returns forbidden, report controller health as unknown and continue.

3 — Walk upstream first

The chain is: source (GitRepository, OCIRepository, HelmRepository, HelmChart, Bucket) → Kustomization → HelmRelease, plus every dependsOn edge. Downstream objects fail as a symptom of an upstream one (ArtifactFailed, DependencyNotReady), so diagnose the most upstream failing object and treat the rest as consequences.

For each object on the path, read in this order and stop once the cause is clear:

  1. flux get <kind> <name> -n <ns> — Ready, revision and message.
  2. flux events --for <Kind>/<name> -n <ns> --types warning.
  3. flux logs --kind <Kind> --name <name> -n <ns> --level error --since 1h.

A HelmRelease's upstream is its chart: the HelmChart (from a HelmRepository) or the OCIRepository named in spec.chartRef.

4 — Read the reason

Kind Ready reason or message Meaning Next
source authentication or secretRef error credentials rejected or missing name the secretRef only, never read it; human fixes the Secret
source fetch, clone or timeout error remote unreachable or ref missing check the ref exists in the repo; report
Kustomization ArtifactFailed source artifact unavailable walk to the source
Kustomization DependencyNotReady a dependsOn object is not Ready walk to that object
Kustomization BuildFailed kustomize build failed on the repo content repo fix by PR; reproduce offline with flux build kustomization <name> --path <dir> --kustomization-file <ks.yaml> --dry-run
Kustomization ReconciliationFailed apply rejected: schema, immutable field, missing CRD or namespace, decryption repo fix by PR, or a human for an immutable field
Kustomization HealthCheckFailed applied, but a workload never became ready hand the named workload to k8s-diagnose
Kustomization PruneFailed garbage collection was refused report the object named in the message
HelmRelease ArtifactFailed, chart not ready chart unavailable walk to the chart source
HelmRelease InstallFailed, UpgradeFailed Helm action failed or timed out waiting read the message; workload not ready → k8s-diagnose
HelmRelease TestFailed a Helm test pod failed hand the test pod to k8s-diagnose
HelmRelease RollbackSucceeded and others after remediation the upgrade failed and was undone report the original failure from events
HelmRelease Stalled, retries exhausted the controller stopped retrying a fixing commit or a human odd job resumes it

A message this table does not cover: quote its first line and the events that match it, and say the cause is unclassified. Do not guess.

5 — Return

Output format:

Root cause: <Kind> <ns>/<name> — <reason>: <one-line cause>
| Step | Kind | Namespace/Name | Ready | Reason | Finding |
Next: <action> (<tier>) | k8s-diagnose on <Kind> <ns>/<name>

One row per object walked, upstream first. Next names one action and its tier from the SKILL.md table: a repo change is Apply-by-merge, flux reconcile is an odd job for a human, and a workload fault routes to k8s-diagnose. Never paste Secret data, Helm values or full log text; quote one line.