1
---
2
name: gke-storage-troubleshooting
3
metadata:
4
category: Storage
5
version: "1.1.1"
6
description: >-
7
Diagnoses GKE persistent-storage failures — volume attach/mount errors (Regional PD on optimized VMs, fsGroup mount timeouts), disk-performance and node storage-pressure issues, slow-disk Pod-creation failures, volume-expansion problems, Local SSD / Hyperdisk Storage Pool creation errors, and Cloud Storage FUSE OOM. Use when Pods are stuck in ContainerCreating, volumes fail to attach or mount, or nodes report storage pressure. Don't use for routine storage provisioning or StorageClass/PVC authoring (see the gke-storage skill).
8
---
9
10
# GKE Storage Troubleshooting Skill
11
12
Use this skill to systematically diagnose and resolve **persistent-storage
13
failures** for workloads running on GKE — volume attach/mount errors, disk
14
performance and node storage pressure, volume expansion, storage-related
15
cluster/node-pool creation errors, and Cloud Storage FUSE memory issues. This
16
skill operates non-interactively and enforces a read-only diagnostics boundary
17
before proposing manifest or configuration corrections.
18
19
> For routine storage **provisioning** and StorageClass/PVC authoring, use the
20
> `gke-storage` skill instead. This skill focuses on **failure diagnosis**.
21
22
## Attribution
23
24
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
25
MUST read [Usage Attribution](references/attribution.md). For commands executed
26
directly in the terminal (never in generated scripts, Terraform, or user code),
27
prefix `gcloud` with
28
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-storage-troubleshooting)"`
29
and append `agent-skills/1.0 (skill:gke-storage-troubleshooting)` to `User-Agent` headers.
30
31
## 🔍 Diagnosis & Resolution Workflow
32
33
### Step 0: Non-Interactive Context Discovery & Dry-Run Fallback
34
35
1. **Parameter Extraction**: Extract required context (`project_id`,
36
`cluster_name`, `cluster_location`, `workload_name`, `workload_namespace`,
37
`pod_name`, and the relevant `pvc_name` / `pv_name` / `node_name`)
38
non-interactively from the user prompt, active `SETTINGS.md`, or environment
39
defaults:
40
41
- Default `workload_namespace` to `default` if omitted.
42
- Infer missing cluster parameters from the active environment (`kubectl
43
config current-context` or `gcloud config get-value project`).
44
45
2. **Cluster Credentials & Fallback Mode**:
46
47
- Attempt credential fetch: `gcloud container clusters get-credentials
48
{cluster_name} --location {cluster_location} --project {project_id}`.
49
- **Fallback / Dry-Run Mode**: If the cluster is unreachable,
50
non-existent, or live command execution fails (such as in sandboxed
51
evaluations, dry-run mode, or offline analysis):
52
- Limit retry attempts to avoid resource exhaustion and context
53
overflow.
54
- Immediately present the exact `kubectl` / `gcloud` diagnostic
55
commands for the human operator to run.
56
- Synthesize the root-cause analysis and output the proposed GitOps
57
correction based on the reported symptoms.
58
59
--------------------------------------------------------------------------------
60
61
### Step 1: Classify the Storage Symptom
62
63
Gather the primary signals, then jump to the **matching branch under Step 2
64
(Resolution)** — you normally perform **only the one branch** that matches your
65
diagnosis, not all of them.
66
67
**Diagnostic Commands:**
68
69
```bash
70
kubectl describe pod {pod_name} -n {workload_namespace}
71
kubectl get pvc,pv -n {workload_namespace}
72
kubectl get events -n {workload_namespace} --sort-by='.metadata.creationTimestamp'
73
kubectl describe node {node_name}
74
```
75
76
- **Pod stuck in `ContainerCreating` with an attach/mount event** → **Volume
77
Attach & Mount Failures**.
78
- **Node-level slowness, `PLEG is not healthy`, or `StoragePressureDetected`
79
events** → **Disk Performance & Node Storage Pressure**.
80
- **Cluster / node-pool creation or provisioning error** → **Storage
81
Provisioning & Creation Failures**.
82
- **A resized volume is not reflected inside the container** → **Volume
83
Expansion Not Reflecting in the Container**.
84
- **Cloud Storage FUSE Pod / sidecar OOM** → **Cloud Storage FUSE
85
Out-Of-Memory (OOM) Events**.
86
87
--------------------------------------------------------------------------------
88
89
### Step 2: Resolution
90
91
Perform **only the branch that matches your Step 1 diagnosis**. These branches
92
are mutually exclusive alternatives, not sequential steps.
93
94
#### Volume Attach & Mount Failures
95
96
- **`Error 400: Cannot attach RePD to an optimized VM`**: Regional persistent
97
disks are restricted from being used with **memory-optimized** or
98
**compute-optimized** machine types.
99
100
- If a regional PD is not a hard requirement, switch the workload to a
101
**non-regional persistent disk** StorageClass.
102
- If a regional PD **is** required, use **taints and tolerations** so that
103
Pods needing regional PDs are scheduled onto a node pool that does
104
**not** use optimized machine types.
105
106
- **Pods stay `Pending` / `FailedScheduling` after a node pool is moved to a
107
4th-generation (N4, N4A, N4D) machine series while the workload uses a
108
Persistent Disk StorageClass**: N4/N4A/N4D machines **do not support
109
Persistent Disk** (they support Hyperdisk only), so a PVC bound to a `pd-*`
110
StorageClass cannot bind or schedule on those nodes. Events typically show
111
`FailedScheduling` with a volume node-affinity / topology conflict.
112
113
- Switch the workload to a **Hyperdisk** StorageClass (for example `type:
114
hyperdisk-balanced`) for the Gen4 node pool.
115
- For existing Persistent Disk volumes, migrate the data to a Hyperdisk
116
volume; the original PD cannot be attached to a Gen4 node.
117
- If the workload must keep Persistent Disk, keep it on a PD-capable
118
machine series (for example N2) via node selection. This is a
119
machine-type/disk-type incompatibility, **not** a capacity problem, so
120
increasing disk size or quota does not help.
121
122
- **Hyperdisk Pods become unschedulable when a compute class falls back across
123
VM generations (for example N4 priority, N2 fallback), or one StorageClass
124
must serve mixed generations**: a single static disk type in the
125
StorageClass is not compatible with every machine series in the fallback
126
list, so Pods cannot bind their volume on the fallback nodes.
127
128
- Use **automated disk type selection**: set the StorageClass
129
`parameters.type` to `dynamic` with `hyperdisk-type`, `pd-type`, and
130
`disk-type-preference`, plus `use-allowed-disk-topology: "true"`, so GKE
131
selects a compatible disk type per node and schedules Pods only onto
132
nodes that support it. One dynamic StorageClass can then span multiple
133
VM generations (requires the GKE versions noted in the docs).
134
135
Example dynamic StorageClass (GKE 1.35.3-gke.1290000+):
136
137
```yaml
138
apiVersion: storage.k8s.io/v1
139
kind: StorageClass
140
metadata:
141
name: dynamic-volume
142
provisioner: pd.csi.storage.gke.io
143
volumeBindingMode: WaitForFirstConsumer
144
allowVolumeExpansion: true
145
parameters:
146
type: dynamic
147
pd-type: pd-balanced
148
hyperdisk-type: hyperdisk-balanced
149
# Preferred storage on nodes that support both PD and Hyperdisk;
150
# defaults to hyperdisk-type when omitted.
151
disk-type-preference: hyperdisk-type
152
# Best practice: schedule Pods only onto nodes that support the disk type.
153
use-allowed-disk-topology: "true"
154
```
155
156
- **Mount stops responding due to the `fsGroup` setting**: A Pod configured
157
with a `securityContext.fsGroup` on a volume that contains a **large number
158
of files** makes the kubelet recursively change ownership on every file,
159
which can time out the mount. The symptom is:
160
161
```
162
Unable to attach or mount volumes for pod; skipping pod ... timed out waiting for the condition
163
```
164
165
Confirm by checking the Pod logs for a `Setting volume ownership for ... and
166
fsGroup set` entry, then apply one of:
167
168
- Reduce the number of files in the volume.
169
- Set `securityContext.fsGroupChangePolicy: OnRootMismatch` so ownership
170
is only changed when the top-level permissions do not match.
171
- Stop using the `fsGroup` setting if it is not required.
172
173
#### Disk Performance & Node Storage Pressure
174
175
- **Poor disk performance** (symptoms such as `task dockerd:... blocked for
176
more than 300 seconds`, `PLEG is not healthy`, or slow `fs: disk usage`
177
scans): the node boot disk is shared across the OS, container images, the
178
overlay filesystem, and disk-backed `emptyDir` volumes, and performance is
179
shared across all disks of the same type on the node.
180
181
- This commonly affects nodes using **standard persistent disks smaller
182
than 200 GB**. Increase the disk size or switch to SSD, especially for
183
production.
184
- Enable **Local SSD for ephemeral storage** on node pools whose workloads
185
frequently use `emptyDir`.
186
187
- **Slow disk operations cause Pod creation failures**: on affected node
188
versions (GKE 1.18–1.23 before the fixed patch releases), the `k8s_node
189
container-runtime` logs show `failed to reserve container name ... is
190
reserved for ...` (containerd issue #4604).
191
192
- Mitigate with `restartPolicy: Always` or `OnFailure` in the PodSpec, and
193
increase boot-disk IOPS (larger disk or a faster disk type).
194
- The permanent fix is containerd 1.6.0+; upgrade to a GKE version that
195
includes it.
196
197
- **`StoragePressureDetected` (high node storage pressure)**: node condition
198
`StoragePressureRootFileSystem` becomes `True` (for example, `Disk
199
/dev/nvme0n1 usage 89% exceeds threshold 85%`), caused by excessive
200
`emptyDir` writes, large image pulls, or accumulating logs.
201
202
- Identify usage with `df -h` on the affected node (focus on
203
`/mnt/stateful_partition` and ephemeral mounts).
204
- Remediate by using larger boot disks, adding Local SSDs for ephemeral
205
storage, setting appropriate `ephemeral-storage` requests/limits, and
206
cleaning up unused files/images/logs.
207
208
#### Storage Provisioning & Creation Failures
209
210
- **`The selected machine type ... has a fixed number of local SSD(s)`**: the
211
Local SSD count specified in `EphemeralStorageLocalSsdConfig` /
212
`LocalNvmeSsdBlockConfig` does not match the fixed count included with the
213
machine type.
214
215
- Specify a Local SSD count that matches the machine type. For
216
**third-generation** machine series, omit the Local SSD `count` flag and
217
the correct value is configured automatically.
218
219
- **Hyperdisk Storage Pools: cluster or node-pool creation fails** with
220
`ZONE_RESOURCE_POOL_EXHAUSTED` (or similar Compute Engine resource errors):
221
the target zone lacks capacity for the requested Hyperdisk Balanced disks or
222
machine type.
223
224
- Select a new zone in the same region that has capacity and where
225
Hyperdisk Balanced Storage Pools are available. Because storage pools
226
are **zonal**, delete and recreate the pool in the new zone, then create
227
the cluster/node pool there.
228
229
#### Volume Expansion Not Reflecting in the Container
230
231
Volume expansion must always be driven through the **PersistentVolumeClaim**.
232
Editing the PersistentVolume directly can leave the container filesystem on the
233
old size.
234
235
1. Keep the modified PersistentVolume object as it is.
236
2. Edit the **PersistentVolumeClaim** and set `spec.resources.requests.storage`
237
to a value **higher** than the current PersistentVolume size.
238
3. The kubelet then resizes the PV, PVC, and container filesystem
239
automatically. Verify inside the Pod:
240
241
```bash
242
kubectl exec {pod_name} -n {workload_namespace} -- df -h
243
```
244
245
#### Cloud Storage FUSE Out-Of-Memory (OOM) Events
246
247
If Pods experience high memory use or OOM kills related to the Cloud Storage
248
FUSE CSI driver:
249
250
1. Enable CPU/memory snapshots by configuring **Cloud Profiler** on the Cloud
251
Storage FUSE CSI driver sidecar container.
252
2. Locate the OOM event in **Cloud Logging**, filtering by Pod:
253
254
```
255
jsonPayload.involvedObject.name="{pod_name}"
256
jsonPayload.involvedObject.kind="Pod"
257
OOMKilled
258
```
259
260
If the sidecar mounter or GCSFuse process OOMs, the Pod name is the workload
261
Pod's name; if the node driver OOMs, it is `gcsfusecsi-node-*`.
262
3. Extract the Pod UID (`jsonPayload.involvedObject.uid`) and timestamp, then
263
analyze the matching snapshot in **Cloud Profiler** using the
264
`{pod_name}_{pod_uid}` Service Version at the OOM timestamp.
265
266
--------------------------------------------------------------------------------
267
268
### Step 3: Propose the GitOps Correction
269
270
Enforce the read-only diagnostics boundary: **do not** apply live mutations with
271
`kubectl edit`, `kubectl patch`, or `kubectl apply`. Instead, present the
272
corrected StorageClass, PersistentVolumeClaim, PodSpec (`securityContext`,
273
`restartPolicy`), or node-pool configuration as a reviewable patch to be applied
274
through the user's GitOps pipeline (for example, Config Sync, Argo CD, or Flux).
275
276
## References
277
278
- [Troubleshoot storage in GKE](https://docs.cloud.google.com/kubernetes-engine/docs/troubleshooting/storage.md.txt)
279
- [Regional persistent disk restrictions](https://docs.cloud.google.com/compute/docs/disks.md.txt#restrictions_2)
280
- [Configure ephemeral storage with local SSDs](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/local-ssd.md.txt)
281
- [Cloud Storage FUSE CSI driver sidecar (enable Profiler)](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/cloud-storage-fuse-csi-driver-sidecar.md.txt#enable-profiler)
282
- [Hyperdisk Storage Pools](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/hyperdisk-storage-pools.md.txt)
283
- [N4 machine series storage support (Persistent Disk not supported)](https://docs.cloud.google.com/compute/docs/general-purpose-machines.md.txt)
284
- [Hyperdisk machine type support](https://docs.cloud.google.com/compute/docs/disks/hyperdisks.md.txt)
285
- [Hyperdisk automated disk type selection (dynamic StorageClass)](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/hyperdisk.md.txt#automated_disk_type_selection)
286