一键导入
cluster-upgrade
Use when upgrading a running Cozystack v1.x cluster to a newer v1.x patch or minor version. Not for v0.x → v1.0 major migration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when upgrading a running Cozystack v1.x cluster to a newer v1.x patch or minor version. Not for v0.x → v1.0 major migration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Bootstrap Talos Linux nodes into a Cozystack-ready cluster via talm. Default assumption is that the operator's nodes are already in Talos maintenance mode (the standard starting point — Talos boots from a nocloud/raw image and listens on :50000 awaiting machine-config). When that's the case the skill goes straight to `talm init` and `talm apply`, no OCI / PXE / ISO dance needed. When nodes are not yet imaged, the skill offers a boot-method picker (OCI Custom Image, PXE/iPXE, boot-to-talos, ISO) and walks the operator through getting them into maintenance mode first. Verifies the resulting cluster has the cozystack-tuned extensions (drbd, zfs, openvswitch) and the LVM filter before handing off to `cozystack:cluster-install`.
Bootstrap a UI dev sandbox — Playwright end-to-end testing scaffolding for the Cozystack console UI (vendored in the monorepo at `packages/system/dashboard/images/console`) plus a Vite dev server connected to a chosen Kubernetes cluster. Use whenever the operator wants to fix, debug, screenshot, or write Playwright tests against the Cozystack console — e.g. "prepare the console UI for a fix", "spin up cozystack-ui against my dev cluster", "install playwright in the console", "give me a UI sandbox pointing at <kubeconfig>". Handles monorepo worktree creation, @playwright/test + Chromium install, playwright.config.ts, dev:e2e / test:e2e scripts, kubectl proxy against a kubeconfig, and a Vite server on a free port so the operator can immediately start poking at the running app.
Use when installing Cozystack on an existing Kubernetes cluster (kubeadm / k3s / RKE2 / managed). Discovers cluster facts, validates node readiness via kubectl debug, recommends an installer + platform variant, gathers values interactively, creates the ZFS pool on each storage node through kubectl debug (cozystack standardises on ZFS for LINSTOR — LVM / LVM-thin paths are not supported), installs extractedprism (per-node kube-apiserver HA proxy, generic variant default), installs the cozy-installer chart, applies the Platform Package, patches the root Tenant for ingress (breaks the OIDC chicken-and-egg), waits until every HelmRelease is Ready, prints a NOTES-style access summary, and offers an issue-template handoff to cozystack/* on fatal failure. Not for Kubernetes bootstrap and not for upgrades — see `cozystack:cluster-upgrade` for that. Talos node-prep is out of scope — `cozystack:cluster-install` refuses if Talos nodes are missing cozystack-tuned extensions and points at `cozystack:talos-bootstrap`.
Use this as the entry point for installing Cozystack from scratch. Asks one question — Talos / Ubuntu / Existing cluster — then dispatches the right chain of skills. Routes are `talos-bootstrap → cluster-install` (Talos), `ubuntu-bootstrap → cluster-install` (Ubuntu/Debian; ubuntu-bootstrap wraps cozystack/ansible-cozystack), or `cluster-install` direct (existing self-managed or managed k8s). All artifacts (inventory.yml, kubeconfig, .state.yaml, cozystack-platform-package.yaml) live in a cluster config directory the operator picks, so the result is a directory they can manage as code in their own git workflow. Refuses for clusters that already run Cozystack and points the operator at `cozystack:cluster-upgrade`.
Investigate and resolve a stuck or broken Cozystack install. Gathers symptoms via kubectl, classifies the failure (operator error / config drift / upstream bug / not-yet-supported), looks up the relevant cozystack docs to verify the operator did the right thing, searches the cozystack monorepo source for the failure path, applies a local fix or workaround when one exists, and on operator approval drafts an upstream issue with the diagnostic bundle. Never opens PRs and never opens issues silently — drafts get an explicit yes/no per filing. The `cozystack:wizard` auto-dispatches this skill whenever a downstream skill in the chain reports `failed_at` in `.state.yaml`. Also callable directly when an already-running cluster develops a problem.
Scaffold a new Cozystack external app package inside an external-apps repository. Generates the full chart skeleton (Chart.yaml, Makefile, values.yaml with cozyvalues-gen annotations, templates), registers it in core/platform (namespace, HelmRepository, HelmChart, HelmRelease, ApplicationDefinition), and wires dependency integration — supports managed CNPG Postgres clusters provisioned in-chart and external secret references for pre-existing services. Use when adding a new application (e.g. Immich, Gitea, Nextcloud) to an external-apps repo that follows the cozystack/external-apps-example layout.
| name | cluster-upgrade |
| description | Use when upgrading a running Cozystack v1.x cluster to a newer v1.x patch or minor version. Not for v0.x → v1.0 major migration. |
Guided upgrade of a running Cozystack v1.x cluster. Source of truth: https://cozystack.io/docs/<vX.Y>/operations/cluster/upgrade/ (substitute the version selector value matching your target — e.g. v1.3).
Release-notes-driven upgrade. Every release changes a specific set of components. Generic "all green" checks miss regressions in the areas that actually changed. Read the target's release notes, extract the change list, and run targeted pre/post checks — not just the default health checklist.
Match the operator's natural language. Detect from prior conversation messages (or read <config-dir>/.state.yaml operator_language if a wizard chain is in progress). Use it in every prompt, AskUserQuestion option, summary, and gate. Never ask "what language?" separately. Code identifiers, commands, file paths, and GitHub-public text stay in their canonical form.
One valid path → just do it. After the operator approved the risk summary at the upgrade stop gate, the skill runs helm upgrade + post-upgrade health checks + tenant verification back-to-back. Approval gates remain only for the named STOP GATEs in the workflow (risk summary, helm upgrade itself, final report) and for any rollback action (always destructive-risky).
Front-load the interview. Read the cluster + release notes + pre-flight checks up front and surface a single risk-summary screen with the upgrade plan, change-list, and any blockers. Approval of that screen is the only interview gate — subsequent phases (helm upgrade, post-upgrade checks) execute without re-prompting.
Layer-pure operator output. The skill never says "returning control to wizard" or any other orchestration commentary in the operator-facing summary. Whoever invoked the skill (a human directly, or a chain orchestrator) figures out what's next on their own. Internal documentation references are fine; wizard does not appear in text shown to the operator.
digraph upgrade_flow {
"0. Identify versions" [shape=box];
"1. Analyze release notes" [shape=box];
"2. Pre-flight" [shape=box];
"GATE: change-risk summary" [shape=diamond];
"3. Protect resources" [shape=box];
"4. helm upgrade" [shape=box];
"5. Monitor" [shape=box];
"6. Post-upgrade checks" [shape=box];
"GATE: final report" [shape=diamond];
"Done" [shape=doublecircle];
"0. Identify versions" -> "1. Analyze release notes" -> "2. Pre-flight" -> "GATE: change-risk summary";
"GATE: change-risk summary" -> "3. Protect resources" [label="approved"];
"GATE: change-risk summary" -> "abort" [label="denied"];
"3. Protect resources" -> "4. helm upgrade" -> "5. Monitor" -> "6. Post-upgrade checks" -> "GATE: final report" -> "Done";
}
Request explicit user approval before each. Prior approval does NOT carry forward.
helm upgrade itself — show current→target version, chart version, change-risk summary.Tenant, TenantControlPlane, or sh.helm.release.v1.* secrets — see references/known-failures.md for why.kubectl or helm without --context $CTX / --kube-context $CTX. Operators commonly have prod + staging configured in the same kubeconfig and current-context can flip between sessions. Bare commands silently target the wrong cluster. Step 0 pins $CTX once; every subsequent invocation reuses it.helm upgrade --reuse-values for the cozy-installer chart — see Step 5 for why.Pin $CTX to the cluster being upgraded before any other command. Read from <config-dir>/.state.yaml cluster.context when a wizard chain is in progress; otherwise show kubectl config current-context and ask the operator to confirm or pick a different one. Every subsequent kubectl and helm invocation in this skill passes --context $CTX / --kube-context $CTX explicitly — bare commands are forbidden, see Guardrails.
kubectl --context $CTX --namespace cozy-system get deployment cozystack-operator \
-o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'
kubectl --context $CTX get packages.cozystack.io cozystack.cozystack-platform -o yaml # bundle + values
If cluster is on v0.x, stop — this skill does not cover the v0→v1 migration.
Only stable (vX.Y.Z) releases are recommended for production. Avoid -alpha/-beta/-rc unless user explicitly asks.
gh release list --repo cozystack/cozystack --limit 20
gh release view vX.Y.Z --repo cozystack/cozystack
Read notes for every release between current and target. Extract a change-risk summary (affected components, breaking changes, migrations, CRD bumps, dependency changes).
How to analyze + change-signal mapping table: read references/release-notes-analysis.md.
Any False, stuck, or suspended resource MUST be fixed before upgrading.
# Quick gate — anything here blocks the upgrade
bash <cozystack-repo>/hack/check-readiness.sh
Full pre-flight command set (including LINSTOR, Kube-OVN, tenant control planes, suspended flux resources, etcd): read references/preflight-checks.md.
Show user: current→target version, change-risk summary from Step 1, pre-flight results, the exact upgrade command. Wait for explicit approval.
Always run. Missing these annotations can delete cozy-system on upgrade.
kubectl --context $CTX annotate namespace cozy-system helm.sh/resource-policy=keep --overwrite
kubectl --context $CTX --namespace cozy-system annotate configmap cozystack-version helm.sh/resource-policy=keep --overwrite
helm --kube-context $CTX upgrade cozystack oci://ghcr.io/cozystack/cozystack/cozy-installer \
--version X.Y.Z \
--namespace cozy-system
Do not use --reuse-values. The cozy-installer chart pins the platform OCI repository in its default values; reusing old values would point the new operator at old package versions. Inspect the currently-installed user-overrides first, then re-apply only the ones the user actually set, explicitly with --set (e.g. --set disableTelemetry=true):
helm --kube-context $CTX get values cozystack --namespace cozy-system
kubectl --context $CTX --namespace cozy-system logs deploy/cozystack-operator --follow
bash <cozystack-repo>/hack/check-readiness.sh -w 10 --context $CTX
Expect: operator pod Running, cozystack.cozystack-platform Package Ready=True, all HRs converge within a few minutes (tenant charts may take longer).
Run both general and targeted-per-change checks from Step 1.
General + targeted check commands + tenant cluster sanity: read references/post-upgrade-checks.md.
Show user: result (success/partial/failed), before→after version, HR/Package totals, any warnings, one-line outcome per targeted check.
helm --kube-context $CTX rollback cozystack <rev> --namespace cozy-system is possible but has caveats (data migrations don't reverse). Before rolling back, snapshot: kubectl --context $CTX get packages.cozystack.io -A -o yaml > pre-rollback.yaml.
Details, caveats, when not to roll back: read references/rollback.md.
High-blast-radius stuck states — stuck helm uninstalling, Kamaji datastore cert mismatch, MissingRollbackTarget, orphan HRs from removed apps, cozy-system accidentally deleted, etc.
Before any of these mitigation paths, read references/known-failures.md. Each entry has a root cause and exact recovery commands.
| Symptom | Likely cause |
|---|---|
Package.Ready=False, ValidationFailed | Release tightened values.schema.json; fix Package before proceeding |
HR Ready=False, ExternalArtifact ... not found | App removed in target version → orphan HR (known-failures #6) |
cozystack-operator in CrashLoopBackOff | Stale CRD / RBAC; kubectl --context $CTX --namespace cozy-system logs deploy/cozystack-operator --previous |
HR UninstallFailed, failed to delete release | Stuck helm history (known-failures #1) |
TCP INSTALLED VERSION diverges from VERSION | Kamaji upgrade stuck (known-failures #4) |
cozy-system namespace gone | Missing helm.sh/resource-policy=keep (known-failures #7); restore from backup |
helm upgrade with --reuse-values → operator keeps pointing at old package versions (chart pins OCI repo). Extract user overrides via helm get values and pass them with --set instead.Tenant/*.spec.etcd=false to "clean up" → removes tenant etcd, breaks child kube clusters. See known-failures #2.references/release-notes-analysis.md, references/preflight-checks.md, references/post-upgrade-checks.md, references/rollback.md, references/known-failures.mdhttps://cozystack.io/docs/<vX.Y>/operations/cluster/upgrade/https://cozystack.io/docs/<vX.Y>/operations/troubleshooting/https://github.com/cozystack/cozystack/releases<cozystack-repo>/hack/check-readiness.sh