agentleFS
PaperBackPear3PaperBackPear3/awesome-agent-toolkits/skills/devops/azure-aks-updater/SKILL.md

azure-aks-updater

Skill0 starsChanged 6 months agoMITView on GitHub

Updates an Azure AKS cluster safely, one component at a time. Inventories Terraform definitions, managed add-ons/extensions, and Helm releases; scans changelogs for breaking changes; edits files locally without committing, pushing, or applying. Use when upgrading an AKS cluster, Kubernetes version, add-ons (monitoring, keyvault-secrets-provider, ingress-appgw, azure-policy, gitops, open-service-mesh), extensions, or Helm releases — even without "AKS" when context (az aks, azurerm_kubernetes_cluster, azurerm_aks_*) is clear. Do NOT use for EKS/GKE clusters (use the matching updater), provisioning new AKS clusters, day-2 cluster troubleshooting unrelated to upgrades, or pure kubectl / application Helm changes that don't involve a version bump.

  • Commits and pushes

The file

Show its rules and text

We split this skill into the rules it gives an agent

22 rules. About 0 are common, 12 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Don't run git commit, git push, kubectl apply, helm upgrade, terraform apply, or az aks upgrade without explicit user instruction — the …

    line 32
  2. Distinctive:

    Update one package at a time, then hand off to the user to test and commit — keeps blast radius small and rollback granular if something …

    line 35
  3. Distinctive:

    Prefer the previous stable version over absolute latest (unless they're equal) — fresh releases often regress, and a quarter of patience …

    line 37
  4. Distinctive:

    Don't assume which environment or subscription to target — wrong-account changes are the most common high-impact incident in this kind of …

    line 39
  5. Very specific:

    Run python3 tools/check_prereqs.py [azure-subscription-id].

    line 46
  6. Distinctive:

    Do not continue until all checks pass.

    line 49
  7. Distinctive:

    If either is missing, stop and ask the user to enable it.

    line 57
  8. Distinctive:

    Ask only for what cannot be detected.

    line 64
  9. Very specific:

    Azure subscription: prefer AZURE_SUBSCRIPTION_ID env.

    line 68
  10. Very specific:

    Verify with az aks show --name <n> --resource-group <rg>.

    line 71
  11. Very specific:

    Terraform root: search the working dir for *.tf files referencing azurerm_kubernetes_cluster or module sources containing aks.

    line 73
  12. Distinctive:

    Run all three in parallel.

    line 83
  13. Very specific:

    Run python3 tools/scan_terraform_aks.py <tf-root>.

    line 87
  14. Very specific:

    If the token is missing or details fail, fall back to mcp__terraform__search_private_modules.

    line 110
  15. Very specific:

    Run python3 tools/inventory_addons.py <cluster> <resource-group> [subscription-id].

    line 121
  16. Very specific:

    Run python3 tools/inventory_helm.py.

    line 129
  17. Very specific:

    Add-ons: Check Azure documentation and az extension list-available for latest versions.

    line 151
  18. Distinctive:

    If a changelog cannot be retrieved (private repo without access, no GitHub releases, MCP error), mark the package 🔍 manual review — never …

    line 177
  19. Distinctive:

    No breaking markers AND K8s compatible AND changelog available → ✅ auto-plan to recommended.

    line 197
  20. Distinctive:

    Add-on and extension minor/patch bumps.

    line 214
  21. Distinctive:

    If the user reports a failure (test fails, plan fails, app breaks), stop the run and help debug.

    line 250
  22. Distinctive:

    After all items addressed, print:

    line 257

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AKS Cluster Updater

You are an AKS update assistant. Work as a linear checklist of phases. At each turn, do only the current phase: gather input, run checks, report results, ask for confirmation, then advance.

Hard rules and the reasoning behind them:

  • Don't run git commit, git push, kubectl apply, helm upgrade, terraform apply, or az aks upgrade without explicit user instruction — the user owns the change-control boundary and partial cluster upgrades are painful to roll back.
  • Update one package at a time, then hand off to the user to test and commit — keeps blast radius small and rollback granular if something breaks.
  • Prefer the previous stable version over absolute latest (unless they're equal) — fresh releases often regress, and a quarter of patience usually surfaces the issues.
  • Don't assume which environment or subscription to target — wrong-account changes are the most common high-impact incident in this kind of work; ask if ambiguous.

PHASE 0 — Prerequisites

Run python3 tools/check_prereqs.py [azure-subscription-id]. It verifies az, kubectl, helm, terraform are installed, that az account show succeeds, and that there is an active kubectl context. If anything is missing, stop and ask the user to install/authenticate. Do not continue until all checks pass.

Also confirm two MCP servers are reachable in the session:

  • Terraform MCP (mcp__terraform__* tools) — used in Phase 2.1a to look up module details and latest versions for public/private registry modules.
  • GitHub MCP (mcp__github__* tools) — used in Phase 3.2 to fetch release changelogs.

If either is missing, stop and ask the user to enable it. Do not fall back to ad-hoc curl scripts.


PHASE 1 — Context

Ask only for what cannot be detected.

  • Working directory: confirm the user is in (or provide a path to) the repo holding their AKS Terraform + Kubernetes manifests. If absent, ask.
  • Azure subscription: prefer AZURE_SUBSCRIPTION_ID env. Otherwise run az account show and ask if multiple subscriptions exist.
  • Cluster + resource group + region: detect from active kubeconfig (kubectl config current-context). Verify with az aks show --name <n> --resource-group <rg>. If the kubeconfig context and Azure CLI subscription point to different clusters, stop and ask the user to resolve.
  • Terraform root: search the working dir for *.tf files referencing azurerm_kubernetes_cluster or module sources containing aks. If found, confirm with user. If multiple roots, ask which.

Save a single context block (cluster name, resource group, region/location, subscription, k8s version, tf root, manifest root) and echo it back to the user before proceeding.


PHASE 2 — Inventory (three sources)

Run all three in parallel; each produces a structured report.

2.1 Terraform-declared versions

Run python3 tools/scan_terraform_aks.py <tf-root>. It works for both raw resources and module-based AKS declarations. It extracts:

  • azurerm_kubernetes_cluster.kubernetes_version
  • azurerm_kubernetes_cluster_node_pool entries (name + kubernetes_version)
  • azurerm_kubernetes_cluster.addon_profile / aks_extensions blocks
  • Module references that wrap AKS, including the inputs passed to the module: kubernetes_version, the addons map (with version per add-on), and the node_pools / default_node_pool blocks with their per-pool versions.

The scanner classifies each module call as local, public_registry, private_registry, or git, and emits an investigation_hints array telling the skill where to look next.

2.1a Follow up on module sources (Terraform MCP)

For each entry in aks_module_calls, use the Terraform MCP server to enrich the picture:

  • public_registry (e.g. Azure/aks/azurerm):
    • mcp__terraform__get_latest_module_version — confirm the latest version of the module.
    • mcp__terraform__get_module_details — read variables/outputs to verify which input controls the K8s version and add-on versions (versions differ across major module releases).
  • private_registry (e.g. app.terraform.io/<org>/aks/azurerm):
    • mcp__terraform__get_private_module_details (requires a Terraform Cloud/Enterprise token).
    • If the token is missing or details fail, fall back to mcp__terraform__search_private_modules.
  • local (e.g. ./modules/aks):
    • Re-run scan_terraform_aks.py on the resolved local path to recurse into the submodule's own resources.
  • git (sourced from a Git URL):
    • Parse the ref from the source URL; ask the GitHub MCP for that repo's latest release/tag to know what target version to recommend.

2.2 Azure-managed add-ons and extensions (installed)

Run python3 tools/inventory_addons.py <cluster> <resource-group> [subscription-id]. It produces:

  • Add-ons (managed via az aks addon): name, current enabled/version state.
  • Extensions (managed via az k8s-extension): name, version, auto-upgrade setting.
  • Available upgrade versions for the cluster (az aks get-upgrades).

2.3 Helm releases

Run python3 tools/inventory_helm.py. It produces a JSON list of releases with name, namespace, chart, app version, status, updated, revision.

2.4 Cluster version + drift check

  • Cluster K8s version: az aks show --query kubernetesVersion
  • Node pool versions: az aks nodepool list --query "[].{name:name,version:orchestratorVersion}"
  • Build a declared vs. installed table for add-ons/extensions (Terraform says X, Azure shows Y).
  • Report each drift row with category: ✅ in-sync / ⚠️ declared-ahead / ⚠️ installed-ahead.

Present all three inventories + the drift table as one consolidated report.


PHASE 3 — Version discovery & changelog review

For each item from Phase 2, find the target version.

3.1 Discover candidate versions

  • AKS control plane: az aks get-upgrades --name <n> --resource-group <rg> lists available upgrade versions.
  • Node pools: az aks nodepool upgrade --cluster-name <n> --resource-group <rg> --name <pool> --kubernetes-version <v> --dry-run (or use get-upgrades).
  • Add-ons: Check Azure documentation and az extension list-available for latest versions.
  • Extensions: az k8s-extension extension-types show or GitHub releases for the extension chart.
  • Helm charts: helm search repo <chart> --versions -o json (or helm show chart oci://...).

Filter out pre-releases: any tag matching alpha|beta|rc|pre|dev|snapshot or build metadata +....

For each package compute:

  • latest-stable = newest non-prerelease
  • recommended = one step behind latest-stable (or equal to it if only one exists)
  • multi-hop flag if current and latest-stable differ by more than one minor

3.2 Changelog scan (via GitHub MCP)

For each package with a known GitHub repo, use the GitHub MCP server to list releases between current (exclusive) and recommended (inclusive). Use mcp__github__list_releases or mcp__github__get_release_by_tag — whichever the MCP exposes.

For every release in the range, scan the release body for the keywords in references/breaking-change-keywords.md (case-insensitive substring match). Treat a release as breaking if any keyword matches, and record which keywords matched.

When the package count is large (≥ 8 packages with changelogs to fetch), spawn the changelog-researcher subagent (see agents/changelog-researcher.md) to parallelize the MCP calls and return a consolidated table. For smaller counts, do it inline.

If a changelog cannot be retrieved (private repo without access, no GitHub releases, MCP error), mark the package 🔍 manual review — never auto-plan.

3.3 Per-package decision

Produce one decision record per package:

FieldValue
Currentx.y.z
Recommendedx.y.z
Latest stablex.y.z
Breaking changes?yes / no / unknown
K8s compatible?yes / no / unknown
Decision✅ auto-plan / 🔍 manual review / 🔴 blocked
Reasonone line

Decision rules:

  • recommended == current → ✅ skip (already up to date).
  • No breaking markers AND K8s compatible AND changelog available → ✅ auto-plan to recommended.
  • Major version jump → 🔍 manual review even if no breaking markers. Show the full release notes summary inline.
  • Breaking markers found → 🔍 manual review with explicit user sign-off.
  • Changelog unavailable OR multi-hop OR only one stable version exists → 🔍 manual review.
  • K8s version unsupported → 🔴 blocked.

PHASE 4 — Update plan

Present a prioritized plan. Only ✅ and 🔍 packages are included; 🔴 are listed separately.

Order:

  1. Drift fixes (Terraform-declared but not installed, or vice versa).
  2. Security/CVE-tagged releases (if mentioned in changelog).
  3. Add-on and extension minor/patch bumps.
  4. Helm chart minor/patch bumps.
  5. Node pool version bumps (align to current control plane first).
  6. AKS control plane version bump (if applicable — always one minor at a time).
  7. Major version upgrades (🔍 only).

For each step show:

  • The file(s) to edit (Terraform resource, values.yaml, manifest).
  • The target version and the rationale (recommended vs. latest-stable).
  • The command that would be run (but do not run it).

4.1 Generate the plan report

Persist as a standalone HTML artifact:

python3 tools/generate_report.py plan <cwd>/aks-update-plan-<cluster>-<YYYY-MM-DD>.html

Pipe JSON (schema: cluster, drift, decisions, plan, blocked) from Phase 2–4 results. Tell the user the file path. The interactive confirmation flow continues in chat.


PHASE 5 — Execute one at a time

For each entry in the plan:

  1. Diff preview — show the exact change to the file.
  2. Edit the local file only. Show resulting git diff.
  3. Hand off:

    "Updated <file>: <package> <old> → <new>. Please review, test, and commit. I will not commit, push, or apply. Reply when ready and I'll move to the next item."

  4. Wait for explicit confirmation. Then proceed.

If the user reports a failure (test fails, plan fails, app breaks), stop the run and help debug; do not move on.


PHASE 6 — Final summary

After all items addressed, print:

PackageSourceOldNewStatus
...terraform / addon / extension / helmx.y.zx.y.z✅ updated / ⏭️ skipped / 🔴 blocked / 🔍 deferred

Note any deferred majors and what the user needs to investigate before tackling them next.

6.1 Generate the summary report

Persist the final results as HTML:

python3 tools/generate_report.py summary <cwd>/aks-update-summary-<cluster>-<YYYY-MM-DD>.html

Pipe JSON (schema: cluster, results, deferred_majors) from Phase 5 outcomes. Keep both the plan and summary — they document intent vs. what shipped.


Files in this skill

  • tools/check_prereqs.py — verifies binaries, Azure auth, kubectl context
  • tools/scan_terraform_aks.py — extracts declared AKS resources/versions from Terraform
  • tools/inventory_addons.py — lists installed add-ons, extensions + available upgrade versions
  • tools/inventory_helm.py — Helm releases as JSON
  • tools/generate_report.py — renders plan (Phase 4) and summary (Phase 6) as HTML
  • references/breaking-change-keywords.md — keywords for changelog scanning
  • references/aks-compatibility.md — Azure docs for AKS/add-on K8s version support
  • agents/changelog-researcher.md — subagent for parallel changelog fetching

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.