[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69954KFDTZS7Z474NRVY7C5":3,"skill-same:01M69954KFDTZS7Z474NRVY7C5":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":52,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M69954KFDTZS7Z474NRVY7C5","gke-workload-troubleshooting",null,"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.","google\u002Fskills","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M698WR0H76ENHE587T9EJT89",24235,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fgke-workload-troubleshooting\u002FSKILL.md",[],[19,20,21,22,23,9,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"gke workload troubleshooting","workload","gke","troubleshooting","when","pending","for","cluster","events","creation","use","node","services","start","logs","infrastructure","google cloud","kubernetes","containers","2026-11-10 10:12:30",false,"---\nname: gke-workload-troubleshooting\nmetadata:\n  version: \"1.0.1\"\n  category: Containers\ndescription: >-\n  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.\n---\n\n# GKE Workload Troubleshooting Skill\n\nUse this skill to systematically diagnose and resolve failures in application\nworkloads deployed in GKE clusters. This skill operates non-interactively and\nenforces a read-only diagnostics boundary: it only **proposes** fixes — whether\nKubernetes manifest\u002Fconfig patches or Google Cloud changes (for example `gcloud`\nIAM bindings or node-pool recreation) — and never executes live mutations\nitself.\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\u002Fattribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\u002F1.0 (skill:gke-workload-troubleshooting)\"`\nand append `agent-skills\u002F1.0 (skill:gke-workload-troubleshooting)` to `User-Agent` headers.\n\n## ? Diagnostic Workflow\n\n### Step 0: Non-Interactive Context Discovery & Time Window Definition\n\n1.  **Parameter Extraction**: Extract required context (`project_id`,\n    `cluster_name`, `cluster_location`, `workload_name`, `workload_namespace`)\n    non-interactively from the user prompt, active `SETTINGS.md`, or active\n    environment defaults:\n\n    -   Default `workload_namespace` to `default` if omitted.\n    -   Infer missing cluster parameters from active environment (`kubectl\n        config current-context` or `gcloud config get-value project`).\n    -   Prioritize non-interactive context discovery from prompts and\n        environment defaults to ensure autonomous execution flow.\n\n2.  **Cluster Credentials & Fallback Mode**:\n\n    -   Attempt credential fetch: `gcloud container clusters get-credentials\n        {cluster_name} --region\u002F--zone {cluster_location}`\n    -   **Fallback \u002F Dry-Run Mode**: If the cluster is unreachable,\n        non-existent, or live command execution fails (such as in sandboxed\n        evaluations, dry-run mode, or offline analysis):\n        -   Limit retry attempts to avoid resource exhaustion and context\n            overflow in unreachable cluster scenarios.\n        -   Immediately present the exact sequence of `kubectl` diagnostic\n            commands for the human operator to run.\n        -   Synthesize the root cause analysis and output the proposed GitOps\n            manifest fix based on the reported symptoms.\n\n3.  **Time Handling & Fallbacks**:\n\n    -   **Determine Issue Timestamp ({issue_time})**:\n        -   **Specific Time Provided**: If the user provides a specific\n            timestamp, use it as `{issue_time}`.\n        -   **Relative Time Provided (e.g., \"5 minutes ago\")**: Dynamically\n            calculate the corresponding UTC timestamp based on current system\n            time, and use it as `{issue_time}`.\n        -   **No Time Provided (Default)**: Use current system time as\n            `{issue_time}`.\n    -   **Window Calculation**: Center a 1-hour query window around\n        `{issue_time}` (`start_time` = `{issue_time} - 30m`, `end_time` =\n        `{issue_time} + 30m`).\n\n--------------------------------------------------------------------------------\n\n### Step 1: Analyze Pod Status and Conditions\n\nInspect the workload's active pod states and controller status.\n\n**Diagnostic Commands:**\n\n```bash\n# 1. Inspect the deployment's actual selector labels:\nkubectl get deployment {workload_name} -n {workload_namespace} -o jsonpath='{.spec.selector.matchLabels}'\n# 2. Query the pods using the returned labels, for example:\nkubectl get pods -l {selector_labels} -n {workload_namespace}\nkubectl get deploy\u002F{workload_name} -n {workload_namespace} -o yaml\n```\n\n#### Diagnostic Decision Tree:\n\n-   **Phase: Pending**:\n    -   The Pod cannot schedule on any node. Proceed directly to **Step 2 (Query\n        Namespace Events)**.\n-   **State: CrashLoopBackOff \u002F Error**:\n\n    -   The container boots but exits repeatedly; the `kubelet` restarts it with\n        an increasing back-off delay of up to five minutes. First read the\n        terminated **reason** and **exit code**:\n\n    ```bash\n    kubectl describe pod {pod_name} -n {workload_namespace}\n    kubectl get pod {pod_name} -n {workload_namespace} -o jsonpath='{.status.containerStatuses[*].lastState.terminated}'\n    ```\n\n    -   **Reason: OOMKilled (Exit Code 137)**: The container's memory limit was\n        reached. Proceed to **Step 3 (Inspect Logs) → OOM Analysis** to classify\n        container-level vs node-level, then **Step 5** to propose fixes.\n    -   **Exit Code 0 (successful exit)**: Unexpected for a long-running\n        Deployment\u002FStatefulSet — `restartPolicy: Always` restarts the finished\n        process, creating the loop. Common causes: the `command`\u002F`entrypoint`\n        does not start a persistent process, a worker exits on an empty queue,\n        or a missing\u002Finvalid config (e.g., an unattached or mis-keyed\n        `ConfigMap` volume) makes the app exit cleanly. Proceed to **Step 3\n        (Inspect Logs)**.\n    -   **Exit Code 128**: Invalid `command`\u002F`entrypoint` — the executable path\n        is wrong or absent in the image. Verify the container command in the\n        manifest.\n    -   **Exit Code 1 or other non-zero**: The application crashed —\n        configuration errors, missing\u002Finvalid env vars or config files,\n        unreachable dependencies, or auth failures (`401`\u002F`403`) on Google Cloud\n        calls (check the Pod's IAM \u002F Workload Identity Federation). Proceed\n        directly to **Step 3 (Inspect Logs)**.\n    -   If the exit code looks healthy but the container keeps restarting,\n        suspect a **liveness probe failure** (see Step 3).\n\n-   **State: ImagePullBackOff \u002F ErrImagePull**:\n\n    -   The kubelet cannot pull the container image. `ImagePullBackOff` means it\n        keeps retrying with back-off; `ErrImagePull` is a general,\n        non-recoverable pull error. Related statuses: `InvalidImageName`,\n        `RegistryUnavailable`, `SignatureValidationFailed`, `ImageInspectError`.\n        Proceed to **Step 2 (Query Namespace Events)** to read the exact pull\n        error message.\n\n-   **State: ContainerCreating**:\n\n    -   The container is blocked during volume mount, networking setup, or image\n        pulling. Proceed directly to **Step 2 (Query Namespace Events)**.\n\n--------------------------------------------------------------------------------\n\n### Step 2: Query Namespace Events\n\nLook for infrastructure, volume, image, or scheduling alerts in GKE.\n\n**Diagnostic Command:**\n\n```bash\nkubectl get events -n {workload_namespace} --sort-by='.metadata.creationTimestamp'\n# Or query Cloud Logging for historical GKE events within the time window:\ngcloud logging read \"resource.type=\\\"k8s_cluster\\\" AND logName=\\\"projects\u002F{project_id}\u002Flogs\u002Fevents\\\" AND jsonPayload.involvedObject.namespace=\\\"{workload_namespace}\\\"\" --start-time=\"{start_time}\" --end-time=\"{end_time}\" --project=\"{project_id}\"\n# Or query specifically for image pull failures within the time window:\ngcloud 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}\"\n```\n\n*Note: Retrieve the sorted events list and manually inspect the event timestamps\n(CreationTimestamp\u002FLastSeen) to identify failures occurring within the\n`{start_time}` and `{end_time}` window.*\n\n#### Signature Identifiers:\n\n-   **`FailedScheduling`**: Node resource exhaustion. Look for messages like\n    `0\u002F3 nodes are available: 3 Insufficient memory.` or missing node affinity\n    tolerations (e.g. Spot VM taints).\n-   **`FailedMount`**:\n    -   Missing PersistentVolumeClaim (`PVC`).\n    -   Missing Secret (`Secret \"{secret_name}\" not found`).\n    -   Missing ConfigMap (`ConfigMap \"{configmap_name}\" not found`).\n-   **`Failed` \u002F `BackOff` (Image Pull)**: First read the exact event message\n    (`Failed to pull image \"IMAGE\": ...`) and triage by what it actually says.\n    Do **not** jump to IAM \u002F node service-account investigation unless the\n    message is genuinely a permission or authentication error.\n\n    -   **Wrong image name\u002Ftag — start here** (`not found`, `manifest unknown`,\n        `InvalidImageName`): the most common cause — the tag or path is wrong,\n        or the image was deleted, frequently introduced by a recent deployment\n        change.\n        *   Identify the failing container image name and the invalid tag.\n        *   Check the Git history for the last known working image tag: `git log\n            -p -S \"{image_name}\" -- {manifest_file_path}` (or run `git log` on\n            the folder containing manifests).\n        *   Propose reverting the image tag to the last working version (or\n            correcting the tag) in the manifest patch.\n    -   **Permission \u002F authentication errors only** (the message contains `403\n        Forbidden` \u002F `denied`, or `401 Unauthorized` \u002F `unauthorized`): the node\n        cannot authorize or authenticate to the registry. Pursue the checks\n        below **only** when the message matches.\n\n        *   **`403 Forbidden` (authorization)** — the node pool service account\n            (or the imagePullSecret's service account) is missing registry read\n            access. **Suggest** granting it by presenting the following command\n            for the user to review and run; do not execute it. For **Artifact\n            Registry**:\n\n            ```bash\n            gcloud artifacts repositories add-iam-policy-binding {repository} \\\n              --location={repo_location} \\\n              --member=\"serviceAccount:{node_service_account_email}\" \\\n              --role=\"roles\u002Fartifactregistry.reader\"\n            ```\n\n            For **Container Registry (`gcr.io`)**, grant\n            `roles\u002Fstorage.objectViewer` on the backing bucket (or the Artifact\n            Registry role if `gcr.io` was migrated). Also check that any **VPC\n            Service Controls** perimeter allows Artifact Registry.\n        *   **`401 Unauthorized` (authentication)** — the node service account\n            is disabled or the node lacks the required OAuth scope:\n\n            ```bash\n            gcloud container clusters describe {cluster_name} --location={cluster_location} \\\n              --format=\"table(nodePools.name,nodePools.config.serviceAccount)\"\n            gcloud iam service-accounts list \\\n              --filter=\"email:{node_service_account_email} AND disabled:true\" --project={project_id}\n            gcloud compute instances describe {node_name} --zone={node_zone} \\\n              --format=\"flattened(serviceAccounts[].scopes)\"\n            ```\n\n            Scopes must include `devstorage.read_only` or `cloud-platform`\n            (provided by `gke-default`). Nodes are immutable, so **suggest**\n            recreating the node pool with `--scopes=\"gke-default\"` if the scope\n            is missing — present it as a proposed command for the user to run,\n            do not execute it.\n        *   **Private \u002F self-hosted registry**: ensure a valid `imagePullSecret`\n            exists and is referenced by the Deployment.\n    -   **Other statuses**: `RegistryUnavailable` \u002F `i\u002Fo timeout` \u002F DNS `server\n        misbehaving` → registry network path (DNS, firewall egress, Google API\n        connectivity); `exec format error` or a deprecated schema-1 image →\n        architecture\u002Fschema mismatch.\n\n--------------------------------------------------------------------------------\n\n### Step 3: Inspect Application Logs\n\nExtract exceptions and stack traces from the application runtime.\n\n**Diagnostic Commands:**\n\n```bash\n# Check current active log stream (handles multi-container pods)\nkubectl logs {pod_name} -n {workload_namespace} --all-containers --tail=100\n\n# Check logs from previously terminated container instances (handles multi-container pods)\nkubectl logs {pod_name} -n {workload_namespace} --all-containers -p --tail=100\n```\n\n#### Signature Identifiers:\n\n-   **Out-of-Memory (OOM) Analysis**: First confirm and classify the kill.\n\n    -   **Container-level OOM** (most common): `kubectl describe pod` shows\n        `Last State: Terminated`, `Reason: OOMKilled`, `Exit Code: 137`. The\n        container exceeded its cgroup memory limit. Differentiate an\n        **application memory leak\u002Floop** (unbounded growth in logs and startup\n        command) from an **infrastructure capacity mismatch** (legitimate demand\n        exceeding `resources.limits.memory`).\n    -   **Node-level (system) OOM**: the entire node ran out of memory; look for\n        evicted Pods and node-pressure eviction. The combined memory of all Pods\n        exceeded node capacity.\n    -   **\"Invisible\" OOM** (`cgroup v1`): a child process is killed but the\n        main process (PID 1) keeps running, so Kubernetes never marks\n        `OOMKilled`. Search node logs in Cloud Logging:\n\n        ```bash\n        gcloud logging read 'resource.type=\"k8s_node\" AND resource.labels.cluster_name=\"{cluster_name}\" AND jsonPayload.MESSAGE:(\"TaskOOM event\" OR \"ContainerDied\")' --project=\"{project_id}\"\n        ```\n\n        A `TaskOOM` entry confirms an OOM kill; match its container ID to the\n        `ContainerDied` entry to find the affected Pod. On the node, `journalctl\n        -k` distinguishes container-level kills (`memory cgroup`, `memcg`) from\n        system-level kills (`Out of memory: Killed process`).\n    -   Do not rely solely on sampled memory metrics — they often miss the spike\n        that triggers the kill. Then proceed to **Step 5** to propose fixes\n        (raise limits, fix the leak, or right-size the node pool).\n-   **Liveness Probe Failure (CrashLoop with no application error)**: if the\n    container restarts but its logs show no crash, the `kubelet` may be killing\n    it on failed liveness probes (default `failureThreshold: 3`). Confirm in\n    Cloud Logging:\n\n    ```bash\n    gcloud logging read 'resource.type=\"k8s_node\" AND log_id(\"kubelet\") AND jsonPayload.MESSAGE:\"failed liveness probe, will be restarted\" AND resource.labels.cluster_name=\"{cluster_name}\"' --project=\"{project_id}\"\n    ```\n\n    Common fixes: correct the probe type\u002Fpath\u002Fport, raise `initialDelaySeconds`\n    or `timeoutSeconds`\u002F`failureThreshold` for slow starts, or relieve CPU\u002Fdisk\n    I\u002FO contention causing probe timeouts. Keep probe commands lightweight.\n-   **Stack Trace \u002F Unhandled Exception**: Look for language-specific stack\n    traces (e.g., `panic:`, `NullPointerException`, `Traceback (most recent\n    call)`). This indicates an application bug.\n-   **Egress Network Timeout**: Look for connection timeouts (e.g., `Connection\n    timed out`, `dial tcp: i\u002Fo timeout`). Proceed to **Step 4 (Verify\n    Connectivity)**.\n-   **Permission Errors (ReadOnlyRootFilesystem)**: Look for write errors (e.g.,\n    `Read-only file system`, `Permission denied` when writing to `\u002Ftmp` or\n    `\u002Fvar\u002Flog`). Propose adding an `emptyDir` volume mount to that directory in\n    the manifest.\n\n--------------------------------------------------------------------------------\n\n### Step 4: Verify Service Connectivity and Network Policies\n\nTroubleshoot connection drops to other services.\n\n**Diagnostic Commands:**\n\n```bash\n# Verify target endpoint is active\nkubectl get endpoints {target_service_name} -n {target_namespace}\n\n# Query network policies inside namespace\nkubectl get networkpolicies -n {workload_namespace} -o yaml\n```\n\n#### Logic & Dry-Run Fallback:\n\n1.  **Live Cluster Mode**:\n\n    -   If `kubectl get endpoints` returns an empty list, the target\n        microservice itself is failing to schedule or boot (troubleshoot target\n        service).\n    -   If endpoints exist but logs show timeouts, analyze `NetworkPolicy`\n        egress blocks to verify if egress traffic to the target service's\n        IP\u002Fport is allowed.\n\n2.  **Sandboxed \u002F Dry-Run Mode**:\n\n    -   If live `kubectl` queries fail or cluster connection is unavailable, do\n        NOT retry live cluster access or enter repetitive connection attempts.\n    -   Immediately inspect the application source code (e.g. `worker.py`,\n        `app.go`, DB connection strings) or Deployment manifests to identify the\n        target service hostname (e.g. `account-db`) and destination port (e.g.\n        `5432`).\n    -   Present the exact `kubectl get endpoints` and `kubectl get\n        networkpolicies` commands for the user, and synthesize the required\n        `NetworkPolicy` egress patch allowing traffic to the target service and\n        port.\n\n--------------------------------------------------------------------------------\n\n### Step 5: Propose GitOps Correction\n\nFollowing the GitOps boundary, **do not apply changes directly** — this includes\nboth cluster manifest\u002Fconfig patches and any Google Cloud mutations (for example\n`gcloud` IAM bindings or node-pool recreation). Present every change as a\nreviewable suggestion: a manifest patch \u002F PR, or a command for the user to run.\n\n1.  Synthesize the root cause analysis for the human operator (e.g.\n    *\"payment-api is failing with exit code 137 because its memory limit is set\n    to 256Mi while actual usage spiked to 270Mi\"*).\n2.  Generate the corrected YAML manifest patch (e.g. increase memory limits, add\n    missing Secret mounts, or add tolerations for Spot nodes).\n3.  Check if a branch or Pull Request (PR) already exists for this\n    workload\u002Ffailure. If so, update the existing branch\u002FPR or notify the user\n    instead of creating a duplicate. Otherwise, create a branch, commit the\n    change, open a Pull Request (PR) on GitHub, and conclude the workflow (do\n    not wait for human merge).\n\n--------------------------------------------------------------------------------\n\n## References\n\n-   [Troubleshoot OOM events](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Ftroubleshooting\u002Foom-events.md.txt)\n-   [Troubleshoot image pulls](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Ftroubleshooting\u002Fimage-pulls.md.txt)\n-   [Troubleshoot CrashLoopBackOff events](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Ftroubleshooting\u002Fcrashloopbackoff-events.md.txt)\n-   [Troubleshoot deployed workloads](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Ftroubleshooting\u002Fdeployed-workloads.md.txt)\n-   [Artifact Registry access control with GKE](https:\u002F\u002Fdocs.cloud.google.com\u002Fartifact-registry\u002Fdocs\u002Faccess-control.md.txt#gke)\n","# GKE Workload Troubleshooting Skill\n\nUse this skill to systematically diagnose and resolve failures in application\nworkloads deployed in GKE clusters. This skill operates non-interactively and\nenforces a read-only diagnostics boundary: it only **proposes** fixes — whether\nKubernetes manifest\u002Fconfig patches or Google Cloud changes (for example `gcloud`\nIAM bindings or node-pool recreation) — and never executes live mutations\nitself.\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\u002Fattribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\u002F1.0 (skill:gke-workload-troubleshooting)\"`\nand append `agent-skills\u002F1.0 (skill:gke-workload-troubleshooting)` to `User-Agent` headers.\n\n## ? Diagnostic Workflow\n\n### Step 0: Non-Interactive Context Discovery & Time Window Definition\n\n1.  **Parameter Extraction**: Extract required context (`project_id`,\n    `cluster_name`, `cluster_location`, `workload_name`, `workload_namespace`)\n    non-interactively from the user prompt, active `SETTINGS.md`, or active\n    environment defaults:\n\n    -   Default `workload_namespace` to `default` if omitted.\n    -   Infer missing cluster parameters from active environment (`kubectl\n        config current-context` or `gcloud config get-value project`).\n    -   Prioritize non-interactive context discovery from prompts and\n        environment defaults to ensure autonomous execution flow.\n\n2.  **Cluster Credentials & Fallback Mode**:\n\n    -   Attempt credential fetch: `gcloud container clusters get-credentials\n        {cluster_name} --region\u002F--zone {cluster_location}`\n    -   **Fallback \u002F Dry-Run Mode**: If the cluster is unreachable,\n        non-existent, or live command execution fails (such as in sandboxed\n        evaluations, dry-run mode, or offline analysis):\n        -   Limit retry attempts to avoid resource exhaustion and context\n            overflow in unreachable cluster scenarios.\n        -   Immediately present the exact sequence of `kubectl` diagnostic\n            commands for the human operator to run.\n        -   Synthesize the root cause analysis and output the proposed GitOps\n            manifest fix based on the reported symptoms.\n\n3.  **Time Handling & Fallbacks**:\n\n    -   **Determine Issue Timestamp ({issue_time})**:\n        -   **Specific Time Provided**: If the user provides a specific\n            timestamp, use it as `{issue_time}`.\n        -   **Relative Time Provided (e.g., \"5 minutes ago\")**: Dynamically\n            calculate the corresponding UTC timestamp based on current system\n            time, and use it as `{issue_time}`.\n        -   **No Time Provided (Default)**: Use current system time as\n            `{issue_time}`.\n    -   **Window Calculation**: Center a 1-hour query window around\n        `{issue_time}` (`start_time` = `{issue_time} - 30m`, `end_time` =\n        `{issue_time} + 30m`).\n\n--------------------------------------------------------------------------------\n\n### Step 1: Analyze Pod Status and Conditions\n\nInspect the workload's active pod states and controller status.\n\n**Diagnostic Commands:**\n\n```bash\n# 1. Inspect the deployment's actual selector labels:\nkubectl get deployment {workload_name} -n {workload_namespace} -o jsonpath='{.spec.selector.matchLabels}'\n# 2. Query the pods using the returned labels, for example:\nkubectl get pods -l {selector_labels} -n {workload_namespace}\nkubectl get deploy\u002F{workload_name} -n {workload_namespace} -o yaml\n```\n\n#### Diagnostic Decision Tree:\n\n-   **Phase: Pending**:\n    -   The Pod cannot schedule on any node. Proceed directly to **Step 2 (Query\n        Namespace Events)**.\n-   **State: CrashLoopBackOff \u002F Error**:\n\n    -   The container boots but exits repeatedly; the `kubelet` restarts it with\n        an increasing back-off delay of up to five minutes. First read the\n        terminated **reason** and **exit code**:\n\n    ```bash\n    kubectl describe pod {pod_name} -n {workload_namespace}\n    kubectl get pod {pod_name} -n {workload_namespace} -o jsonpath='{.status.containerStatuses[*].lastState.terminated}'\n    ```\n\n    -   **Reason: OOMKilled (Exit Code 137)**: The container's memory limit was\n        reached. Proceed to **Step 3 (Inspect Logs) → OOM Analysis** to classify\n        container-level vs node-level, then **Step 5** to propose fixes.\n    -   **Exit Code 0 (successful exit)**: Unexpected for a long-running\n        Deployment\u002FStatefulSet — `restartPolicy: Always` restarts the finished\n        process, creating the loop. Common causes: the `command`\u002F`entrypoint`\n        does not start a persistent process, a worker exits on an empty queue,\n        or a missing\u002Finvalid config (e.g., an unattached or mis-keyed\n        `ConfigMap` volume) makes the app exit cleanly. Proceed to **Step 3\n        (Inspect Logs)**.\n    -   **Exit Code 128**: Invalid `command`\u002F`entrypoint` — the executable path\n        is wrong or absent in the image. Verify the container command in the\n        manifest.\n    -   **Exit Code 1 or other non-zero**: The application crashed —\n        configuration errors, missing\u002Finvalid env vars or config files,\n        unreachable dependencies, or auth failures (`401`\u002F`403`) on Google Cloud\n        calls (check the Pod's IAM \u002F Workload Identity Federation). Proceed\n        directly to **Step 3 (Inspect Logs)**.\n    -   If the exit code looks healthy but the container keeps restarting,\n        suspect a **liveness probe failure** (see Step 3).\n\n-   **State: ImagePullBackOff \u002F ErrImagePull**:\n\n    -   The kubelet cannot pull the container image. `ImagePullBackOff` means it\n        keeps retrying with back-off; `ErrImagePull` is a general,\n        non-recoverable pull error. Related statuses: `InvalidImageName`,\n        `RegistryUnavailable`, `SignatureValidationFailed`, `ImageInspectError`.\n        Proceed to **Step 2 (Query Namespace Events)** to read the exact pull\n        error message.\n\n-   **State: ContainerCreating**:\n\n    -   The container is blocked during volume mount, networking setup, or image\n        pulling. Proceed directly to **Step 2 (Query Namespace Events)**.\n\n--------------------------------------------------------------------------------\n\n### Step 2: Query Namespace Events\n\nLook for infrastructure, volume, image, or scheduling alerts in GKE.\n\n**Diagnostic Command:**\n\n```bash\nkubectl get events -n {workload_namespace} --sort-by='.metadata.creationTimestamp'\n# Or query Cloud Logging for historical GKE events within the time window:\ngcloud logging read \"resource.type=\\\"k8s_cluster\\\" AND logName=\\\"projects\u002F{project_id}\u002Flogs\u002Fevents\\\" AND jsonPayload.involvedObject.namespace=\\\"{workload_namespace}\\\"\" --start-time=\"{start_time}\" --end-time=\"{end_time}\" --project=\"{project_id}\"\n# Or query specifically for image pull failures within the time window:\ngcloud 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}\"\n```\n\n*Note: Retrieve the sorted events list and manually inspect the event timestamps\n(CreationTimestamp\u002FLastSeen) to identify failures occurring within the\n`{start_time}` and `{end_time}` window.*\n\n#### Signature Identifiers:\n\n-   **`FailedScheduling`**: Node resource exhaustion. Look for messages like\n    `0\u002F3 nodes are available: 3 Insufficient memory.` or missing node affinity\n    tolerations (e.g. Spot VM taints).\n-   **`FailedMount`**:\n    -   Missing PersistentVolumeClaim (`PVC`).\n    -   Missing Secret (`Secret \"{secret_name}\" not found`).\n    -   Missing ConfigMap (`ConfigMap \"{configmap_name}\" not found`).\n-   **`Failed` \u002F `BackOff` (Image Pull)**: First read the exact event message\n    (`Failed to pull image \"IMAGE\": ...`) and triage by what it actually says.\n    Do **not** jump to IAM \u002F node service-account investigation unless the\n    message is genuinely a permission or authentication error.\n\n    -   **Wrong image name\u002Ftag — start here** (`not found`, `manifest unknown`,\n        `InvalidImageName`): the most common cause — the tag or path is wrong,\n        or the image was deleted, frequently introduced by a recent deployment\n        change.\n        *   Identify the failing container image name and the invalid tag.\n        *   Check the Git history for the last known working image tag: `git log\n            -p -S \"{image_name}\" -- {manifest_file_path}` (or run `git log` on\n            the folder containing manifests).\n        *   Propose reverting the image tag to the last working version (or\n            correcting the tag) in the manifest patch.\n    -   **Permission \u002F authentication errors only** (the message contains `403\n        Forbidden` \u002F `denied`, or `401 Unauthorized` \u002F `unauthorized`): the node\n        cannot authorize or authenticate to the registry. Pursue the checks\n        below **only** when the message matches.\n\n        *   **`403 Forbidden` (authorization)** — the node pool service account\n            (or the imagePullSecret's service account) is missing registry read\n            access. **Suggest** granting it by presenting the following command\n            for the user to review and run; do not execute it. For **Artifact\n            Registry**:\n\n            ```bash\n            gcloud artifacts repositories add-iam-policy-binding {repository} \\\n              --location={repo_location} \\\n              --member=\"serviceAccount:{node_service_account_email}\" \\\n              --role=\"roles\u002Fartifactregistry.reader\"\n            ```\n\n            For **Container Registry (`gcr.io`)**, grant\n            `roles\u002Fstorage.objectViewer` on the backing bucket (or the Artifact\n            Registry role if `gcr.io` was migrated). Also check that any **VPC\n            Service Controls** perimeter allows Artifact Registry.\n        *   **`401 Unauthorized` (authentication)** — the node service account\n            is disabled or the node lacks the required OAuth scope:\n\n            ```bash\n            gcloud container clusters describe {cluster_name} --location={cluster_location} \\\n              --format=\"table(nodePools.name,nodePools.config.serviceAccount)\"\n            gcloud iam service-accounts list \\\n              --filter=\"email:{node_service_account_email} AND disabled:true\" --project={project_id}\n            gcloud compute instances describe {node_name} --zone={node_zone} \\\n              --format=\"flattened(serviceAccounts[].scopes)\"\n            ```\n\n            Scopes must include `devstorage.read_only` or `cloud-platform`\n            (provided by `gke-default`). Nodes are immutable, so **suggest**\n            recreating the node pool with `--scopes=\"gke-default\"` if the scope\n            is missing — present it as a proposed command for the user to run,\n            do not execute it.\n        *   **Private \u002F self-hosted registry**: ensure a valid `imagePullSecret`\n            exists and is referenced by the Deployment.\n    -   **Other statuses**: `RegistryUnavailable` \u002F `i\u002Fo timeout` \u002F DNS `server\n        misbehaving` → registry network path (DNS, firewall egress, Google API\n        connectivity); `exec format error` or a deprecated schema-1 image →\n        architecture\u002Fschema mismatch.\n\n--------------------------------------------------------------------------------\n\n### Step 3: Inspect Application Logs\n\nExtract exceptions and stack traces from the application runtime.\n\n**Diagnostic Commands:**\n\n```bash\n# Check current active log stream (handles multi-container pods)\nkubectl logs {pod_name} -n {workload_namespace} --all-containers --tail=100\n\n# Check logs from previously terminated container instances (handles multi-container pods)\nkubectl logs {pod_name} -n {workload_namespace} --all-containers -p --tail=100\n```\n\n#### Signature Identifiers:\n\n-   **Out-of-Memory (OOM) Analysis**: First confirm and classify the kill.\n\n    -   **Container-level OOM** (most common): `kubectl describe pod` shows\n        `Last State: Terminated`, `Reason: OOMKilled`, `Exit Code: 137`. The\n        container exceeded its cgroup memory limit. Differentiate an\n        **application memory leak\u002Floop** (unbounded growth in logs and startup\n        command) from an **infrastructure capacity mismatch** (legitimate demand\n        exceeding `resources.limits.memory`).\n    -   **Node-level (system) OOM**: the entire node ran out of memory; look for\n        evicted Pods and node-pressure eviction. The combined memory of all Pods\n        exceeded node capacity.\n    -   **\"Invisible\" OOM** (`cgroup v1`): a child process is killed but the\n        main process (PID 1) keeps running, so Kubernetes never marks\n        `OOMKilled`. Search node logs in Cloud Logging:\n\n        ```bash\n        gcloud logging read 'resource.type=\"k8s_node\" AND resource.labels.cluster_name=\"{cluster_name}\" AND jsonPayload.MESSAGE:(\"TaskOOM event\" OR \"ContainerDied\")' --project=\"{project_id}\"\n        ```\n\n        A `TaskOOM` entry confirms an OOM kill; match its container ID to the\n        `ContainerDied` entry to find the affected Pod. On the node, `journalctl\n        -k` distinguishes container-level kills (`memory cgroup`, `memcg`) from\n        system-level kills (`Out of memory: Killed process`).\n    -   Do not rely solely on sampled memory metrics — they often miss the spike\n        that triggers the kill. Then proceed to **Step 5** to propose fixes\n        (raise limits, fix the leak, or right-size the node pool).\n-   **Liveness Probe Failure (CrashLoop with no application error)**: if the\n    container restarts but its logs show no crash, the `kubelet` may be killing\n    it on failed liveness probes (default `failureThreshold: 3`). Confirm in\n    Cloud Logging:\n\n    ```bash\n    gcloud logging read 'resource.type=\"k8s_node\" AND log_id(\"kubelet\") AND jsonPayload.MESSAGE:\"failed liveness probe, will be restarted\" AND resource.labels.cluster_name=\"{cluster_name}\"' --project=\"{project_id}\"\n    ```\n\n    Common fixes: correct the probe type\u002Fpath\u002Fport, raise `initialDelaySeconds`\n    or `timeoutSeconds`\u002F`failureThreshold` for slow starts, or relieve CPU\u002Fdisk\n    I\u002FO contention causing probe timeouts. Keep probe commands lightweight.\n-   **Stack Trace \u002F Unhandled Exception**: Look for language-specific stack\n    traces (e.g., `panic:`, `NullPointerException`, `Traceback (most recent\n    call)`). This indicates an application bug.\n-   **Egress Network Timeout**: Look for connection timeouts (e.g., `Connection\n    timed out`, `dial tcp: i\u002Fo timeout`). Proceed to **Step 4 (Verify\n    Connectivity)**.\n-   **Permission Errors (ReadOnlyRootFilesystem)**: Look for write errors (e.g.,\n    `Read-only file system`, `Permission denied` when writing to `\u002Ftmp` or\n    `\u002Fvar\u002Flog`). Propose adding an `emptyDir` volume mount to that directory in\n    the manifest.\n\n--------------------------------------------------------------------------------\n\n### Step 4: Verify Service Connectivity and Network Policies\n\nTroubleshoot connection drops to other services.\n\n**Diagnostic Commands:**\n\n```bash\n# Verify target endpoint is active\nkubectl get endpoints {target_service_name} -n {target_namespace}\n\n# Query network policies inside namespace\nkubectl get networkpolicies -n {workload_namespace} -o yaml\n```\n\n#### Logic & Dry-Run Fallback:\n\n1.  **Live Cluster Mode**:\n\n    -   If `kubectl get endpoints` returns an empty list, the target\n        microservice itself is failing to schedule or boot (troubleshoot target\n        service).\n    -   If endpoints exist but logs show timeouts, analyze `NetworkPolicy`\n        egress blocks to verify if egress traffic to the target service's\n        IP\u002Fport is allowed.\n\n2.  **Sandboxed \u002F Dry-Run Mode**:\n\n    -   If live `kubectl` queries fail or cluster connection is unavailable, do\n        NOT retry live cluster access or enter repetitive connection attempts.\n    -   Immediately inspect the application source code (e.g. `worker.py`,\n        `app.go`, DB connection strings) or Deployment manifests to identify the\n        target service hostname (e.g. `account-db`) and destination port (e.g.\n        `5432`).\n    -   Present the exact `kubectl get endpoints` and `kubectl get\n        networkpolicies` commands for the user, and synthesize the required\n        `NetworkPolicy` egress patch allowing traffic to the target service and\n        port.\n\n--------------------------------------------------------------------------------\n\n### Step 5: Propose GitOps Correction\n\nFollowing the GitOps boundary, **do not apply changes directly** — this includes\nboth cluster manifest\u002Fconfig patches and any Google Cloud mutations (for example\n`gcloud` IAM bindings or node-pool recreation). Present every change as a\nreviewable suggestion: a manifest patch \u002F PR, or a command for the user to run.\n\n1.  Synthesize the root cause analysis for the human operator (e.g.\n    *\"payment-api is failing with exit code 137 because its memory limit is set\n    to 256Mi while actual usage spiked to 270Mi\"*).\n2.  Generate the corrected YAML manifest patch (e.g. increase memory limits, add\n    missing Secret mounts, or add tolerations for Spot nodes).\n3.  Check if a branch or Pull Request (PR) already exists for this\n    workload\u002Ffailure. If so, update the existing branch\u002FPR or notify the user\n    instead of creating a duplicate. Otherwise, create a branch, commit the\n    change, open a Pull Request (PR) on GitHub, and conclude the workflow (do\n    not wait for human merge).\n\n--------------------------------------------------------------------------------\n\n## References\n\n-   [Troubleshoot OOM events](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Ftroubleshooting\u002Foom-events.md.txt)\n-   [Troubleshoot image pulls](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Ftroubleshooting\u002Fimage-pulls.md.txt)\n-   [Troubleshoot CrashLoopBackOff events](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Ftroubleshooting\u002Fcrashloopbackoff-events.md.txt)\n-   [Troubleshoot deployed workloads](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Ftroubleshooting\u002Fdeployed-workloads.md.txt)\n-   [Artifact Registry access control with GKE](https:\u002F\u002Fdocs.cloud.google.com\u002Fartifact-registry\u002Fdocs\u002Faccess-control.md.txt#gke)\n",{"name":5,"metadata":43,"description":7},{"version":44,"category":45},"1.0.1","Containers","main","bb9b3f464aae37af360d079c1d863524955b0363","skills\u002Fcloud\u002Fgke-workload-troubleshooting",2014,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 23:31:00",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add google\u002Fskills --skill gke-workload-troubleshooting",{"tool":61,"command":62},"bunx","bunx skills add google\u002Fskills --skill gke-workload-troubleshooting",{"tool":64,"command":65},"pnpm","pnpm dlx skills add google\u002Fskills --skill gke-workload-troubleshooting","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fgke-workload-troubleshooting\u002FSKILL.md",true,[69],{"path":70,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fattribution.md","REFERENCE","参考文档",1924,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fgke-workload-troubleshooting\u002Freferences\u002Fattribution.md",[76,84,91,98,105,112],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":83},"01M7DQ9K7JF4T7NJZ2K1MQZ44Q","cloud-operator-share-context","Shares Google Cloud operating context the user or their team already have — environments, projects, services and regions, product preferences, best practices, architecture guidance, runbooks — found in agent instruction files, local memory, skills and workflows, and the repository's GCP docs, with the operator agent's memory after the user reviews the list. Use when the user runs this skill, accepts the cloud-operator or cloud-operator-setup skill's offer to share their existing Google Cloud context, or asks to share, import or save that context or a GCP fact for the operator agent. Don't use for ordinary GCP requests, which go to the cloud-operator skill.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-operator-share-context\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":83},"01M7DQ9ERFGGQCFAWQW0KRKYBY","cloud-operator-setup","Sets up the operator agent in a Google Cloud project via the autocloud MCP server: picks the operator project, creates or checks the user's operator agent, saves the project, and offers to share the user's existing Google Cloud operating context with the operator agent's memory. Use when the user runs this skill, asks to set up the operator or create their operator agent, or chooses setup when the cloud-operator skill asks. Don't use for ordinary GCP requests or installing gcloud.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-operator-setup\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":83},"01M7B4RHQCM0DK2XQ7S7ZXVN8D","developer-device-platform-device-run","Runs automated, non-interactive jobs on remote Android devices with Developer Device Platform (DDP) Device Run using `gcloud beta device-run sessions`: native Android executables or shell scripts (for example CLI tools, custom runners, test harnesses or benchmarks) and Android instrumentation tests, on one or many devices, then waits for completion and collects per-device outputs and logs. Use when running a binary or test suite on remote devices without an interactive connection. Don't use it for interactive device reservations, adb tunnels or screen streaming (use developer-device-platform-basics), or for local devices.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fdeveloper-device-platform-device-run\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":83},"01M7B4R9YXMRW7RZP9Q9FMZJ2P","compute-vm-creation","Guides the planning, configuration, and provisioning of standalone Google Compute Engine virtual machines (VMs) and bare metal (-metal) instances using gcloud CLI commands or direct MCP tool execution. Use ONLY when the user wants to create, configure, or provision a new standalone Compute Engine VM or bare metal instance from conversational intents (hardware sizing, region selection, OS image, networking, security defaults). DO NOT read or use for Google Kubernetes Engine (GKE) Autopilot or Standard clusters, Kubernetes node pools or Pods, container orchestration, managing existing VMs, Managed Instance Groups (MIGs), or Instance Templates.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcompute-vm-creation\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":83},"01M7B4QD02N0YBVT0838Z5K5VC","agent-platform-autorater-customization","Customizes an autorater (evaluation metric) for an AI agent so its grades match the user's own judgment, starting from the agent's real trajectories. Use when a user wants a metric tailored to their agent, wants to turn failing trajectories into rubrics, says an existing autorater grades their agent wrong, or wants an autorater to agree with human labels (autorater hillclimbing, judge calibration). Don't use for quick evals with built-in metrics or for improving the agent itself (use agent-platform-eval-flywheel).","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fagent-platform-autorater-customization\u002FSKILL.md",[],[],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":83},"01M78JP22K73KK96JH0JNDT5C4","iap-agent-platform-troubleshooting","Diagnoses Identity-Aware Proxy (IAP) denials of outbound requests from Gemini Enterprise Agent Platform agents that run on Agent Runtime and send traffic through Agent Gateway. Use when an agent request fails with \"Egress request is not authorized\", when Cloud Audit Logs show an IAP egressViaIAP decision with granted false, when IAP audit entries are missing while debugging agent egress, or when Access policies, IAP allow policies, policy bindings, or Agent Registry entries might block agent egress. Don't use for Gemini model IAM permission errors (such as aiplatform.endpoints.predict), Agent Platform API errors, or Agent Runtime deployment or 500 errors (use agent-platform-troubleshooting instead). Don't use for setting up, creating, or connecting an Agent Gateway, or for IAP web apps, IAP TCP forwarding, or SSH.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fiap-agent-platform-troubleshooting\u002FSKILL.md",[],[]]