gke-manifest-generation
它能做什么
这项技能帮助 AI 智能体把普通描述或代码更改转换为 GKE 的 Kubernetes YAML 文件。适合需要既安全又注重成本的部署文件的人。
适用场景
- ✓当你需要编写或修改 GKE 部署文件时。
- ✓当你想在 YAML 中设置容器安全选项、CPU 和内存限制或健康探针时。
- ✓当你想在清单中设置 Gateway API 路由或指定 Spot VM 时。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/gke-manifest-generation/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我在 GKE 上的网页应用编写一个 Kubernetes 部署文件,包含健康检查和内存限制。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会遵循固定的规则设置命名空间、服务账户、资源限制和探针,然后根据经过测试的模板编写 YAML。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
GKE Manifest Generation Skill
This skill provides guidelines, tooling integration, and templates to translate natural language descriptions or application code changes into secure, compliant, and cost-effective Kubernetes YAML manifests optimized for both GKE Autopilot and GKE Standard clusters.
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-manifest-generation)"
and append agent-skills/1.0 (skill:gke-manifest-generation) to User-Agent headers.
Core Rules & Verification
When generating or updating YAML manifests, you must strictly adhere to the following rules:
1. Namespace & Resource Isolation
- Explicit Namespace: Always declare
namespace: {namespace}explicitly in the metadata of every resource (Deployments, Services, ConfigMaps, Secrets, PVCs, Roles, bindings). Map it to the namespace configured in your activeSETTINGS.md. Never omit the namespace. - Dedicated ServiceAccount: Avoid using the namespace's
defaultServiceAccount. Always create and reference a dedicatedServiceAccount(e.g.,devteam-agent-sa) for each microservice.
2. GKE Resource Tuning (Autopilot & Standard)
Resources Requests & Limits: Always specify CPU and Memory requests and limits for all containers.
- GKE Autopilot: Requests determine pod billing directly; requests and limits must be equal. If they differ, Autopilot will automatically scale requests up to match limits, which can significantly increase costs.
- GKE Standard: Requests ensure stable scheduling and bin-packing; limits prevent resource starvation/noisy-neighbor issues.
Density Defaults: For stateless apps or sidecars on GKE Standard, default to conservative requests (e.g.,
requests.cpu: "100m"or"200m",requests.memory: "256Mi"or"512Mi") with burstable limits. Use a reasonable overcommit ratio for limits (e.g., 2x to 4x requests, likelimits.cpu: "400m"to"800m", andlimits.memory: "512Mi"to"1Gi"). Avoid excessive overcommit limits (likelimits.cpu: "4"for a100mrequest) to prevent severe CPU throttling and latency degradation under heavy scheduling load, particularly in environments without guaranteed node shares.Spot VMs for Staging/Dev: For non-production workloads (e.g., namespaces containing
-test,-dev, or-staging), or if the user requests cost optimization, automatically target GKE Spot VMs. This requires injecting both thenodeSelectortargeting Spot VMs AND the corresponding toleration to tolerate the Spot VM taint:nodeSelector: cloud.google.com/gke-spot: "true" tolerations: - key: "cloud.google.com/gke-spot" operator: "Equal" value: "true" effect: "NoSchedule"(On GKE Standard, this assumes a Spot node pool is configured).
3. Container Security Hardening (Pod Security Standards)
- Non-Root Execution: Always configure
securityContextat the Pod level (and container level if overriding) to run as a non-root user (e.g.,runAsNonRoot: true,runAsUser: 10000,runAsGroup: 10000,fsGroup: 10000). This is strictly enforced on GKE Autopilot and is a critical security baseline for GKE Standard. - Minimal Privileges: Always set
allowPrivilegeEscalation: falseandseccompProfile: {type: RuntimeDefault}. - Read-Only Root Filesystem: Set
readOnlyRootFilesystem: trueto prevent modifications to the container image filesystem.- Writable Directory Fallback: If
readOnlyRootFilesystemis enabled, mount a localemptyDirvolume to/tmpor/var/run/to allow applications (like Java/Nginx) to write temp files without crashing.
- Writable Directory Fallback: If
- Secret Volume Mounting: Prefer mounting Secrets as read-only files
(configured in the
volumesspec withdefaultMode: 0400) instead of mapping them as environment variables, unless the application framework exclusively supports env-var based configuration. This prevents secrets leaking into application logs.
4. Health Checking (Mandatory Probes)
- **Liveness & Re
常见问题
它会使用默认服务账户吗?
不会。技能说明,应为每个工作负载创建并使用专用的服务账户。
它总会设置命名空间吗?
会。每个资源的元数据中都应明确指定命名空间。
它会处理密钥和卷吗?
会。它涵盖在部署文件中挂载密钥和卷。
详情
作者的原始描述
Generates and updates secure, production-ready Kubernetes YAML manifests optimized for GKE Autopilot and GKE Standard clusters. Use when creating or modifying GKE deployment manifests, configuring container security contexts, setting CPU/memory resource limits, defining readiness/liveness/startup probes, mounting secrets and volumes, configuring GKE Gateway API routes, targeting Spot VMs, or deploying AI model inference workloads (vLLM, TGI, Gemma). Don't use for live cluster operations, pod troubleshooting (use gke-workload-troubleshooting), or cluster infrastructure provisioning (use gke-clu
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10289
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
finding-google-skills
22k帮你的智能体为某项设置任务找到合适的 Google 指南,例如托管、数据库、存储、登录或 AI 模型服务。
gcloud
22k帮你的智能体编写并检查 Google Cloud gcloud 命令,在运行任何内容之前查阅准确的语法,避免猜测参数。
google-cloud-recipe-auth
22k引导你的智能体了解 Google Cloud 的身份与访问管理,包括人员和服务如何登录,以及它们各自获得哪些权限。
google-cloud-recipe-onboarding
22k带领新开发者完成在 Google Cloud 上的第一步,包括选择项目、关联计费,以及部署第一个资源。