gke kueue troubleshooting
Diagnose a GKE batch or AI workload (Job, JobSet, LeaderWorkerSet, RayJob, Kubeflow training jobs, or plain Pods) that is pending, suspended, stuck, evicted or misconfigured when Kueue manages it - from a live GKE cluster, a support bundle or exported controller/audit logs. Load it as soon as the investigation shows a Kueue footprint, even if the user never said "Kueue" - anything under kueue.x-k8s.io (labels, Pod scheduling gates, Workload/LocalQueue/ClusterQueue objects and their conditions),
Documentation & Preview
--- name: gke-kueue-troubleshooting description: Diagnose a GKE batch or AI workload (Job, JobSet, LeaderWorkerSet, RayJob, Kubeflow training jobs, or plain Pods) that is pending, suspended, stuck, evicted or misconfigured when Kueue manages it - from a live GKE cluster, a support bundle or exported controller/audit logs. Load it as soon as the investigation shows a Kueue footprint, even if the user never said "Kueue" - anything under kueue.x-k8s.io (labels, Pod scheduling gates, Workload/LocalQueue/ClusterQueue objects and their conditions), kueue-controller-manager events or logs, or a Job with spec.suspend=true together with a Workload object in its namespace. Scripts compact cluster state and logs into verifiable facts and validate the report, while the agent classifies the cause as Kueue configuration, Kueue defect, or outside Kueue. Don't use for workloads with no Kueue footprint (use gke-node-notready, gke-workload-scaling-troubleshooting, gke-ai-troubleshooting-tpu-reservation-stockout, or gke-ai-troubleshooting-jobset-interruption). metadata: version: "1.1.0" category: Containers
---
GKE Kueue troubleshooting
> Read-only rule: Run read-only diagnostic commands only. Never drain, > delete, or re-create nodes, or run kubectl patch/apply/edit/delete or any > other command that changes the cluster. When exporting logs for > trace_logs.py, run only read-only log queries scoped to the target cluster, > kueue-system, Kubernetes Event logs, Admin Activity audit logs, and the > incident time window as described in > Log sources and > View GKE logs. > Give the user any fix (remediation YAML, commands, or linked documentation > steps) to apply themselves in the final ### Diagnostic Summary.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution.
Prerequisites
- Tools and cluster access: Python 3.10+ with
PyYAML(all diagnostic
scripts live in scripts/ next to this file and require no cloud SDKs). In live mode, follow "Before you begin" in Deploy a batch system using Kueue to initialize gcloud and select the target project, and follow Install kubectl and configure cluster access to configure cluster credentials (offline_data and logs_archive read local files or stdin only).
- Cloud Billing and APIs: For
livecluster inspection or Cloud Logging
exports, ensure the project has an active Cloud Billing account and the Google Kubernetes Engine API (container.googleapis.com) and Cloud Logging API (logging.googleapis.com) are enabled.
- Required IAM roles: Per
Kubernetes Engine IAM roles and permissions, live cluster resource reads require Kubernetes Engine Viewer (roles/container.viewer), and reading controller pod logs via kubectl logs (container.pods.getLogs) or applying Kueue/cluster fixes requires Kubernetes Engine Developer (roles/container.developer) or Kubernetes Engine Admin (roles/container.admin). Exporting Cloud Logging and Admin Activity audit logs requires Logs Viewer (roles/logging.viewer).
- Scope and related skills: Upstream Kueue ships experimental interactive
skills (kueue-lineage and kueue-who-preempted, documented in Troubleshooting Agent Skills) for quick object-tree and preemption queries on a live cluster. This skill adds offline support-bundle and Cloud Logging compaction, GKE infrastructure boundary classification (Outside Kueue), and report validation.
1. Three-step protocol
The scripts detect the Kueue release and API version (active_api_schema_reference._detected_kueue_version, e.g. v0.10.x/v1beta1 vs v0.19.x/v1beta2) from controller deployments, CRDs, object apiVersions or startup/audit logs, and load the CRD and KueueConfiguration schema for that version. If detection_sources is only default:v1beta2, the version was assumed — pass --kueue-version <tag> or confirm the served CRD version before writing remediation YAML.
Where the schema comes from (schema_source / config_schema_source): in live the cluster's served CRDs are used (live_cluster_crds, no downloads); in offline_data bundled CRD manifests are used if present (bundled_crds); otherwise release CRDs are read from GKE_KUEUE_TROUBLESHOOTING_KUEUE_REPO or fetched once from GitHub (github_release:<tag>) and cached under $XDG_CACHE_HOME/gke-kueue-troubleshooting (override with GKE_KUEUE_TROUBLESHOOTING_CACHE_DIR; --no-remote-schema or GKE_KUEUE_TROUBLESHOOTING_NO_REMOTE_SCHEMA=1 disables downloads). KueueConfiguration is not a CRD; its field tree is parsed from the KueueConfiguration v1beta2 reference or KueueConfiguration v1beta1 reference matching config_api_version (falling back to builtin_defaults offline).
If schema_source is unavailable (_schema_notice present): CRD schemas are never approximated; only KueueConfiguration may fall back to builtin_defaults. Note in one sentence at the top of the report that the release-exact schema was unavailable, name the remedy from _schema_notice (cluster access, bundled CRDs, GitHub access, or --kueue-version), and
continue the diagnosis using the fields, conditions, and logs in the snapshot (see LocalQueue and Topology Aware Scheduling). Remediation YAML still uses the detected apiVersion.
Choose the data mode (--mode or GKE_KUEUE_TROUBLESHOOTING_MODE, default live):
live: whenkubectlreaches the cluster.offline_data: directory of YAML/JSON manifests (optionally withlogs/);
pass --data-path <dir>.
logs_archive: exported logs only (no cluster or manifests); pass
--data-path <file-or-dir> or pipe a read-only export to --data-path - (scoped per Log sources; never cat or page raw log exports into context).
Pass the same --ledger-path <ledger> to every script call; Step 3 verifies quotes and schema against it. Do not read or parse the ledger.
Output contract. snapshot.py and trace_logs.py print a digest ordered most-important-first (detected_kueue_version, derived facts, bulk_object_groups with counts/names/representative, individual objects/log excerpts, schema reference last) capped at --max-output-bytes (48 KB default for snapshot, 24 KB for logs). The complete output is written to full_report_file (next to the ledger). If command output is truncated to a saved file, read that saved file once instead of re-running --action get or grep. If the digest ends with truncated:, all tagged and coverage facts are already above it; to inspect one dropped object, use --action get --kind <kind> --name <name> (at most 4 get calls, never the same kind/name twice) or read a ≤ 200-line slice of full_report_file / raw bundle files (at most twice). Never read the skill's own Python scripts.
- Step 1 — one-shot snapshot or log timeline (schema attached)
live/offline_data: runscripts/snapshot.pywith
--mode <mode> --action snapshot --ledger-path <ledger> (add --namespace <ns> if known; --kueue-namespace if not kueue-system; --ignore-namespaces ns1,ns2 for extra add-on namespaces). If no active Workload/Job is present or controller/audit history is needed, also run scripts/trace_logs.py --mode <mode> --ledger-path <ledger> once (at most 2 log commands total).
logs_archive: run
scripts/trace_logs.py --mode logs_archive --ledger-path <ledger> with --data-path <file-or-dir> or --data-path - first (add --workload <name> to focus). Never call kubectl in this mode.
- Schema lookup (optional):
scripts/snapshot.py --action explainwith
--kind <Kind[.field.path]> --ledger-path <ledger>.
- If a script fails: read the error once, follow
next_step, and
continue with available files without retrying in a loop.
- Step 2 — reason over the facts (the scripts do not reason for you)
- Script outputs contain facts, not conclusions
(active_api_schema_reference, derived_graph_diagnostics, derived_log_diagnostics with mechanism_hint, key_errors_and_events, discovered_entities, audit_resource_actions). Nothing is pre-ranked as a root cause.
- Check the whole admission and execution pipeline (stages 1–6) — do not
stop at the first symptom if another independent blocker exists. For every Workload in the request or workload_timeline / discovered_entities, state its terminal state (Pending, Admitted, Evicted: <reason>, Requeued <n>/<limit>, Deactivated, Finished, Deleted by <owner cascade | TTL | retention policy>) and explain each terminal event. A Workload deleted via its Job's ownerReferences (user delete, ttlSecondsAfterFinished, or parent JobSet) is the Job's own lifecycle, not a Kueue retention defect — report it as why the object is gone, not as an RC<n>. Consult the Documentation catalog for the full per-stage upstream Kueue and GKE remediation links and section titles:
- Object chain: Job/JobSet/LWS → Workload →
spec.queueName→
LocalQueue (exists, Active) → ClusterQueue (exists, Active) → Cohort (see Troubleshooting Jobs and Troubleshooting Queues).
- Quota and cohort sharing: requests per pod set × count vs
nominalQuota, borrowing (lendingLimit/borrowingLimit, cohort quota layout, reclaimWithinCohort / fairSharing), queueingStrategy ordering, and GPU/TPU reservation alignment (see ClusterQueue, Cohort, and Preemption).
- Flavor assignment per pod set:
ResourceFlavor
nodeLabels/nodeTaints/tolerations, topologyName vs the pod set's topology request and across resourceGroups, and resources.transformations. Per "Implicit TAS and mixed-flavor ClusterQueues" in Topology Aware Scheduling, in a ClusterQueue combining TAS and non-TAS flavors, implicit TAS is disabled (unannotated pod sets can use only non-TAS flavors and TAS-annotated pod sets can use only TAS flavors), and a single pod set cannot mix TAS and non-TAS flavors across its requested resources.
- Admission checks:
AdmissionCheckActiveand attached to the
ClusterQueue, DWS ProvisioningRequest / retry configuration, reservation/DWS fallback, and external controllers (see ProvisioningRequest AdmissionCheck and [Run a large-scale workloa