Reputation: 1
can anyone provide technical details on where GKE persistent volumes are actually stored and what happens in case a node goes down on Google Kubernetes Engine?
Google provides documentation on the use but not on annotations, I need to know whether for any reason the PV might be stored on the node hosting the pod itself
Upvotes: 0
Views: 104
Reputation: 274
When the node goes down or is deleted, the GKE persistent volume will be deleted as well. This is because the default storageclass in GKE is set to ReclaimPolicy: Delete
You can run the command kubectl get sc
to check the storageclasses and
describe the storageclass by running the command kubectl describe sc standard-rwo
Read this link for more information about Persistent volumes and dynamic provisioning.
If you want to retain your Persistent volumes when the node goes down or is deleted. You can create your storageclass and set ReclaimPolicy: Retain
, see example below:
StorageClass
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: mystorageclass
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-standard
fstype: ext4
replication-type: none
reclaimPolicy: Retain
Then create PVC to automatically provision your Persistent volumes and use it in your deployment. See example of PVC below:
PersistentVolumeClaims
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mypvc
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 8Gi
storageClassName: mystorageclass
Upvotes: 3