Provisioning Regional Persistent Disks

This page explains how to enable dynamic provisioning of Regional Persistent Disks and how to provision them manually.

Regional Persistent Disks

As with regular persistent disks, regional persistent disks can be dynamically provisioned as needed or manually provisioned in advance by the cluster administrator.

Dynamic provisioning

To enable dynamic provisioning of regional persistent disks, the cluster administrator can create a StorageClass with the replication-type and zones parameters. For example, the following manifest describes a StorageClass that uses standard persistent disks and that replicates data to the europe-west1-b and europe-west1-c zones:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: regionalpd-storageclass
provisioner: kubernetes.io/gce-pd
parameters:
  type: pd-standard
  replication-type: regional-pd
  zones: europe-west1-b, europe-west1-c
  

To create a PersistentVolumeClaim named "regional-pvc" with the regionalpd-storageclass StorageClass, refer to the StorageClass in the claim's manifest:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: regional-pvc
  namespace: testns
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
  storageClassName: regionalpd-storageclass
  

Manual provisioning

First, create a regional persistent disk. The following example creates a disk named "gce-disk-1" replicated to the europe-west1-b and europe-west1-c zones:

gcloud beta compute disks create \
 gce-disk-1 \
 --region europe-west1 \
 --replica-zones europe-west1-b,europe-west1-c

You can then create a PersistentVolume that references the regional persistent disk, following the procedure described here.

Kubernetes automatically adds a label to PersistentVolume objects that are backed by a regional persistent disk. The label's key is failure-domain.beta.kubernetes.io/zone and its value is the two zones where the persistent disks are located. For example, a PersistentVolume that is backed by regional persistent disk that replicates data to europe-west1-b and europe-west1-c has this label added to it:

failure-domain.beta.kubernetes.io/zone: “europe-west1-b__europe-west1-c”
Was this page helpful? Let us know how we did:

Send feedback about...

Kubernetes Engine