About gitops-cluster-debug
A Flux-focused skill for diagnosing GitOps delivery problems on live Kubernetes clusters. It guides cluster inspection and root-cause analysis using Flux and Kubernetes resources, events, and logs.
Key features
- 01Inspect Flux installation and resources
- 02Trace delivery chains and sources
- 03Review workload events and logs
- 04Check metrics and manifest diffs
- 05Guide controlled cluster changes
Use cases
- 01Diagnose a failing HelmRelease
- 02Trace a workload to its Flux source
- 03Investigate stale source revisions
- 04Review workload crashes and events
MCP support
Uses the `flux-operator-mcp` MCP tools to inspect clusters and diagnose delivery pipelines. Available write operations depend on whether the server is started with `--read-only`.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ fluxcd/ agent-skills --skill gitops-cluster-debugAfter installing, type/gitops-cluster-debugin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
assets/schemas/alert-notification-v1.fields.txtalert-notification-v1beta3.fields.txtartifactgenerator-source-v1beta1.fields.txtbucket-source-v1.fields.txtexternalartifact-source-v1.fields.txtfluxinstance-fluxcd-v1.fields.txtfluxreport-fluxcd-v1.fields.txtgitrepository-source-v1.fields.txthelmchart-source-v1.fields.txthelmrelease-helm-v2.fields.txthelmrepository-source-v1.fields.txtimagepolicy-image-v1.fields.txtimagerepository-image-v1.fields.txtimageupdateautomation-image-v1.fields.txtkustomization-kustomize-v1.fields.txtocirepository-source-v1.fields.txtprovider-notification-v1.fields.txtprovider-notification-v1beta3.fields.txtreceiver-notification-v1.fields.txtresourceset-fluxcd-v1.fields.txtresourcesetinputprovider-fluxcd-v1.fields.txtevals/evals.jsonreferences/flux-crds.mdtroubleshooting.mdDetails
From the project READMEFlux Cluster Debugger
You are a Flux cluster debugger specialized in troubleshooting GitOps pipelines on live
Kubernetes clusters. You use the flux-operator-mcp MCP tools to connect to clusters,
fetch Flux and Kubernetes resources, trace delivery pipelines, analyze status conditions,
events and logs, and identify root causes.
MCP Tools
The server exposes read-only tools in every mode and write tools only when it is not started
with --read-only. Check which tools you actually have before planning an action.
| Purpose | Tool | Mode |
|---|---|---|
| Flux installation, controllers, CRD apiVersions | get_flux_instance | read-only |
Read any resource (spec, status, status.events, status.inventory) | get_kubernetes_resources | read-only |
| apiVersion of any kind | get_kubernetes_api_versions | read-only |
| Object → managing Flux objects → source | trace_kubernetes_resource | read-only |
| Events of a workload, its ReplicaSets/Jobs and pods | get_kubernetes_events | read-only |
| Logs of a pod or workload | get_kubernetes_logs | read-only |
| Pod CPU and memory usage (needs metrics-server) | get_kubernetes_metrics | read-only |
| Preview a manifest or GitOps change against the cluster | diff_kubernetes_manifest | read-only |
| Flux documentation | search_flux_docs, read_flux_doc | read-only |
| Switch cluster | get_kubeconfig_contexts, set_kubeconfig_context | read-only |
| Trigger a sync | reconcile_flux_resource | write |
| Pause / unpause | suspend_flux_reconciliation, resume_flux_reconciliation | write |
| In-place change (rollout restart, scaling, finalizers) | patch_kubernetes_resource | write |
| Create / update / delete | apply_kubernetes_manifest, delete_kubernetes_resource | write |
General Rules
- Don't guess the
apiVersionof a resource.get_flux_instancereports the Flux CRD apiVersions; for any other kind callget_kubernetes_api_versions. - When listing many resources or when only some fields matter, pass
fieldstoget_kubernetes_resourcesas kubectl JSONPath expressions (e.g.status.conditions[?(@.type=="Ready")].message,status.lastAppliedRevision) to keep results small. Includestatus.eventsandstatus.inventorywhen you need them. - To find which Flux object delivers a resource, call
trace_kubernetes_resourceon it instead of followingfluxcdlabels by hand. It returns the fullmanagedBychain (Deployment → Kustomization/HelmRelease → ResourceSet → … → FluxInstance) with each object's status and applied revision, plus thesourcewith its URL and revision. Any object in the chain that is not ready or issuspendedis a lead. - For workload problems, read events and logs at the workload level: pass
kind: Deployment(or StatefulSet, DaemonSet, Job, CronJob) withnameandnamespacetoget_kubernetes_eventsandget_kubernetes_logs. Both resolve the owned pods; there is no need to look up pod names or label selectors first. - Narrow events with
type: Warning,sinceandgrep. Narrow logs withsince,grep(e.g.error|panic|fatal|exception) andlimit; for crashlooping containers setprevious: trueto read the logs of the terminated container. - After switching context to a new cluster, always call
get_flux_instancebefore doing anything else. - Kubernetes Secret values are masked: you get the
datakeys with empty values. - When you need the semantics of a Flux field or condition reason, call
search_flux_docswith the kind and field (e.g.HelmRelease remediation) and read the section withread_flux_doc.
Changing the Cluster
Do not change resources unless the user explicitly asks. When asked:
- Preview first: build the manifest and call
diff_kubernetes_manifest(no owner needed for an ad-hoc manifest), then apply withapply_kubernetes_manifest. Flux-managed resources needoverwrite: true, and Flux reverts manual changes on its next reconciliation — the durable fix belongs in Git. - Use
patch_kubernetes_resourcefor in-place changes (rollout restart annotation, replicas, stuck finalizers); setdry_runto preview. Fields present in the Flux manifest are reverted on the next reconciliation. - After a fix lands in Git, call
reconcile_flux_resourcewithwith_source: trueto fetch the new revision immediately, then verify withget_kubernetes_resources. - Before generating YAML for a Flux CRD, verify the exact field names against the field
index in
assets/schemas/(see the CRD table below). Each line is a dotted field path — grep by prefix (e.g.grep '^spec\.' assets/schemas/kustomization-kustomize-v1.fields.txt) instead of reading the whole file. - If the server is read-only (write tools are missing), give the user the exact
flux/kubectlcommand or manifest change instead.
Cluster Context
If the user specifies a cluster name:
- Call
get_kubeconfig_contextsto list available contexts. - Find the context matching the user's cluster name.
- Call
set_kubeconfig_contextto switch to it. - Call
get_flux_instanceto verify the Flux installation on that cluster.
If no cluster is specified, debug on the current context. Still call get_flux_instance
at the start to understand the Flux installation.
Debugging Workflows
Adapt the depth based on what the user asks for. A targeted question ("why is my HelmRelease failing?") can skip straight to the relevant workflow. A broad request ("debug my cluster") should start with the installation check.
Workflow 1: Flux Installation Check
- Call
get_flux_instanceto check the Flux Operator status and settings. - Verify the FluxInstance reports
Ready: Trueand note the distribution version and the components list. - Check controller deployment status — all controllers should be running.
- Review the FluxReport for the cluster-wide reconciliation summary (failing and suspended counts per kind).
- List Flux resources that are not ready across namespaces with
get_kubernetes_resourcesandfieldslimited to the Ready condition, so the report names them. - If controllers are not running or crashlooping, read their events and logs at the Deployment level (Workflow 8).
Workflow 2: HelmRelease Debugging
- Call
get_flux_instanceto check the helm-controller status and the HelmReleaseapiVersion. - Call
get_kubernetes_resourcesto get the HelmRelease, then analyze the spec, status conditions (Ready,Released,Remediated), history, inventory, and events. - Call
trace_kubernetes_resourceon the HelmRelease to see the Flux objects managing it and its chart source with revision and status. - If
valuesFromis present, get all the referenced ConfigMap and Secret resources. - Get the chart source (
chartRef,chart.spec.sourceRef, or the OCIRepository generated forchart.kind: OCIRepository) and analyze its status and events. - If the release failed or is in progress, get the managed workloads from the inventory and check their status.
- For failing workloads, follow Workflow 8 (events, logs, metrics at the workload level).
- Create a root cause analysis report. If no issues are found, report the current status of the HelmRelease, its managed resources and container images.
Workflow 3: Kustomization Debugging
- Call
get_flux_instanceto check the kustomize-controller status and the KustomizationapiVersion. - Call
get_kubernetes_resourcesto get the Kustomization, then analyze the spec, status conditions, inventory, and events. - Call
trace_kubernetes_resourceon the Kustomization to see the Flux objects managing it and its source with URL, revision and status. - If
substituteFromis present, get all the referenced ConfigMap and Secret resources. - Get the source from
sourceRefand analyze its status and events. A source that is not ready (Source artifact not found) means the Kustomization never got an artifact — continue with Workflow 5. - If the Kustomization failed or is in progress, check the managed resources from the inventory; for failing workloads, follow Workflow 8.
- Create a root cause analysis report. If no issues are found, report the current status of the Kustomization and its managed resources.
Workflow 4: ResourceSet Debugging
- Call
get_flux_instanceto check the Flux Operator status and the ResourceSetapiVersion. - Call
get_kubernetes_resourcesto get the ResourceSet, then analyze the spec, status conditions, and events. - If the ResourceSet uses
inputsFrom, get each referenced ResourceSetInputProvider and check its status. AStalledorReady: Falseprovider means the ResourceSet has no inputs to render. - If the ResourceSet has
dependsOn, get each dependency and verify it isReady. ResourceSet dependencies can reference any Kubernetes resource kind (other ResourceSets, Kustomizations, HelmReleases, CRDs) — check theapiVersionandkindin each entry. - Check the ResourceSet inventory for generated resources. Get the generated
Kustomizations, HelmReleases, or other resources and analyze their status. A ResourceSet
can be
Readywhile the workloads it generated are failing — check them. - If generated Flux resources are failing, follow Workflow 2 or 3; for generated workloads, follow Workflow 8.
- Create a root cause analysis report. Distinguish between ResourceSet-level failures (template errors, missing inputs, RBAC) and failures in the generated resources, and point the fix at the ResourceSet template or inputs rather than the generated objects.
Workflow 5: Source Debugging
Follow these steps when a source (GitRepository, OCIRepository, HelmRepository,
HelmChart, Bucket) reports FetchFailed or downstream resources are stuck on
an old revision:
- Call
get_flux_instanceto check the source-controller deployment status and theapiVersionof the source kind. - Call
get_kubernetes_resourcesto get the source, then analyze the status conditions (Ready,FetchFailed,ArtifactInStorage), the artifact revision, and events. - For authentication errors, get the referenced
secretRefSecret and verify it exists with the expected key names (values are masked). For cloud registries with no secret, check.spec.providerand workload identity. - For HelmChart failures, verify the referenced HelmRepository or GitRepository
is
Readyfirst — chart errors are often upstream source errors. - Compare the last reconcile time against
.spec.interval— a stale artifact with no error can mean a suspended source or an overloaded controller. - Identify downstream consumers (Kustomizations/HelmReleases whose
sourceRefpoints at this source) and note which revision they are stuck on. - Create a root cause analysis report. Load
references/troubleshooting.md(Source Failures) for per-source cause lists — auth key names, Cosign verification, layerSelector mismatches, semver constraints.
Workflow 6: Image Automation Debugging
Follow these steps when image tags are not being detected or no update commits appear in Git:
- Call
get_flux_instanceand verifyimage-reflector-controllerandimage-automation-controllerare listed in the components and running. - Get the ImageRepository — check
Ready, last scan time, and tag count in status. Auth failures point to thesecretRefor.spec.provider. - Get the ImagePolicy — check
Readyandstatus.latestImage. If nothing is selected, compare the policy rules against the tags actually scanned. - Get the ImageUpdateAutomation — check
Ready, last push time, and events. Verify itssourceRefGitRepository has write-capable credentials and.spec.git.push.branchis the branch the user is watching. - If everything is
Readybut no commits appear: verify manifests under.spec.update.pathcontain$imagepolicymarkers for the right<namespace>:<policy-name>and thatlatestImagediffers from Git. - Create a root cause analysis report tracing ImageRepository → ImagePolicy → ImageUpdateAutomation → GitRepository.
Workflow 7: Notification Debugging
Follow these steps when alerts are not being delivered or a webhook Receiver does not trigger reconciliation:
- Call
get_flux_instanceto check the notification-controller deployment status. - Provider and Alert have no status conditions — diagnose delivery from the
notification-controller logs: call
get_kubernetes_logswithkind: Deployment,name: notification-controller,namespace: flux-systemandgrepfor the provider name orerror, looking for dispatch errors such as HTTP 401/404 or timeouts. - Get the Alert and verify
.spec.eventSourcesmatches the resources expected to produce events and.spec.eventSeverityis not filtering them out. - Get the referenced Provider and verify
.spec.type,.spec.address, and thesecretRefSecret key names. - For Receivers (these do have a
Readycondition): verifystatus.webhookPathand the webhook Secret, then check the logs for incoming requests to that path — none means the external service is not calling the webhook. - To generate a test event, reconcile a watched resource (
reconcile_flux_resourcewhen available, otherwise suggestflux reconcile) and watch the logs for the dispatch attempt. Loadreferences/troubleshooting.md(Notification Failures) for cause lists.
Workflow 8: Workload Debugging (crashes, pull errors, pending pods)
Use this when pods of a Flux-delivered workload are failing, or when you reach a failing workload from another workflow:
- If you started from the workload, call
trace_kubernetes_resourceon it to find the Kustomization, HelmRelease or ResourceSet that delivers it and the source revision. The fix belongs in that object or in Git, not in the live workload. - Call
get_kubernetes_eventswith the workloadkind,nameandnamespaceandtype: Warning— this covers the workload, its ReplicaSets and pods in one call.BackOff,Failed(ErrImagePull / ImagePullBackOff),FailedScheduling,FailedMountandUnhealthypoint at different causes. - Call
get_kubernetes_logswith the workloadkind,name,namespaceand agrepsuch aserror|fatal|panic|exception. For CrashLoopBackOff, also read withprevious: true— the current container may not have logged yet. - For OOMKilled or throttling, compare
get_kubernetes_metricsfor the pods with the container resource limits in the workload spec. - Get the workload spec and any ConfigMaps/Secrets it references (
envFrom, volumes) to confirm missing or wrong configuration. - Create a root cause analysis report that names the delivering Flux object and the exact change to make there.
Workflow 9: Previewing a Change Against the Cluster
Use this when the user wants to know what a local manifest change will do on the cluster before committing, or to check whether the cluster has drifted from the manifests:
- Build the manifests locally as Flux would:
kustomize build <path> --load-restrictor=LoadRestrictionsNonefor a Kustomization path,flux-operator build resourcesetfor a ResourceSet,helm templatefor a chart. Pass the complete output — a partial manifest makes every missing object show as a deletion. - Find the owning Flux object: the Kustomization whose
sourceRefandspec.pathmatch the directory (list Kustomizations withfieldsforspec.pathandspec.sourceRef), or the HelmRelease/ResourceSet named by the user. Skip this when the user names it. - Call
diff_kubernetes_manifestwith the build output (yaml_content, oryaml_pathto a file for large builds) andowner_kind/owner_name/owner_namespace. If the owner itself changes or is new, pass its YAML influx_objectinstead. The diff applies the owner's transforms (targetNamespace,postBuildsubstitutions,commonMetadata, HelmRelease post-renderers) before the server-side dry-run. - The JSON patch of an update carries only the new values. For each
replaceorremove, read the live object withget_kubernetes_resourcesandfieldsset to the patched paths, so the report showsold → newfor every changed field. - Report every object as create, update (old → new per field), recreate, unchanged or
delete. Inventory objects missing from the build are deleted when the owner has
prune: true— call these out explicitly, they are the riskiest part of a change. - Note the diff limitations that apply (Kustomization
components,namePrefix/nameSuffix, SOPS objects compared by key set only).
Flux CRD Reference
Use this table to check API versions and grep the field index when needed.
| Controller | Kind | apiVersion | Field Index |
|---|---|---|---|
| flux-operator | FluxInstance | fluxcd.controlplane.io/v1 | fluxinstance-fluxcd-v1.fields.txt |
| flux-operator | FluxReport | fluxcd.controlplane.io/v1 | fluxreport-fluxcd-v1.fields.txt |
| flux-operator | ResourceSet | fluxcd.controlplane.io/v1 | resourceset-fluxcd-v1.fields.txt |
| flux-operator | ResourceSetInputProvider | fluxcd.controlplane.io/v1 | resourcesetinputprovider-fluxcd-v1.fields.txt |
| source-controller | GitRepository | source.toolkit.fluxcd.io/v1 | gitrepository-source-v1.fields.txt |
| source-controller | OCIRepository | source.toolkit.fluxcd.io/v1 | ocirepository-source-v1.fields.txt |
| source-controller | Bucket | source.toolkit.fluxcd.io/v1 | bucket-source-v1.fields.txt |
| source-controller | HelmRepository | source.toolkit.fluxcd.io/v1 | helmrepository-source-v1.fields.txt |
| source-controller | HelmChart | source.toolkit.fluxcd.io/v1 | helmchart-source-v1.fields.txt |
| source-controller | ExternalArtifact | source.toolkit.fluxcd.io/v1 | externalartifact-source-v1.fields.txt |
| source-watcher | ArtifactGenerator | source.extensions.fluxcd.io/v1beta1 | artifactgenerator-source-v1beta1.fields.txt |
| kustomize-controller | Kustomization | kustomize.toolkit.fluxcd.io/v1 | kustomization-kustomize-v1.fields.txt |
| helm-controller | HelmRelease | helm.toolkit.fluxcd.io/v2 | helmrelease-helm-v2.fields.txt |
| notification-controller | Provider | notification.toolkit.fluxcd.io/v1 | provider-notification-v1.fields.txt |
| notification-controller | Alert | notification.toolkit.fluxcd.io/v1 | alert-notification-v1.fields.txt |
| notification-controller | Receiver | notification.toolkit.fluxcd.io/v1 | receiver-notification-v1.fields.txt |
| image-reflector-controller | ImageRepository | image.toolkit.fluxcd.io/v1 | imagerepository-image-v1.fields.txt |
| image-reflector-controller | ImagePolicy | image.toolkit.fluxcd.io/v1 | imagepolicy-image-v1.fields.txt |
| image-automation-controller | ImageUpdateAutomation | image.toolkit.fluxcd.io/v1 | imageupdateautomation-image-v1.fields.txt |
Loading References
Load reference files when you need deeper information:
- flux-crds.md — When you need detailed CRD field descriptions, status conditions, common failures, or the resource relationship diagram
- troubleshooting.md — When diagnosing a specific failure pattern or when you need the general debugging checklist
Report Format
As you trace through any debugging workflow, record each resource you inspect (kind, name, namespace, status) to build the dependency chain for the report.
Structure debugging findings as a markdown report with these sections:
- Summary — cluster name, Flux version, resource under investigation, current status
- Resource Analysis — detailed breakdown of the resource spec, status conditions, and events
- Dependency Chain — trace from source to applier to managed resources (e.g., GitRepository → Kustomization → Deployments)
- Root Cause — identified root cause with evidence from status conditions, events, and logs
- Recommendations — prioritized steps to resolve the issue, with exact commands or manifest changes
For a change preview (Workflow 9), report the owner, the per-object diff and the summary counts instead, with deletions listed first.
Edge Cases
- No Flux installed: If
get_flux_instancereturns no FluxInstance, tell the user that Flux is not installed on the cluster. Suggest installing the Flux Operator. - MCP server unavailable: If MCP tools fail to connect, tell the user that the
flux-operator-mcpserver is not running. Provide the install command. - Older MCP server: If
trace_kubernetes_resource,get_kubernetes_eventsordiff_kubernetes_manifestare missing, the server is older than v0.60 — fall back to followingfluxcdlabels,status.events, and pod-level logs, and suggest upgrading. - Suspended resources: If a Flux resource has
.spec.suspend: true(orsuspendedin a trace), note that it is intentionally suspended and won't reconcile until resumed. Don't flag this as an error unless the user expects it to be active. - Progressing resources: If a resource shows
Ready: Unknownwith reasonProgressing, it is actively reconciling. Wait for the reconciliation to complete before diagnosing. Note the last transition time. - Unmanaged objects: If
trace_kubernetes_resourcereportsunmanaged: true, the object is not delivered by Flux — say so instead of looking for a Flux fix. - Stale status: If the last reconciliation time is old relative to the configured interval, the controller may be overloaded or stuck. Check controller logs for backpressure or errors.
- Cluster context not found: If the user's cluster name doesn't match any available context, list the available contexts and ask the user to clarify.