StorageClass

Similarly to EKS on AWS, GKE also sets up StorageClass by default; this uses Persistent Disk:

$ kubectl get storageclass
NAME TYPE
standard (default) kubernetes.io/gce-pd

$ kubectl describe storageclass standard

Name: standard
IsDefaultClass: Yes
Annotations: storageclass.beta.kubernetes.io/is-default-class=true
Provisioner: kubernetes.io/gce-pd
Parameters: type=pd-standard
AllowVolumeExpansion: <unset>
MountOptions: <none>
ReclaimPolicy: Delete
VolumeBindingMode: Immediate
Events: <none>

Consequently, when creating a persistent volume claim, this will automatically allocate the GCP Persistent Disk as the Kubernetes Persistent Volume. For more information on persistent volume claim and Dynamic Provisioning, please refer to Chapter 4, Managing Stateful Workloads:

$ cat pvc-gke.yml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-gke-1
spec:
storageClassName: "standard"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi


//create Persistent Volume Claim $ kubectl create -f pvc-gke.yml persistentvolumeclaim "pvc-gke-1" created

//check Persistent Volume $ kubectl get pv NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-bc04e717-8c82-11e7-968d-42010a920fc3 10Gi RWO Delete Bound default/pvc-gke-1 standard 2s
//check via gcloud command $ gcloud compute disks list NAME ZONE SIZE_GB TYPE STATUS gke-my-k8s-cluster-d2e-pvc-bc04e717-8c82-11e7-968d-42010a920fc3 asia-northeast1-a 10 pd-standard READY
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset