Skip to content

Replace azure-diagnostics skill AKS pod-failure evidence bundle with a script #2507

Description

Summary

Copilot has identified a portion of a skill that is a good candidate for replacement with a script.

The candidate is the AKS pod-failure evidence bundle in the azure-diagnostics skill — a fixed kubectl evidence-collection sequence repeated many times across the pod-troubleshooting docs.

Candidate description

For any pod symptom (CrashLoopBackOff, OOMKilled, Pending, probe failures), the skill collects the same invariant evidence bundle:

  1. kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded (find the failing pods)
  2. kubectl describe pod <pod> -n <ns> (events, last state, exit code)
  3. kubectl logs <pod> -n <ns> and kubectl logs <pod> -n <ns> --previous (current + crashed-instance logs)
  4. kubectl top pod <pod> -n <ns> (resource pressure)
  5. kubectl get pod <pod> -n <ns> -o jsonpath='{...resources}' and grep -A2 "Last State" (targeted field extraction)

This is a strong script candidate because it is:

  • A fixed, read-only evidence bundle run identically regardless of the specific pod symptom.
  • Repeated 4+ times across pod-failures.md (multiple sections) plus aks-troubleshooting.md and command-flows.md.
  • Output-heavydescribe + dual logs are large; the grep -A2 "Last State" and jsonpath resource extraction are exactly the "only a few lines matter" reduction a script should own.

Sketch — pod-evidence.{sh,ps1}:

  • Input: <pod>, -n/--namespace (or --all-failing to auto-select unhealthy pods).
  • Output: a labeled digest — READY/STATUS, exit code + reason, last-state snippet, current + previous logs (tailed), and resource requests/limits vs top usage — so the agent gets one summarized evidence packet.

The Exit-Code / ImagePull / Pending-event / probe decision tables (e.g. pod-failures.md L35–41, L77–82, L104–110, L128–132) require interpreting the gathered output to pick a fix and stay in prose. The script only gathers and digests.

Affected file and lines

Next steps

  1. Evaluate the candidate — confirm the steps are stable and parameterizable, and that the script captures everything the skill needs.
  2. Create both a bash and a PowerShell version of the script so the skill works across platforms.
  3. Run integration tests to verify the scripts behave correctly and the skill still completes end-to-end.

Background Information

Why replace regular steps with scripts

Replacing a regular, well-defined series of steps with a script can:

  • Reduce token usage — the skill no longer needs to spell out each command and parse large command output inline; the agent invokes one script and reads a compact result.
  • Improve reliability — the logic is written and tested once, instead of being re-derived by the agent on every run.
  • Improve determinism — the same inputs always produce the same steps and output, removing run-to-run variation.
  • Improve speed of execution — a single script call replaces multiple round-trips of command generation, execution, and large-output parsing.

Authoring notes for the scripts

  • Reference scripts with markdown links, not just a bare path to the script file.
  • Include examples in the skill showing how to run each script (sample invocation with arguments).
  • Briefly explain what each script does where it is referenced.
  • The script output should explain what it did, so the agent and user can understand the result without re-inspecting raw command output.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions