AGENT SKILL

workload-triage-scan

Answers cluster-wide workload health questions with one read-only scan. Use for "what is failing or degraded", "check if there are any failing workloads", "is the cluster healthy", "which pods are crashlooping or restarting", and "are all DaemonSet or Deployment pods scheduled and ready" (including follow-ups when fleet metrics are missing) when no single workload is named. Lists unhealthy pods, controllers below desired and recent Warning events, then hands each finding to pod-crashloop-oom, pod-pending-scheduling, pod-container-creating or service-connectivity.

License 许可
Apache-2.0
最近更新
2026-11-14
Stars
★ 126
Forks
44

01 前言 Front Matter

name
workload-triage-scan
description
Answers cluster-wide workload health questions with one read-only scan. Use for "what is failing or degraded", "check if there are any failing workloads", "is the cluster healthy", "which pods are crashlooping or restarting", and "are all DaemonSet or Deployment pods scheduled and ready" (including follow-ups when fleet metrics are missing) when no single workload is named. Lists unhealthy pods, controllers below desired and recent Warning events, then hands each finding to pod-crashloop-oom, pod-pending-scheduling, pod-container-creating or service-connectivity.

02 资源文件 2

03 SKILL.md 正文

Task

Answer a cluster-wide "what is failing / is it healthy" question from one batched read, finish at once when nothing is unhealthy, and otherwise name each finding's cause through the focused skill that owns its symptom.

Workflow

  1. Run the scan once, from this skill's directory (the base directory the harness gives when it loads the skill), where scripts/workload_triage.py is. It reads pods, Deployments, StatefulSets, DaemonSets, Jobs and Warning events across all namespaces in six paged single-kind kubectl get -o json reads and prints only what needs attention:

    python3 scripts/workload_triage.py
    

    Pass --include-system on that scan only when the question names a system component or system namespace. It ends with unhealthy: <count> (unhealthy pods plus controllers below desired, outside system namespaces) followed by system unhealthy: <count> (unhealthy pods plus controllers below desired in folded system namespaces: kube-system, kube-public, kube-node-lease, gmp-system, gmp-public, cnrm-system, configconnector-operator-system, krmapihosting-system, istio-system, asm-system, anthos-identity-service, gatekeeper-system, composer-system, gke-*, and config-management-*; user namespaces ending in -system are not folded). Its rules, for reading the objects yourself where the script cannot run: a pod with deletionTimestamp set (Terminating) or Pending behind SchedulingGated is initializing regardless of age; a pod whose age (now - creationTimestamp) is under 10 minutes with no non-zero container termination in the last 60 minutes is initializing when it is Pending, waiting in ContainerCreating/PodInitializing, or NotReady; a pod is unhealthy when a container waits in CrashLoopBackOff, RunContainerError, an image pull error or a config error, when its age is at least 10 minutes and it is Pending, waiting in ContainerCreating/PodInitializing or NotReady, when it is NotReady, PodInitializing or Ready now after a container restarted in the last 60 minutes (RecentRestart), or when its phase is Failed unless its owning Job has completed, its owning CronJob Job failed more than 60 minutes ago and a newer sibling Job has Complete=True, or it ended more than 60 minutes ago and is owned by a ReplicaSet, StatefulSet or DaemonSet; a Deployment, StatefulSet or DaemonSet with ready below desired, condition ReplicaFailure=True, or updated below desired alongside a FailedCreate warning in the last 60 minutes, or an inactive, incomplete Job with condition Failed=True or a FailedCreate warning in the last 60 minutes (unless older than 60 minutes and superseded by a newer completed sibling Job of the same CronJob), counts under controllers below desired, with a failed Job's retained pods counted under the Job row rather than beside it; Warning events count from the last 60 minutes. Exit code 2 means a cluster read failed or returned truncated or unparseable output: stop and report as references/reporting.md ("Cannot proceed") describes, quoting the exact stderr line.

  2. Check WARNING EVENTS for any row not already covered by an UNHEALTHY PODS or CONTROLLERS BELOW DESIRED row: on rows whose STATE is gone or - (the event's object is no longer present or is not a scanned pod or controller — skip rows whose STATE is healthy, initializing or stale_failed, except FailedCreate on an incomplete Job), route FailedScheduling to pod-pending-scheduling, route FailedMount, ProvisioningFailed and FailedAttachVolume to pod-container-creating, and route FailedCreate (plus FailedKillPod or Failed on a - controller-kind object such as ReplicaSet) to step 7's controller .status.conditions (ReplicaFailure) and reason=FailedCreate check. Because neither gone nor - has a live pod to read, skip the target skill's step 1 kubectl get pod: for a gone pod row, start at step 2 (events filtered by involvedObject.name) and read the owning workload's current pods if needed to confirm whether a replacement is running; for a - non-pod row (such as PersistentVolumeClaim/<name>), start at step 2 (events for that object's name) and the target skill's object-kind step; for a FailedCreate, FailedKillPod or controller Failed row routed to step 7, inspect the owning controller or Job and confirm whether a newer revision or pod has converged before reporting a failure. Quote all other WARNING EVENTS rows (including healthy, initializing and stale_failed ones) as the event states them without loading a focused skill.

  3. If the scan ends with unhealthy: 0 and system unhealthy: 0 and step 2 routed no warning event, stop here and run no further command. Report the summary line (pods healthy, initializing, controllers below desired, warning events), any initializing pods by name, any WARNING EVENTS rows, the RESTARTED EARLIER and FAILED EARLIER rows when the question is about restarts or failures, and the system-namespace lines as written (they carry restart counts for system pods). This is a status question with nothing failing, answered in one sentence plus the evidence that settles it — the scan's first line (kubeconfig context and UTC time), its summary line and the command. Re-listing pods, events or controllers to confirm a clean scan adds nothing. If unhealthy: 0 and system unhealthy: N (N > 0) and step 2 routed no warning event, stop here and run no further command, but do not report "No failing workloads.": report that non-system namespaces have 0 unhealthy workloads while folded namespaces have N unhealthy pods or controllers below desired, quoting the summary line and the SYSTEM NAMESPACES AND NODES lines as written. When the question did not ask about system namespaces, there is no next step: omit any [next: ...] line (never offer or run --include-system) and stop your turn after reporting.

  4. Otherwise, group the UNHEALTHY PODS rows by owning workload (the pod name minus its ReplicaSet or ordinal suffix). Pods of one workload share a cause: investigate one representative pod.

  5. Take up to three workloads, ordered by the STATUS column UNHEALTHY PODS prints: CrashLoopBackOff, RunContainerError, Evicted/Failed or RecentRestart first (using LAST EXIT such as 137 OOMKilled or 1 Error to break ties), then Unschedulable/Pending, then ImagePullBackOff/ErrImagePull/InvalidImageName/ErrImageNeverPull, CreateContainerConfigError/CreateContainerError and ContainerCreating/PodInitializing, then NotReady. Load the skill in the row's SKILL column and follow it for the representative pod until the cause is named, usually its first two steps. List any further workloads with their scan row only, and say they were not investigated.

  6. RESTARTED EARLIER rows (Ready now, last restart before the events window) and FAILED EARLIER rows (pods from a completed or CronJob-superseded Job, or replaced pods that ended before the window) are history. List them when the question asks about restarts or failures; do not investigate them.

  7. For a Job/<name> row marked failed: <reason> in CONTROLLERS BELOW DESIRED with no matching UNHEALTHY PODS row (a failed Job whose pods the controller removed, such as DeadlineExceeded or BackoffLimitExceeded under restartPolicy: OnFailure), inspect kubectl get job <name> -n <namespace> -o json and its namespace events (kubectl get events -n <namespace> --field-selector involvedObject.name=<name>) to report the cause and proposed fix. For any other controller in CONTROLLERS BELOW DESIRED with no matching UNHEALTHY PODS row, first check WARNING EVENTS for FailedCreate in that namespace and, whenever pods are missing (INITIALIZING rows do not account for the gap) or FailedCreate is present, read the controller's .status.conditions (kubectl get <kind>/<name> -n <namespace> -o jsonpath='{.status.conditions}' for ReplicaFailure) and kubectl get events -n <namespace> --field-selector reason=FailedCreate: if ReplicaFailure or FailedCreate is present, report the quota, admission webhook or policy denial cause and proposed fix; report the controller as rolling out or initializing (with the counts as read, without waiting) only when no creation failure exists.

  8. Record the result as references/reporting.md describes.

Rules

  • Keep the scan itself to about six commands, the script included. Each workload step 5 selects adds its focused skill's steps on top of that, usually two commands.
  • Report the current state only. Never sleep, --watch, or re-run the scan to see whether a pod comes up. A pod in INITIALIZING is reported as initializing.
  • Do not explore folded system namespaces (kube-system, kube-public, kube-node-lease, gmp-system, gmp-public, cnrm-system, configconnector-operator-system, krmapihosting-system, istio-system, asm-system, anthos-identity-service, gatekeeper-system, composer-system, gke-*, config-management-*) or node events. Quote their summary lines as written, including any (+N more ...) tail. Pass --include-system on step 1's scan only when the question names a system component or system namespace; never run a second scan with --include-system after unhealthy: 0, and never append [next: ...] offering to check system workloads when the question did not ask about system namespaces.
  • Do not list pods, nodes or controllers again in other shapes. The scan output is the inventory.

04 同仓库更多 Skills

gke-labs
gke-labs/kube-agents

gke-workload-troubleshooting

Diagnoses GKE workload failures (CrashLoopBackOff, OOMKilled, ImagePullBackOff, Pending, etc.) via logs and events. Use when pods fail to start or crash repeatedly. Don't use for GKE cluster infrastructure provisioning, node pool creation, or non-Kubernetes Google Cloud services.

★ 126
gke-labs
gke-labs/kube-agents

gke-workload-security

Audits, configures, and hardens workload-level security controls for Google Kubernetes Engine (GKE) applications and namespaces. Covers running security audits (`audit_cluster.sh`), enforcing Network Policies (default-deny and Dataplane V2 logging), isolating high-risk pods inside GKE Sandbox (`gVisor`), enforcing Pod Security Standards (`restricted` labeling) and pod securityContext, and mounting Secret Manager secrets via CSI (`SecretProviderClass`). Use when auditing workload security posture, isolating namespaces, applying pod security standards, or configuring network policies and secret volume mounts. Don't use for Workload Identity (use gke-workload-identity), cluster-wide control plane security, RBAC hardening, Binary Authorization, Shielded Nodes, or enabling platform-level GKE add-ons (use gke-platform-security instead).

★ 126
gke-labs
gke-labs/kube-agents

gke-workload-scaling

Manages scaling for GKE workloads using HPA and VPA. Use when configuring Horizontal Pod Autoscaler (HPA), configuring Vertical Pod Autoscaler (VPA), or applying best practices for GKE workload autoscaling. Do not use for cluster-level autoscaling (Cluster Autoscaler), static cluster sizing, or configuring node-level machine styles directly.

★ 126
gke-labs
gke-labs/kube-agents

gke-workload-identity

Configures and diagnoses Workload Identity Federation for GKE authentication failures for Pods (403 "iam.serviceAccounts.getAccessToken" / permission denied, "could not find default credentials", or GKE metadata server unreachable) by verifying cluster and node-pool Workload Identity configuration, the Kubernetes ServiceAccount (KSA) to IAM binding (direct principal binding and legacy Google ServiceAccount impersonation), target-resource IAM roles, and gke-metadata-server health. Use when setting up KSA/GSA bindings (`roles/iam.workloadIdentityUser`, `iam.gke.io/gcp-service-account`) or when a Pod cannot authenticate to Google Cloud APIs. Don't use for in-cluster Kubernetes RBAC errors (API-server authorization), general workload crashes (use gke-workload-troubleshooting), or Pod Security Standards and NetworkPolicies (use gke-workload-security).

★ 126
gke-labs
gke-labs/kube-agents

gke-upgrades

Plans, executes, and validates Google Kubernetes Engine (GKE) cluster upgrades and maintenance operations for both Standard and Autopilot clusters. Produces upgrade plans, pre/post-upgrade checklists, maintenance runbooks with gcloud commands, release channel strategy, and troubleshooting guides. Handles node pool upgrade strategies (surge, blue-green), version compatibility, PDB management, and workload-specific concerns (stateful, GPU, operators). Use this skill whenever the user mentions GKE upgrades, Kubernetes version bumps, node pool maintenance, GKE patching, cluster version management, release channel selection, maintenance windows, surge upgrades, stuck upgrades, or any GKE lifecycle management task — even casual mentions like "we need to upgrade our clusters" or "plan our next GKE maintenance" or "our upgrade is stuck." Don't use for GKE cluster creation, application onboarding, general networking/routing setup, or security policy configurations (use gke-basics or relevant GKE skills instead).

★ 126
gke-labs
gke-labs/kube-agents

gke-tpu-metrics-monitoring

Monitors and troubleshoots GKE TPU workloads, nodes, and node pools using GKE system metrics and PromQL. Use when monitoring TensorCore duty cycle, TPU memory, node readiness, multi-host TPU node pool availability, host maintenance or preemption interruptions, and calculating MTTR or MTBI metrics for GKE TPUs. Don't use for general non-TPU GKE workload monitoring or non-metric TPU debugging.

★ 126