AI for Sveltos fleets: opt-in AI setup pairing Sveltos with ConfigHub
Sveltos delivers and repairs add-ons across Kubernetes cluster fleets (ClusterProfile, Profile, SveltosCluster). ConfigHub (cub sveltos + ConfigHub plugin) adds offline fleet planning, rendered object schema checks, staged promotion (staging → prod-eu → prod-us), change reasons, and human approval before production clusters receive a release. Everything lives in examples/gitops-ai/sveltos/: ready to test with Sveltos users or adapt as an explicit sveltosctl ai setup opt-in subcommand.
Quick start
You need: a Sveltos fleet repository, Git, and Claude Code or Codex CLI (optional: kubectl, sveltosctl, and cub plugin install confighub/sveltos-confighub for live fleet export and offline planning).
| By hand | Ask your agent | |
|---|---|---|
| Preview opt-in setup | ./examples/gitops-ai/sveltos/sveltos-ai-setup.sh --dir . --client claude --dry-run (step 1) | "Preview what sveltos-ai-setup.sh would write in this fleet repo without changing anything." |
| Apply repo setup | ./examples/gitops-ai/sveltos/sveltos-ai-setup.sh --dir . --client claude (step 2) | "Apply the project-scoped Sveltos + ConfigHub AI setup for Claude Code." |
| Plan & check offline | cub sveltos plan my-fleet.yaml --stage-label env --stages staging,prod and cub config check (step 4) | "Run cub sveltos plan on my-fleet.yaml and validate all rendered objects with cub config check before touching a cluster." |
| Undo repo setup | ./examples/gitops-ai/sveltos/sveltos-ai-setup.sh --undo --dir . (step 5) | "Undo the Sveltos AI setup files from this repo and leave all ClusterProfiles untouched." |
Without ConfigHub: an AI agent with sveltosctl or kubectl can inspect live fleet status but cannot run offline staged promotion plans, schema-check rendered add-on manifests, or hold production fleet rollouts for human approval.
Deeper dive
The rest of this page shows the working sveltos-ai-setup.sh opt-in prototype (--dry-run, --client claude|codex|both, --install-plugins, --undo), offline fleet planning and schema validation, agent rules, and verification checks.
Show the full walkthrough
Human
What you need
A Sveltos fleet repository, Git, and Claude Code or Codex CLI. Optional for live fleet export and offline planning: kubectl, sveltosctl, and confighub/sveltos-confighub.
Steps
- Preview the opt-in AI setup with
--dry-runfirst (zero files modified)../examples/gitops-ai/sveltos/sveltos-ai-setup.sh --dir /path/to/your-fleet-repo --client claude --dry-run - Apply the project-scoped setup (writes
.claude/settings.json,AGENTS.md, andsveltos-with-confighub; never silently edits~/.claude/). Pass--client codexor--client bothfor Codex CLI, and optionally--install-plugins../examples/gitops-ai/sveltos/sveltos-ai-setup.sh --dir /path/to/your-fleet-repo --client claude - Confirm your management cluster context and export profiles and clusters read-only (excluding Secrets).
kubectl config current-context kubectl get clusterprofiles,sveltosclusters -A -o yaml > my-fleet.yaml - Plan offline and schema-check every rendered base before touching any cluster (see the full Bring your Sveltos fleet into ConfigHub guide for staged rollout and recovery order).
cub sveltos plan my-fleet.yaml --stage-label env --stages staging,prod cub sveltos apply my-fleet.yaml --stage-label env --stages staging,prod --out onboard for base in onboard/*/; do name=$(basename "$base"); cub config check "onboard/$name/$name.yaml"; done - Undo all project-scoped AI files cleanly in one command at any time; no
ClusterProfile, Sveltos controller, or global agent config is touched../examples/gitops-ai/sveltos/sveltos-ai-setup.sh --undo --dir /path/to/your-fleet-repo
Undo it
Run ./examples/gitops-ai/sveltos/sveltos-ai-setup.sh --undo --dir /path/to/your-fleet-repo. No cluster profiles, Sveltos controllers, or global agent settings are touched.
Agent
When working inside a Sveltos fleet repo with AGENTS.md and sveltos-with-confighub:
- Start offline and read-only: verify
kubectl config current-context, runsveltosctl show addons/cub sveltos plan, and validate rendered files withcub config check. - Explain exclusions and Helm hooks clearly: never pass
--include-hookswithout explicit human review. - Leave every live cluster step to the human operator: never run
bash onboard/apply.sh,bash onboard/handover.sh,kubectl applyon liveClusterProfiles,cub variant approve, or productioncub release publishyourself. - Never export or print Secrets or
sveltos-deliverygateway tokens.
Testing
Run sveltos-ai-setup.sh --dry-run first, then apply the project-scoped Sveltos + ConfigHub AI setup for Claude Code in this fleet repo.
Also add Codex skill wiring via sveltos-ai-setup.sh --client both without touching any ClusterProfile manifests.
Revert the Sveltos AI setup files with sveltos-ai-setup.sh --undo and confirm no fleet manifests were modified.
Explain how to move offline-validated Sveltos bases into a shared ConfigHub hub for staged promotion (staging to prod-eu to prod-us) without applying to live clusters yourself.
Ensure every generated Sveltos AI setup file is cleanly removed from the repository.
This proves: an explicit opt-in Sveltos AI setup (sveltos-ai-setup.sh, adaptable as sveltosctl ai setup or a co-launched Sveltos plugin) installs cleanly with --dry-run and --undo, never surprises non-AI users, and enforces read-only offline planning and schema checks before any live cluster handover.