TExcelTAD
Home › GitOps: Argo CD & Flux › Operating Flux: Status, Suspend & Alerts

Operating Flux: Status, Suspend & Alerts

Flux has no built-in dashboard, so day-to-day operation happens through the flux CLI, kubectl, and notifications. This lesson is the operator's toolbox: reading state, forcing a reconciliation, pausing an object during an incident, and getting told when things fail.

Reading state (sample sessions)

Every Flux object has a Ready condition; flux get turns them into tables:

bash
flux get all -A --status-selector ready=false     # only what's broken, everywhere
flux get kustomizations
text
NAME            REVISION                SUSPENDED       READY   MESSAGE
flux-system     main@sha1:40b2f3e1      False           True    Applied revision: main@sha1:40b2f3e1
infrastructure  main@sha1:40b2f3e1      False           True    Applied revision: main@sha1:40b2f3e1
linkly-staging  main@sha1:40b2f3e1      False           False   Deployment/linkly-staging/linkly status: 'InProgress'

Then drill down:

Command Shows
flux tree kustomization flux-system the tree of objects each Kustomization manages (from its inventory)
flux events --for Kustomization/linkly-staging the controller's events for one object
flux logs --level=error --since=1h controller logs, filtered
flux trace deployment linkly -n linkly-staging which Kustomization/HelmRelease and source revision produced this object
flux diff kustomization linkly-staging --path ./apps/staging what applying your local folder would change in the cluster (exit code 1 if anything)
flux stats counts of ready, failed and suspended objects per kind

flux trace answers the most common question in a GitOps incident ("where does this object come from, and which commit?") in one command.

Forcing and pausing

bash
# don't wait for the interval: fetch the source and apply now
flux reconcile kustomization linkly-staging --with-source

# incident: stop Flux from reverting a manual fix
flux suspend kustomization linkly-production
kubectl -n linkly-prod scale deploy/linkly --replicas=12      # the manual mitigation
# ... put the same change in Git, merge it, then:
flux resume kustomization linkly-production                  # resume also triggers a reconcile

suspend sets spec.suspend: true on the object. That is a change made outside Git, and the flux-system Kustomization that applied the object from Git would revert it at its next reconcile. The CLI avoids this fight because Flux's server-side apply doesn't own fields it never set (suspend isn't in your YAML). If you do put suspend: true in Git, Git wins, which is the declarative way to freeze an app for a planned maintenance.

Suspending also stops pruning and drift correction for that object's children; write the resume step into the incident runbook so a suspended object isn't forgotten for weeks (flux get all -A --status-selector suspended=true finds them; alert on it).

Notifications

The notification-controller turns Flux events into messages. A Provider says where (Slack, Microsoft Teams, Discord, PagerDuty, generic webhooks, and Git hosts for commit statuses), an Alert says which events go there. A Receiver works the other way: an HTTP endpoint for Git or registry webhooks that triggers an immediate reconcile.

bash · try it yourself
flux create alert-provider slack --type=slack --channel=linkly-deploys \
  --secret-ref=slack-webhook --export > notifications.yaml
flux create alert linkly-failures --provider-ref=slack --event-severity=error \
  --event-source="Kustomization/*" --event-source="HelmRelease/*" --export >> notifications.yaml
flux create receiver github --type=github --event=ping --event=push \
  --secret-ref=webhook-token --resource=GitRepository/linkly-deploy --export >> notifications.yaml
yq -N '.apiVersion + " " + .kind + "/" + .metadata.name' notifications.yaml
echo "--- strict validation:"
kubeconform -strict -summary -n 1 notifications.yaml   # one worker: errors in file order
echo "--- skipping kinds without a schema:"
kubeconform -strict -summary -ignore-missing-schemas notifications.yaml
notification.toolkit.fluxcd.io/v1 Provider/slack
notification.toolkit.fluxcd.io/v1 Alert/linkly-failures
notification.toolkit.fluxcd.io/v1 Receiver/github
--- strict validation:
notifications.yaml - Provider slack failed validation: could not find schema for Provider
notifications.yaml - Alert linkly-failures failed validation: could not find schema for Alert
Summary: 3 resources found in 1 file - Valid: 1, Invalid: 0, Errors: 2, Skipped: 0
--- skipping kinds without a schema:
Summary: 3 resources found in 1 file - Valid: 1, Invalid: 0, Errors: 0, Skipped: 2

The CLI writes notification.toolkit.fluxcd.io/v1 for all three kinds, but the schema catalog bundled with this kubeconform only has the older v1beta3 schemas for Alert and Provider. That is a realistic CI situation: new API versions land in the tools before they reach every schema catalog. -ignore-missing-schemas lets the pipeline pass, at the cost of not checking those objects, so say so in the pipeline log or generate the missing schemas from the CRDs (kubeconform ships an openapi2jsonschema.py script for that).

Two notification patterns worth copying:

  • Commit statuses: a Provider of type github (or gitlab, gitea, bitbucket) plus an Alert for Kustomizations marks each commit in the deploy repo with a green or red check once it has been applied, so the Git history shows which commits actually reached the cluster.
  • Only failures to chat, everything to a webhook: eventSeverity: error for humans keeps the channel quiet; info events to a log store give you an audit trail.

A daily health check, as a script

The commands above compose well. A typical cron or CI job on the platform team's side:

bash
#!/usr/bin/env bash
set -euo pipefail
broken=$(flux get all -A --status-selector ready=false --no-header | grep -v '^
  

 || true)
suspended=$(flux get all -A --status-selector suspended=true --no-header | grep -v '^
  

 || true)
[ -z "$broken$suspended" ] && { echo "flux: all objects ready, none suspended"; exit 0; }
printf 'Not ready:\n%s\nSuspended:\n%s\n' "${broken:-none}" "${suspended:-none}"
exit 1

Test yourself

During an incident you scale a Deployment by hand. How do you stop Flux from reverting it?

  1. Delete the GitRepository
  2. flux suspend kustomization <name>, then put the change in Git and resume
  3. Restart kustomize-controller
  4. Nothing: Flux never reverts manual changes

Which command tells you which Kustomization and Git revision produced a given Deployment?

  1. flux get sources git
  2. flux trace deployment <name> -n <ns>
  3. kubectl describe deployment
  4. flux stats

What does a notification-controller Receiver do?

  1. Sends Slack messages
  2. Exposes a webhook endpoint that triggers an immediate reconcile when, for example, GitHub reports a push
  3. Receives Helm charts
  4. Stores events