1
---
2
name: gke-storage
3
description: >-
4
Manages GKE storage, including PVCs, PersistentVolumes, and Filestore. Use
5
when configuring GKE storage or creating PVCs. For GCS FUSE mounts, use
6
google-cloud-storage-fuse. For diagnosing storage failures (volume attach/mount
7
errors, disk performance/node storage pressure, or Cloud Storage FUSE OOM), use
8
gke-storage-troubleshooting. Don't use for database
9
administration or replication strategies outside volume provisioning context.
10
metadata:
11
version: "1.0.4"
12
category: Storage
13
---
14
15
# GKE Storage
16
17
> **Routing Note:** For Cloud Storage FUSE (`gcsfuse`) mounts or the GKE
18
> `gcsfuse.csi.storage.gke.io` CSI driver, use the `google-cloud-storage-fuse`
19
> skill.
20
21
This reference covers storage configuration for GKE clusters including
22
persistent disks, file storage, and cloud storage integration.
23
24
> **MCP Tools:** `apply_k8s_manifest`, `get_k8s_resource`,
25
> `describe_k8s_resource`, `get_cluster`
26
27
## Attribution
28
29
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
30
MUST read [Usage Attribution](references/attribution.md). For commands executed
31
directly in the terminal (never in generated scripts, Terraform, or user code),
32
prefix `gcloud` with
33
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-storage)"`
34
and append `agent-skills/1.0 (skill:gke-storage)` to `User-Agent` headers.
35
36
## Golden Path Storage Defaults
37
38
The golden path Autopilot config enables these CSI drivers:
39
40
| Driver | Golden Path | Access Mode | Use Case |
41
| --------------- | ----------------- | --------------- | -------------------- |
42
| Compute Engine | Enabled (default) | ReadWriteOnce | Block storage for |
43
: Persistent Disk : : : databases, :
44
: CSI : : : single-pod workloads :
45
| Google Cloud | Enabled | ReadWriteMany | Shared NFS for |
46
: Filestore CSI : : : multi-pod access :
47
| Cloud Storage | Enabled | ReadWriteMany / | Mount GCS buckets as |
48
: FUSE CSI : : ReadOnlyMany : volumes :
49
| Managed Lustre | Disabled (opt-in) | ReadWriteMany | High-performance |
50
: CSI : : : parallel file system :
51
| Boot disk type | `pd-balanced` | N/A | Node boot disks |
52
53
## StorageClasses
54
55
### Default StorageClasses
56
57
GKE provides built-in StorageClasses:
58
59
StorageClass | Disk Type | Use Case
60
-------------- | --------------------- | ------------------------------
61
`standard-rwo` | `pd-balanced` | Balanced persistent disk (default)
62
`premium-rwo` | `pd-ssd` | High IOPS, databases
63
`standard-rwx` | Filestore (Basic HDD) | Shared NFS
64
`premium-rwx` | Filestore (Basic SSD) | Shared NFS, higher performance
65
66
### Custom StorageClass
67
68
```yaml
69
apiVersion: storage.k8s.io/v1
70
kind: StorageClass
71
metadata:
72
name: fast-regional
73
provisioner: pd.csi.storage.gke.io
74
parameters:
75
type: pd-ssd
76
replication-type: regional-pd # Replicate across 2 zones
77
volumeBindingMode: WaitForFirstConsumer
78
allowVolumeExpansion: true # Always enable for production
79
```
80
81
## PersistentVolumeClaims
82
83
### Block Storage (ReadWriteOnce)
84
85
```yaml
86
apiVersion: v1
87
kind: PersistentVolumeClaim
88
metadata:
89
name: database-pvc
90
spec:
91
accessModes:
92
- ReadWriteOnce
93
storageClassName: premium-rwo
94
resources:
95
requests:
96
storage: 100Gi
97
```
98
99
### Shared File Storage (ReadWriteMany via Filestore)
100
101
```yaml
102
apiVersion: v1
103
kind: PersistentVolumeClaim
104
metadata:
105
name: shared-data
106
spec:
107
accessModes:
108
- ReadWriteMany
109
storageClassName: standard-rwx
110
resources:
111
requests:
112
storage: 1Ti # Filestore minimum is 1 TiB for Basic tier
113
```
114
115
### GCS Bucket Mount (Cloud Storage FUSE)
116
117
Mount a GCS bucket as a volume without a PVC:
118
119
```yaml
120
apiVersion: v1
121
kind: Pod
122
metadata:
123
name: gcs-reader
124
annotations:
125
gke-gcsfuse/volumes: "true"
126
spec:
127
containers:
128
- name: reader
129
image: busybox
130
command: ["ls", "/data"]
131
volumeMounts:
132
- name: gcs-bucket
133
mountPath: /data
134
volumes:
135
- name: gcs-bucket
136
csi:
137
driver: gcsfuse.csi.storage.gke.io
138
readOnly: true
139
volumeAttributes:
140
bucketName: <BUCKET_NAME>
141
```
142
143
> Requires Workload Identity for the pod's service account to have
144
> `roles/storage.objectViewer` on the bucket.
145
146
## Volume Expansion
147
148
If `allowVolumeExpansion: true` is set on the StorageClass, resize by updating
149
the PVC:
150
151
```bash
152
# kubectl
153
kubectl patch pvc <PVC_NAME> -p '{"spec":{"resources":{"requests":{"storage":"200Gi"}}}}'
154
```
155
156
```
157
# MCP (preferred)
158
patch_k8s_resource(parent="...", resourceType="persistentvolumeclaim", name="<PVC_NAME>",
159
patch='{"spec":{"resources":{"requests":{"storage":"200Gi"}}}}')
160
```
161
162
Kubernetes automatically resizes the filesystem.
163
164
## Stateful Storage & Capacity Constraints
165
166
When configuring storage for stateful workloads, keep the following capacity and scheduling constraints in mind:
167
168
* **Existing zonal PVs pin the workload to a zone:** A Pod that uses an existing zonal PersistentVolume (for example, in `europe-north1-b`) can only run in that zone. The cluster autoscaler can't work around a capacity shortage by adding nodes in another zone; any fallback must be in the same zone.
169
* **Use automated disk type selection and topology-aware scheduling for new workloads:** Use `volumeBindingMode: WaitForFirstConsumer` so the volume is created in the zone where the Pod lands. When a ComputeClass mixes machine generations (for example, C4/N4 priority with N2 fallback), configure the StorageClass for **automated disk type selection** (`parameters.type: dynamic` with `pd-type: pd-balanced`, `hyperdisk-type: hyperdisk-balanced`, `disk-type-preference: hyperdisk-type`, and `use-allowed-disk-topology: "true"`, GKE 1.35.3-gke.1290000+; or `use-allowed-disk-topology: "true"` on GKE 1.34.1-gke.2541000+) so the autoscaler only picks nodes that support the disk type and new volumes get a compatible disk type per node.
170
* **Same-zone PD-type swaps rarely help:** Switching a same-zone fallback from `pd-ssd` to `pd-balanced` is unlikely to resolve a zonal capacity shortage, because both can be affected by the same zonal constraints. Prefer a fallback to a Hyperdisk-capable machine series (for example, C3 or N4) with `hyperdisk-balanced`.
171
* **Check Hyperdisk quotas first:** Hyperdisk quotas (for example, `HDB-TOTAL-GB`, throughput, and IOPS) are separate from Persistent Disk quotas. Verify the regional limits before recommending a Hyperdisk Balanced fallback.
172
173
## Best Practices
174
175
1. **Always enable volume expansion**: Set `allowVolumeExpansion: true` on all
176
StorageClasses
177
2. **Use regional PDs for production**: `replication-type: regional-pd`
178
replicates across 2 zones for HA
179
3. **Use `WaitForFirstConsumer`**: Ensures the PV is provisioned in the same
180
zone as the pod
181
4. **Choose the right disk type**: `pd-ssd` for databases, `pd-balanced`
182
(golden path default) for general use, `pd-standard` for cold storage
183
5. **Use Filestore for shared access**: When multiple pods need to read/write
184
the same files
185
6. **Use GCS FUSE for data pipelines**: Mount buckets directly for ML training
186
data, logs, etc.
187
7. **Back up PVCs**: Use Backup for GKE (see the `gke-backup-dr` skill) to
188
protect persistent data
189