Home / Market / gke workload troubleshooting

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.

skill★ 255596570 dlskills.shApache-2.0Install in CosmosUpstream Source

Documentation & Preview

--- name: gke-workload-troubleshooting metadata: version: "1.0.1" category: Containers description: >- 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 Troubleshooting Skill

Use this skill to systematically diagnose and resolve failures in application workloads deployed in GKE clusters. This skill operates non-interactively and enforces a read-only diagnostics boundary: it only proposes fixes — whether Kubernetes manifest/config patches or Google Cloud changes (for example gcloud IAM bindings or node-pool recreation) — and never executes live mutations itself.

Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read Usage Attribution. For commands executed directly in the terminal (never in generated scripts, Terraform, or user code), prefix gcloud with CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-workload-troubleshooting)" and append agent-skills/1.0 (skill:gke-workload-troubleshooting) to User-Agent headers.

🔍 Diagnostic Workflow

Step 0: Non-Interactive Context Discovery & Time Window Definition

  1. Parameter Extraction: Extract required context (project_id,

cluster_name, cluster_location, workload_name, workload_namespace) non-interactively from the user prompt, active SETTINGS.md, or active environment defaults:

config current-context or gcloud config get-value project`).

environment defaults to ensure autonomous execution flow.

  1. Cluster Credentials & Fallback Mode:

{cluster_name} --region/--zone {cluster_location}`

non-existent, or live command execution fails (such as in sandboxed evaluations, dry-run mode, or offline analysis):

overflow in unreachable cluster scenarios.

commands for the human operator to run.

manifest fix based on the reported symptoms.

  1. Time Handling & Fallbacks:

timestamp, use it as {issue_time}.

calculate the corresponding UTC timestamp based on current system time, and use it as {issue_time}.

{issue_time}.

{issue_time} (start_time = {issue_time} - 30m, end_time = {issue_time} + 30m).

--------------------------------------------------------------------------------

Step 1: Analyze Pod Status and Conditions

Inspect the workload's active pod states and controller status.

Diagnostic Commands:

# 1. Inspect the deployment's actual selector labels:
kubectl get deployment {workload_name} -n {workload_namespace} -o jsonpath='{.spec.selector.matchLabels}'
# 2. Query the pods using the returned labels, for example:
kubectl get pods -l {selector_labels} -n {workload_namespace}
kubectl get deploy/{workload_name} -n {workload_namespace} -o yaml

Diagnostic Decision Tree:

Namespace Events)**.

an increasing back-off delay of up to five minutes. First read the terminated reason and exit code:

    kubectl describe pod {pod_name} -n {workload_namespace}
    kubectl get pod {pod_name} -n {workload_namespace} -o jsonpath='{.status.containerStatuses[*].lastState.terminated}'

reached. Proceed to Step 3 (Inspect Logs) → OOM Analysis to classify container-level vs node-level, then Step 5 to propose fixes.

Deployment/StatefulSet — restartPolicy: Always restarts the finished process, creating the loop. Common causes: the command/entrypoint does not start a persistent process, a worker exits on an empty queue, or a missing/invalid config (e.g., an unattached or mis-keyed ConfigMap volume) makes the app exit cleanly. Proceed to Step 3 (Inspect Logs).

is wrong or absent in the image. Verify the container command in the manifest.

configuration errors, missing/invalid env vars or config files, unreachable dependencies, or auth failures (401/403) on Google Cloud calls (check the Pod's IAM / Workload Identity Federation). Proceed directly to Step 3 (Inspect Logs).

suspect a liveness probe failure (see Step 3).

keeps retrying with back-off; ErrImagePull is a general, non-recoverable pull error. Related statuses: InvalidImageName, RegistryUnavailable, SignatureValidationFailed, ImageInspectError. Proceed to Step 2 (Query Namespace Events) to read the exact pull error message.

pulling. Proceed directly to Step 2 (Query Namespace Events).

--------------------------------------------------------------------------------

Step 2: Query Namespace Events

Look for infrastructure, volume, image, or scheduling alerts in GKE.

Diagnostic Command:

kubectl get events -n {workload_namespace} --sort-by='.metadata.creationTimestamp'
# Or query Cloud Logging for historical GKE events within the time window:
gcloud logging read "resource.type=\"k8s_cluster\" AND logName=\"projects/{project_id}/logs/events\" AND jsonPayload.involvedObject.namespace=\"{workload_namespace}\"" --start-time="{start_time}" --end-time="{end_time}" --project="{project_id}"
# Or query specifically for image pull failures within the time window:
gcloud logging read 'log_id("events") AND resource.type="k8s_pod" AND resource.labels.cluster_name="{cluster_name}" AND jsonPayload.message=~"Failed to pull image"' --project="{project_id}"

*Note: Retrieve the sorted events list and manually inspect the event timestamps (CreationTimestamp/LastSeen) to identify failures occurring within the {start_time} and {end_time} window.*

Signature Identifiers:

0/3 nodes are available: 3 Insufficient memory. or missing node affinity tolerations (e.g. Spot VM taints).

(Failed to pull image "IMAGE": ...) and triage by what it actually says. Do not jump to IAM / node service-account investigation unless the message is genuinely a permission or authentication error.

InvalidImageName): the most common cause — the tag or path is wrong, or the image was deleted, frequently introduced by a recent deployment change.

-p -S "{image_name}" -- {manifest_file_path} (or run git log` on the folder containing manifests).

correcting the tag) in the manifest patch.

Forbidden / denied, or 401 Unauthorized / unauthorized`): the node cannot authorize or authenticate to the registry. Pursue the checks below only when the message matches.

(or the imagePullSecret's service account) is missing registry read access. Suggest granting it by presenting the following command for the user to review and run; do not execute it. For Artifact Registry:

            gcloud artifacts repositories add-iam-policy-binding {repository} \
              --location={repo_location} \
              --member="serviceAccount:{node_service_account_email}" \
              --role="roles/artifactregistry.reader"

For Container Registry (gcr.io), grant roles/storage.objectViewer on the backing bucket (or the Artifact Registry role if gcr.io was migrated). Also check that any VPC Service Controls perimeter allows Artifact Registry.

is disabled or the node lacks the required OAuth scope:

            gcloud container clusters describe {cluster_name} --location={cluster_location} \
              --format="table(nodePools.name,nodePools.config.serviceAccount)"
            gcloud iam service-accounts list \
              --filter="email:{node_service_account_email} AND disabled:true" --project={project_id}
            gcloud compute instances describe {node_name} --zone={node_zone} \
              --format="flattened(serviceAccounts[].scopes)"

Scopes must include devstorage.read_only or cloud-platform (provided by gke-default). Nodes are immutable, so suggest recreating the node pool with --scopes="gke-default" if the scope is missing — present it as a proposed command for the user to run, do not execute it.

exists and is referenced by the Deployment.

misbehaving → registry network path (DNS, firewall egress, Google API connectivity); exec format error` or a deprecated schema-1 image → architecture/schema mismatch.

--------------------------------------------------------------------------------

Step 3: Inspect Application Logs

Extract exceptions and stack traces from the application runtime.

Diagnostic Commands:

# Check current active log stream (handles multi-