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 资源文件 1
- 参考文档references/reporting.md4.4 KB
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
-
Run the scan once. It reads pods, Deployments, StatefulSets, DaemonSets, Jobs and Warning events across all namespaces in six paged single-kind
kubectl get -o jsonreads and prints only what needs attention:python3 /opt/data/scripts/workload_triage.pyPass
--include-systemon that scan only when the question names a system component or system namespace. It ends withunhealthy: <count>(unhealthy pods plus controllers below desired, outside system namespaces) followed bysystem 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-*, andconfig-management-*; user namespaces ending in-systemare not folded). Its rules, for reading the objects yourself where the script cannot run: a pod withdeletionTimestampset (Terminating) orPendingbehindSchedulingGatedis 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 isPending, waiting inContainerCreating/PodInitializing, orNotReady; a pod is unhealthy when a container waits inCrashLoopBackOff,RunContainerError, an image pull error or a config error, when its age is at least 10 minutes and it isPending, waiting inContainerCreating/PodInitializingorNotReady, when it isNotReady,PodInitializingor Ready now after a container restarted in the last 60 minutes (RecentRestart), or when its phase isFailedunless its owningJobhas completed, its owningCronJobJobfailed more than 60 minutes ago and a newer siblingJobhasComplete=True, or it ended more than 60 minutes ago and is owned by aReplicaSet,StatefulSetorDaemonSet; aDeployment,StatefulSetorDaemonSetwith ready below desired, conditionReplicaFailure=True, or updated below desired alongside aFailedCreatewarning in the last 60 minutes, or an inactive, incompleteJobwith conditionFailed=Trueor aFailedCreatewarning in the last 60 minutes (unless older than 60 minutes and superseded by a newer completed siblingJobof the sameCronJob), counts under controllers below desired, with a failedJob's retained pods counted under theJobrow 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: block the card asneeds_inputasreferences/reporting.md("Cannot proceed") describes, quoting the exact stderr line. -
Check
WARNING EVENTSfor any row not already covered by anUNHEALTHY PODSorCONTROLLERS BELOW DESIREDrow: on rows whoseSTATEisgoneor-(the event's object is no longer present or is not a scanned pod or controller — skip rows whoseSTATEishealthy,initializingorstale_failed, exceptFailedCreateon an incompleteJob), routeFailedSchedulingtopod-pending-scheduling, routeFailedMount,ProvisioningFailedandFailedAttachVolumetopod-container-creating, and routeFailedCreate(plusFailedKillPodorFailedon a-controller-kind object such asReplicaSet) to step 7's controller.status.conditions(ReplicaFailure) andreason=FailedCreatecheck. Because neithergonenor-has a live pod to read, skip the target skill's step 1kubectl get pod: for agonepod row, start at step 2 (eventsfiltered byinvolvedObject.name) and read the owning workload's current pods if needed to confirm whether a replacement is running; for a-non-pod row (such asPersistentVolumeClaim/<name>), start at step 2 (eventsfor that object's name) and the target skill's object-kind step; for aFailedCreate,FailedKillPodor controllerFailedrow routed to step 7, inspect the owning controller orJoband confirm whether a newer revision or pod has converged before reporting a failure. Quote all otherWARNING EVENTSrows (includinghealthy,initializingandstale_failedones) as the event states them without loading a focused skill. -
If the scan ends with
unhealthy: 0andsystem unhealthy: 0and 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, anyWARNING EVENTSrows, theRESTARTED EARLIERandFAILED EARLIERrows 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. Ifunhealthy: 0andsystem 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 haveNunhealthy pods or controllers below desired, quoting the summary line and theSYSTEM NAMESPACES AND NODESlines 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. -
Otherwise, group the
UNHEALTHY PODSrows by owning workload (the pod name minus its ReplicaSet or ordinal suffix). Pods of one workload share a cause: investigate one representative pod. -
Take up to three workloads, ordered by the
STATUScolumnUNHEALTHY PODSprints:CrashLoopBackOff,RunContainerError,Evicted/FailedorRecentRestartfirst (usingLAST EXITsuch as137 OOMKilledor1 Errorto break ties), thenUnschedulable/Pending, thenImagePullBackOff/ErrImagePull/InvalidImageName/ErrImageNeverPull,CreateContainerConfigError/CreateContainerErrorandContainerCreating/PodInitializing, thenNotReady. Load the skill in the row'sSKILLcolumn 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. -
RESTARTED EARLIERrows (Ready now, last restart before the events window) andFAILED EARLIERrows (pods from a completed orCronJob-supersededJob, or replaced pods that ended before the window) are history. List them when the question asks about restarts or failures; do not investigate them. -
For a
Job/<name>row markedfailed: <reason>inCONTROLLERS BELOW DESIREDwith no matchingUNHEALTHY PODSrow (a failedJobwhose pods the controller removed, such asDeadlineExceededorBackoffLimitExceededunderrestartPolicy: OnFailure), inspectkubectl get job <name> -n <namespace> -o jsonand its namespace events (kubectl get events -n <namespace> --field-selector involvedObject.name=<name>) to report the cause and proposed fix. For any other controller inCONTROLLERS BELOW DESIREDwith no matchingUNHEALTHY PODSrow, first checkWARNING EVENTSforFailedCreatein that namespace and, whenever pods are missing (INITIALIZINGrows do not account for the gap) orFailedCreateis present, read the controller's.status.conditions(kubectl get <kind>/<name> -n <namespace> -o jsonpath='{.status.conditions}'forReplicaFailure) andkubectl get events -n <namespace> --field-selector reason=FailedCreate: ifReplicaFailureorFailedCreateis 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. -
Record the result as
references/reporting.mddescribes.
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 inINITIALIZINGis 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-systemon step 1's scan only when the question names a system component or system namespace; never run a second scan with--include-systemafterunhealthy: 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.
- Do not run
gcloud container clusters get-credentials. Preflight has already pinned the kubeconfig to this cluster.
04 同仓库更多 Skills
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.
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).
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.
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).
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).
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.