GKE Basics: Using Agent Skill to Avoid Common Pitfalls in GKE Cluster Creation and Workload Deployment

Introduction

When running Kubernetes on Google Cloud, many teams get stuck on a few things initially: choosing between Autopilot and Standard, which flags to enable for private clusters, how to fetch kubectl credentials, and why CPU requests in Autopilot must be aligned to 250m. While these topics are covered in the documentation, Agents often provide outdated commands or cram Workload Identity, upgrades, and networking into a single response.

Below is an introduction to the gke-basics repository officially maintained by Google (current metadata version 1.1.1, category Containers). It encapsulates the “default practices + must-know pitfalls” for GKE cluster creation, credential acquisition, mode selection, and workload deployment into SKILL.md. It also points to specialized Skills in the same series. This setup is suitable for environments supporting Agent Skills (such as Cursor, Claude Code, Codex), enabling assistants to follow a consistent set of rules.

What is this

gke-basics is an introductory Agent Skill for GKE within google/skills, located at the official path:

https://github.com/google/skills/tree/main/skills/cloud/gke-basics

The official description summarizes it as: Managing GKE cluster provisioning, credentials, Autopilot vs. Standard selection, and workload deployment. Applicable scenarios include creating GKE clusters, obtaining kubectl credentials, and making decisions between Autopilot and Standard.

The Skill also explicitly defines what it should not be used for, directing users to corresponding Skills instead:

Topic Recommended Skill
Workload Identity (KSA/GSA) gke-workload-identity
GKE Networking gke-networking
Platform/Workload Security Hardening gke-platform-security / gke-workload-security
Cluster Upgrades & Maintenance Windows gke-upgrades
Generating Deployment, Service, etc. YAML gke-manifest-generation

GKE is positioned as managed Kubernetes on Google Cloud; the Skill defaults to Autopilot unless the business explicitly requires Standard.

Core Functions

Autopilot vs. Standard Selection Rules

The Skill defines the selection process as an executable default policy:

  1. Default to Autopilot for the vast majority of workloads.
  2. Choose Standard only in the following cases:
    • Custom node OS kernel parameters (sysctl) are required.
    • Custom node taints or specific hardware node pools are required.
    • DaemonSets must mount hostPath to the host filesystem.
  3. If explaining to a user why Standard is necessary, cite the specific limitations met (e.g., meeting both custom sysctls and custom node taints).
  4. For complex node pool planning or advanced cluster architectures, refer to gke-cluster-creation.

Critical Gotchas & Best Practices

Private Autopilot Clusters

For private node and control plane access, the following parameters can be combined (example for creating a regional Autopilot cluster):

gcloud container clusters create-auto CLUSTER_NAME --region=REGION \
  --enable-private-nodes \
  --enable-private-endpoint \
  --enable-master-authorized-networks \
  --master-authorized-networks=CIDR_BLOCK

Brief correspondence of meanings: --enable-private-nodes uses private node IPs; --enable-private-endpoint disables the public IP for the control plane; --enable-master-authorized-networks and CIDR restrict who can access the control plane.

Workload Identity

The Skill emphasizes: Do not mount GCP service account JSON keys into Pods. For KSA/GSA binding and configuration, open gke-workload-identity/SKILL.md rather than expanding the full workflow within this Skill.

Autopilot Resource Requests

  • CPU requests must be in increments of 250m (0.25 vCPU); if not aligned, they are rounded up (e.g., 300m is treated as 500m).
  • Requests and limits are treated equally in Autopilot; limits can be omitted, and Autopilot will set defaults based on requests.

Cluster Credentials

When fetching credentials, always explicitly include --region (for regional clusters) or --zone (for zonal clusters):

gcloud container clusters get-credentials CLUSTER_NAME --region=REGION --quiet

Reference Directory (Embedded Documentation)

Once installed, the Agent can read the reference materials in the same directory as needed, rather than filling the context all at once:

  • references/core-concepts.md: Architecture, Autopilot/Standard, networking, scaling, and security models.
  • references/cli-reference.md: Tool priority (MCP vs. gcloud vs. kubectl), gcloud container commands, and user preference overrides.
  • references/client-library-usage.md: Official Kubernetes and Container clients for Python, Go, Node.js, and Java.
  • references/mcp-usage.md: 23 structured GKE MCP tools (cluster management, K8s resources, diagnostics).
  • references/iac-usage.md: Terraform (google_container_cluster Autopilot), Kubernetes provider, and YAML samples.

The same repository also offers adjacent Skills under the Infrastructure category, such as GKE AI/ML Inference, GKE Manifest Generation, and Migrate AI Workloads to GKE Inference. These are suitable for continuing with inference deployment or manifest generation after getting started; this Skill is responsible for clarifying the “basic path” and routing boundaries.

Installation & Enablement

The official Google repository distributes via skills.sh. In an environment with Node.js (including npm / npx), you can install the full package first and then select a single Skill:

npx skills add google/skills

Follow the prompts to select the Skill to install (you can choose only GKE Basics & Critical Gotchas), the target Agent, and the installation scope (project or global).

To update installed Skills:

npx skills update

Mount paths and interaction methods for Skills vary across Cursor, Claude Code, Codex, etc. The commands above are from the google/skills README and are consistent with this Skill’s source installation method. If the environment lacks npx, Node.js must be installed first.

Typical Usage

Assuming the Agent has loaded gke-basics, you can describe tasks in natural language and let the assistant execute according to Skill rules. Examples:

  1. Create a new regional Autopilot cluster and restrict control plane access — The assistant should default to create-auto and include the private cluster parameter combination mentioned earlier when private deployment is needed, rather than mixing in Standard node pool commands.
  2. “I need kubectl” — The assistant should execute get-credentials with --region or --zone to avoid connecting to the wrong cluster due to a missing region.
  3. “This DaemonSet needs hostPath” — The assistant should cite the Standard limitation items and suggest consulting gke-cluster-creation for node pool planning.
  4. “The Pod needs to use GCP APIs” — The assistant should reject the JSON key mounting solution and route to gke-workload-identity.
  5. “Help me write a Deployment YAML” — The assistant should open gke-manifest-generation instead of fabricating manifest fields within this Skill.

When involving Infrastructure as Code (IaC), you can ask the assistant to read the Terraform and YAML examples in references/iac-usage.md to ensure consistency with gcloud commands.

Use Cases & Notes

Who it is for

  • Teams that have just migrated workloads to GKE and need the Agent to answer under “default Autopilot + official CLI habits.”
  • SREs or platform engineers using AI to assist with writing gcloud container commands, fetching credentials, and explaining Autopilot resource constraints.
  • Scenarios where you want the Agent to automatically split networking, security, upgrades, and WI to corresponding Google official Skills, reducing irrelevant responses.

Limitations & Notes

  • This Skill does not cover full Workload Identity configuration, network topologies, security hardening flags, or cluster upgrades; switch to other Skills when encountering these topics to avoid cluttering a single conversation with unrelated flags.
  • If the introduction lists “Workload Identity” as a primary capability of this Skill, it contradicts the official description; the correct approach is: in this Skill, only remember “no JSON keys” and jump to gke-workload-identity.
  • Autopilot CPU steps, private cluster parameters, etc., belong to the “fail-on-misstep” class of rules. Manual review of Agent-generated manifests and gcloud commands remains necessary.

Conclusion

gke-basics solidifies the selection defaults, CLI habits, and several high-frequency gotchas for the first step of moving to GKE Cloud into procedures readable by Agents. Through the routing table and division of labor with specialized Skills in the same repository, it prevents onboarding conversations from being dragged away by networking, security, or WI. To install or view the source code, simply open the official directory:

https://github.com/google/skills/tree/main/skills/cloud/gke-basics

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye