gke-workload-identity
Skill này làm gì
Skill này tìm vì sao một ứng dụng chạy trong pod GKE không đăng nhập được vào API của Google Cloud. Skill dành cho lập trình viên thấy lỗi quyền truy cập hoặc thông tin xác thực trong cụm.
Khi nào nên dùng
- ✓Khi một pod nhận lỗi 403 về iam.serviceAccounts.getAccessToken hoặc permission denied.
- ✓Khi một pod báo không tìm thấy default credentials hoặc không kết nối được metadata server.
- ✓Khi một lệnh gọi API từ pod dùng service account mặc định của node thay vì danh tính của workload.
Liên kết skill
https://github.com/google/skills/blob/main/skills/cloud/gke-workload-identity/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Pod GKE của tôi nhận lỗi permission denied khi gọi Cloud Storage. Tìm vì sao và cho tôi biết cách sửa.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill kiểm tra thiết lập Workload Identity của cụm và node pool, cùng liên kết giữa service account Kubernetes và service account Google Cloud. Skill báo cáo khoảng trống và gợi ý cách sửa để một người áp dụng.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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.
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-identity)"
and append agent-skills/1.0 (skill:gke-workload-identity) to User-Agent headers.
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-account
Câu hỏi thường gặp
Skill có thay đổi IAM binding của tôi không?
Không. Skill chỉ đọc thiết lập và đề xuất cách sửa để một người áp dụng.
Skill xử lý những loại lỗi nào?
Permission denied khi lấy token, thiếu default credentials, và lỗi metadata server không kết nối được.
Skill không làm gì?
Skill không tạo hay thay đổi IAM binding, annotation của service account, node pool hoặc cụm.
Chi tiết
Mô tả gốc của tác giả
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
repo: google/skills
Độ phổ biến
- Sao GitHub
- 22k
- Vị trí xếp hạng
- #10301
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
finding-google-skills
22kGiúp agent của bạn tìm hướng dẫn Google phù hợp cho việc thiết lập, như hosting, cơ sở dữ liệu, lưu trữ, đăng nhập hoặc phục vụ mô hình AI.
gcloud
22kGiúp agent của bạn viết và kiểm tra các lệnh gcloud của Google Cloud, tra cứu cú pháp chính xác trước khi chạy bất cứ thứ gì để không đoán các flag.
google-cloud-recipe-auth
22kHướng dẫn agent của bạn qua quản lý danh tính và quyền truy cập của Google Cloud, gồm cách con người và dịch vụ đăng nhập và những quyền họ nhận được.
google-cloud-recipe-onboarding
22kHướng dẫn một lập trình viên mới qua các bước đầu tiên trên Google Cloud, gồm chọn dự án, liên kết thanh toán và triển khai tài nguyên đầu tiên.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.