gke-workload-identity
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…
Install / Use
npx skills add google/skills --skill gke-workload-identityInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
SecuritySupported Platforms
Our assessment of gke-workload-identity
gke-workload-identity scores 98/100 on our quality scale, 62nd of 544 Security skills we index (top 12%).
Its SKILL.md is 17 KB long, well organised into 30 sections with 14 code examples: a thorough specification that gives an agent plenty to work with.
With 20,340 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 2 days ago, so gke-workload-identity is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.
Automated pattern scan on 2026-09-26. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
gke-workload-identity compared with similar skills
All 4 of these similar skills score higher than gke-workload-identity; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| gke-workload-identity (this skill)by google | 98 | 20.3k | 2d ago | SKILL.md |
| algorithmic-artby anthropics | 100 | 177.9k | 3d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 3d ago | SKILL.md |
| designby nextlevelbuilder | 100 | 130.2k | 4d ago | SKILL.md |
| ui-ux-pro-maxby nextlevelbuilder | 100 | 130.2k | 4d ago | SKILL.md |
Frequently asked questions
- How do I install gke-workload-identity?
- Run
npx skills add google/skills --skill gke-workload-identity. The install tabs above show the steps for each supported agent. - Which AI agents does gke-workload-identity work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is gke-workload-identity safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is gke-workload-identity still maintained?
- The repository was last updated 2 days ago, so gke-workload-identity is actively maintained.
Skill content
View source on GitHubname: gke-workload-identity metadata: version: "1.0.0" category: Security description: >- 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 a Pod cannot authenticate to Google Cloud APIs even though Workload Identity is expected to be in effect. Don't use for in-cluster Kubernetes RBAC errors (API-server authorization), general workload crashes (use gke-workload-troubleshooting), or Workload Identity setup and hardening (use gke-workload-security).
GKE Workload Identity Federation Troubleshooting Skill
Use this skill to systematically diagnose why a Pod using Workload Identity Federation for GKE cannot authenticate to Google Cloud APIs. Typical symptoms:
HTTP/403 ... Permission 'iam.serviceAccounts.getAccessToken' denied on resourcegoogle.auth.exceptions ... could not find default credentials/ComputeEngineCredentials cannot find the metadata server- API calls that unexpectedly use the node's default Compute Engine service account instead of the workload's identity.
Read-only boundary
This skill is diagnostic and non-interactive. It only reads cluster, IAM, and logging state and proposes fixes as commands or GitOps manifest changes for a human to apply. It must never create or modify IAM bindings, KSA annotations, node pools, or clusters automatically. When evidence is missing or the fix requires a privileged change, summarize findings and hand off to a human (see Step 7).
Output discipline (apply to every conclusion)
When you report a diagnosis, always:
- Name the single most-likely root cause (not an open-ended list of possibilities).
- Explicitly rule out the other plausible causes, citing the evidence that excludes them. In particular, when the cause is node-pool configuration, state plainly that it is not a KSA annotation or IAM binding problem; when the cause is a missing role on a target resource, state that Workload Identity itself is not misconfigured.
- Give the exact remediation as a proposed change for a human — a concrete
gcloudcommand (or GitOps manifest edit) with the real identifiers filled in — and never apply it automatically.
Diagnostic Workflow
Step 0: Context discovery & time window
Collect (from the user or the failing resource): PROJECT_ID, PROJECT_NUMBER,
CLUSTER, cluster LOCATION, NAMESPACE, the KSA the Pod runs as, the
node and node pool the Pod is scheduled on (used in Step 2), the target
resource / API being called, and the exact error string. Define a time
window around the first observed failure for log queries.
# Resolve the project number (used in the direct-binding principal identifier).
gcloud projects describe "{PROJECT_ID}" --format="value(projectNumber)"
# Confirm which KSA the workload runs as.
kubectl get pod "{pod_name}" -n "{namespace}" \
-o jsonpath='{.spec.serviceAccountName}'
# Identify the node the Pod runs on, then the node pool that node belongs to
# (Step 2 checks the node pool's Workload Identity mode).
NODE=$(kubectl get pod "{pod_name}" -n "{namespace}" -o jsonpath='{.spec.nodeName}')
kubectl get node "$NODE" \
-o jsonpath='{.metadata.labels.cloud\.google\.com/gke-nodepool}'
Step 1: Capture the exact error signature
Read the workload's own logs and the gke-metadata-server logs to classify the
failure.
kubectl logs "{pod_name}" -n "{namespace}" --all-containers --prefix
kubectl describe pod "{pod_name}" -n "{namespace}"
Equivalent via Cloud Logging (preferred for historical events). Open it as a
Logs Explorer deep link — URL-encode the query and append the project and
time window:
https://console.cloud.google.com/logs/query;query={URL_ENCODED_QUERY};timeRange={start}%2F{end}?project={project_id}
(encode / as %2F, or use ;duration=PT1H for a rolling hour):
resource.type="k8s_container"
resource.labels.namespace_name="{namespace}"
resource.labels.pod_name="{pod_name}"
severity>=WARNING
Classify the signature:
iam.serviceAccounts.getAccessTokendenied /HTTP/403→ the workload is using the GSA impersonation path. This is expected for the legacy setup, but if you intend to use direct binding, it means the KSA still carries a leftoveriam.gke.io/gcp-service-accountannotation (or the client SDK is configured to impersonate) and is unintentionally impersonating a GSA; go to Step 3.403 PERMISSION_DENIEDon the target API/resource (nogetAccessTokenin the error) → the resolved identity lacks the required IAM role on that resource; go to Step 4.could not find default credentials/cannot find the metadata server→ metadata-server connectivity or a startup race; go to Step 5.- Calls succeed but as the node default service account → Workload Identity is not in effect for this node pool; go to Step 2.
Step 2: Verify Workload Identity is enabled (cluster + node pool)
Both the cluster and the node pool the Pod runs on must have Workload
Identity enabled. A node pool with GCE_METADATA (instead of GKE_METADATA)
causes Pods to fall back to the node's default Compute Engine service account.
# Cluster must have a workload identity pool (PROJECT_ID.svc.id.goog).
gcloud container clusters describe "{cluster}" --location "{location}" \
--format="value(workloadIdentityConfig.workloadPool)"
# Node pool must have workloadMetadataConfig.mode = GKE_METADATA.
gcloud container node-pools describe "{node_pool}" --cluster "{cluster}" \
--location "{location}" \
--format="value(config.workloadMetadataConfig.mode)"
- Empty workload pool → Workload Identity is not enabled on the cluster.
- Node-pool mode is
GCE_METADATA(or empty) → the node pool is not using the GKE metadata server; this is the usual cause of "runs as the node default service account". Remediation: enable--workload-metadata=GKE_METADATAon the node pool (propose to a human; recreates nodes). This is a node-pool configuration problem — not a KSA annotation or IAM binding problem — so do not change KSA annotations or IAM bindings to fix it. When the symptom is "runs as the node default service account", say so explicitly: the root cause is the node pool'sworkloadMetadataConfig.mode, and the KSA annotation and IAM bindings are ruled out as the cause. Propose the exact fix, e.g.:
gcloud container node-pools update "{node_pool}" --cluster "{cluster}" \
--location "{location}" --workload-metadata=GKE_METADATA
Step 3: Verify the KSA → identity binding
There are two supported models. Prefer direct binding (current default); treat GSA impersonation as the legacy path.
How the two models fail differently: with direct binding the KSA principal accesses resources directly, so failures show up as a plain
403 PERMISSION_DENIEDon the target API (fix in Step 4). A403 iam.serviceAccounts.getAccessTokeninstead means an impersonation attempt — intended under the legacy path, or unintended if a leftoveriam.gke.io/gcp-service-accountannotation remains on a KSA that was meant to use direct binding.
(a) Direct KSA binding (no GSA impersonation). The KSA principal is granted roles directly. Construct the principal identifier and search for its bindings:
principal://iam.googleapis.com/projects/{PROJECT_NUMBER}/locations/global/workloadIdentityPools/{PROJECT_ID}.svc.id.goog/subject/ns/{NAMESPACE}/sa/{KSA_NAME}
(b) Legacy: KSA + GSA impersonation. The KSA must be annotated to point at a
GSA, and the KSA must hold roles/iam.workloadIdentityUser on that GSA.
# The KSA annotation must reference the intended GSA.
kubectl get serviceaccount "{ksa_name}" -n "{namespace}" \
-o jsonpath='{.metadata.annotations.iam\.gke\.io/gcp-service-account}'
# The GSA's IAM policy must bind the KSA member to workloadIdentityUser.
gcloud iam service-accounts get-iam-policy \
"{gsa_name}@{project_id}.iam.gserviceaccount.com" \
--format=json
# Expect a binding: role roles/iam.workloadIdentityUser,
# member serviceAccount:{PROJECT_ID}.svc.id.goog[{NAMESPACE}/{KSA_NAME}]
If the annotation is present but the binding is missing, the binding was likely removed — check the
setIamPolicyaudit logs around the failure time to find the responsible principal.
Step 4: Verify IAM permissions on the target resource
Even with a correct binding, the identity (the KSA principal for direct binding,
or the GSA for legacy) must hold the role required by the API call (for example
roles/storage.objectViewer). The standard IAM Policy Troubleshooter has
limited support for Workload Identity principals; use Cloud Asset Inventory to
search all IAM policies for the principal instead.
# Direct binding: search for the KSA principal's bindings across the project.
gcloud asset search-all-iam-policies \
--scope="projects/{PROJECT_ID}" \
--query='policy:"{PROJECT_ID}.svc.id.goog"'
# Legacy: search for the GSA's bindings on the target resource's project.
gcloud asset search-all-iam-policies \
--scope="projects/{TARGET_PROJECT_ID}" \
--query='policy:"{gsa_name}@{project_id}.iam.gserviceaccount.com"'
If no binding grants the required role on the target resource, that missing
role is the root cause (and Workload Identity itself is not
misconfigured). Present the fix as a proposed change for a human to apply —
the exact add-iam-policy-binding with the real principal and role — never
applying it automatically. For example, for direct binding on a project-level
resource:
gcloud projects add-iam-policy-binding "{TARGET_PROJECT_ID}" \
--member="principal://iam.googleapis.com/projects/{PROJECT_NUMBER}/locations/global/workloadIdentityPools/{PROJECT_ID}.svc.id.goog/subject/ns/{NAMESPACE}/sa/{KSA_NAME}" \
--role="{REQUIRED_ROLE}" # e.g. roles/storage.objectViewer
Step 5: GKE metadata server & connectivity
Applies when the signature is could not find the metadata server, cannot find the metadata server, or a connection/timeout error. The gke-metadata-server
DaemonSet (in kube-system) brokers the token exchange on each node; requests
to 169.254.169.254 are redirected to it, so a Pod fails closed if it cannot
reach a healthy metadata-server Pod on its node.
(a) Check gke-metadata-server Pod health on the workload's node.
# The DaemonSet Pods must be healthy on the workload's node.
kubectl get pods -n kube-system -l k8s-app=gke-metadata-server -o wide
# A gke-metadata-server Pod can be OOM-evicted when the cluster has many
# (>3,000) Kubernetes service accounts. Look for CrashLoopBackOff, then confirm
# the eviction was OOMKilled.
kubectl get pods -n kube-system | grep CrashLoopBackOff
kubectl describe pod {gke_metadata_server_pod} --namespace=kube-system | grep OOMKilled
(b) Inspect the gke-metadata-server logs (historical,
Truncated for display — read the full file on GitHub.
Related Skills
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
design
130.2kComprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini, Atlas Cloud, or MuAPI AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVG…
ui-ux-pro-max
130.2kUI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
