1
---
2
name: gke-basics
3
metadata:
4
version: "1.1.3"
5
category: Containers
6
description: >-
7
Manages core GKE cluster provisioning, credentials, Autopilot vs Standard selection,
8
and workload deployment. Use when creating GKE clusters, fetching kubectl credentials,
9
or deciding between Autopilot and Standard modes. Don't use for Workload Identity
10
(use gke-workload-identity), GKE networking (use gke-networking), security hardening
11
(use gke-platform-security or gke-workload-security), or cluster upgrades (use gke-upgrades).
12
---
13
14
# GKE Basics & Critical Gotchas
15
16
> **Routing Note:** For Workload Identity KSA/GSA setup, use the
17
> `gke-workload-identity` skill. For cluster security flags
18
> (`--database-encryption-key`, `--security-posture`, RBAC, Shielded Nodes,
19
> Binary Authorization), use the `gke-platform-security` skill. For cluster
20
> upgrades or maintenance windows, use the `gke-upgrades` skill. For generating
21
> Kubernetes YAML manifests (`Deployment`, `StatefulSet`, `Service`,
22
> `HTTPRoute`, `PodDisruptionBudget`), use the `gke-manifest-generation` skill.
23
24
Managed Kubernetes platform on Google Cloud. Defaults to Autopilot mode unless Standard is explicitly required.
25
26
## Attribution
27
28
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
29
MUST read [Usage Attribution](references/attribution.md). For commands executed
30
directly in the terminal (never in generated scripts, Terraform, or user code),
31
prefix `gcloud` with
32
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-basics)"`
33
and append `agent-skills/1.0 (skill:gke-basics)` to `User-Agent` headers.
34
35
## Key Selection Rules: Autopilot vs. Standard
36
37
* **Default to Autopilot** for almost all workloads.
38
* **Use Standard ONLY if:**
39
* Custom node OS kernel parameters (`sysctl`) are required.
40
* Custom node taints or specific hardware node pools are required.
41
* DaemonSets require raw `hostPath` mounts to the host OS filesystem.
42
* When explaining why Standard is required over Autopilot, explicitly cite all matching restrictions (e.g., custom sysctls and custom node taints).
43
* *For advanced cluster architecture or complex node pool creation planning, refer to `gke-cluster-creation`.*
44
45
## Critical Gotchas & Best Practices
46
47
1. **Private Autopilot Clusters:**
48
* Use `--enable-private-nodes` for private node IP addresses.
49
* Use `--enable-private-endpoint` to disable public IP access to the control plane.
50
* Restrict control plane access with `--enable-master-authorized-networks` and `--master-authorized-networks=CIDR_BLOCK`:
51
```bash
52
gcloud container clusters create-auto CLUSTER_NAME --region=REGION \
53
--enable-private-nodes \
54
--enable-private-endpoint \
55
--enable-master-authorized-networks \
56
--master-authorized-networks=CIDR_BLOCK
57
```
58
59
2. **Workload Identity (IAM Binding):**
60
* Never mount raw GCP Service Account JSON keys in Pods; use the
61
`gke-workload-identity` skill for KSA/GSA setup.
62
63
3. **Autopilot Resource Requests:**
64
* In Autopilot, CPU requests must be specified in increments of 250m (0.25 vCPU). If an unaligned CPU request (e.g., 300m) is requested, round up to the nearest 250m increment (500m / 0.5 vCPU).
65
* Resource requests equal limits automatically. Omit `limits` to allow Autopilot to set defaults matching `requests`.
66
67
4. **Cluster Credentials:**
68
* Always explicitly specify `--region` (for regional clusters) or `--zone` (for zonal clusters) when fetching credentials:
69
```bash
70
gcloud container clusters get-credentials CLUSTER_NAME --region=REGION --quiet
71
```
72
73
## Reference Directory
74
75
- [Core Concepts](references/core-concepts.md): Architecture, cluster modes (Autopilot vs Standard), networking, scaling, and security model.
76
77
- [CLI Usage & Tool Reference](references/cli-reference.md): Tool preference hierarchy (MCP vs gcloud vs kubectl), `gcloud container` commands, and user preference overrides.
78
79
- [Client Libraries](references/client-library-usage.md): Official Kubernetes and Google Cloud Container client libraries in Python, Go, Node.js, and Java.
80
81
- [MCP Usage](references/mcp-usage.md): Connecting to and using the 23 structured GKE MCP tools for cluster management, K8s resources, and diagnostics.
82
83
- [Infrastructure as Code](references/iac-usage.md): Terraform examples for `google_container_cluster` (Autopilot), Kubernetes provider resources, and YAML samples.
84