Manages GKE storage, including PVCs, PersistentVolumes, Filestore, and GCS FUSE. Use when configuring GKE storage, creating PVCs, or setting up GCS FUSE on GKE.
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-gke-storage-b97a07364ad7 ,按照其中的说明把「gke-storage」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
This reference covers storage configuration for GKE clusters including persistent disks, file storage, and cloud storage integration.
MCP Tools:
apply_k8s_manifest,get_k8s_resource,describe_k8s_resource,get_cluster
The golden path Autopilot config enables these CSI drivers:
| Driver | Golden Path | Access Mode | Use Case |
|---|---|---|---|
| Compute Engine | Enabled (default) | ReadWriteOnce | Block storage for |
| : Persistent Disk : : : databases, : | |||
| : CSI : : : single-pod workloads : | |||
| Google Cloud | Enabled | ReadWriteMany | Shared NFS for |
| : Filestore CSI : : : multi-pod access : | |||
| Cloud Storage | Enabled | ReadWriteMany / | Mount GCS buckets as |
| : FUSE CSI : : ReadOnlyMany : volumes : | |||
| Parallelstore | Enabled | ReadWriteMany | High-performance |
| : CSI : : : parallel file system : | |||
| Boot disk type | pd-balanced | N/A | Node boot disks |
GKE provides built-in StorageClasses:
| StorageClass | Disk Type | Use Case |
|---|---|---|
standard-rwo | pd-standard | Cost-effective, low IOPS |
premium-rwo | pd-ssd | High IOPS, databases |
standard-rwx | Filestore (Basic HDD) | Shared NFS |
premium-rwx | Filestore (Basic SSD) | Shared NFS, higher performance |
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast-regional
provisioner: pd.csi.storage.gke.io
parameters:
type: pd-ssd
replication-type: regional-pd # Replicate across 2 zones
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true # Always enable for production
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: database-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: premium-rwo
resources:
requests:
storage: 100Gi
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: shared-data
spec:
accessModes:
- ReadWriteMany
storageClassName: standard-rwx
resources:
requests:
storage: 1Ti # Filestore minimum is 1 TiB for Basic tier
Mount a GCS bucket as a volume without a PVC:
apiVersion: v1
kind: Pod
metadata:
name: gcs-reader
annotations:
gke-gcsfuse/volumes: "true"
spec:
containers:
- name: reader
image: busybox
command: ["ls", "/data"]
volumeMounts:
- name: gcs-bucket
mountPath: /data
volumes:
- name: gcs-bucket
csi:
driver: gcsfuse.csi.storage.gke.io
readOnly: true
volumeAttributes:
bucketName: <BUCKET_NAME>
Requires Workload Identity for the pod's service account to have
storage.objectVieweron the bucket.
If allowVolumeExpansion: true is set on the StorageClass, resize by updating
the PVC:
# kubectl
kubectl patch pvc <PVC_NAME> -p '{"spec":{"resources":{"requests":{"storage":"200Gi"}}}}'
# MCP (preferred)
patch_k8s_resource(parent="...", resourceType="persistentvolumeclaim", name="<PVC_NAME>",
patch='{"spec":{"resources":{"requests":{"storage":"200Gi"}}}}')
Kubernetes automatically resizes the filesystem.
allowVolumeExpansion: true on all
StorageClassesreplication-type: regional-pd
replicates across 2 zones for HAWaitForFirstConsumer: Ensures the PV is provisioned in the same
zone as the podpd-ssd for databases, pd-balanced
(golden path default) for general use, pd-standard for cold storagegke-backup-dr skill) to
protect persistent data