Creating a Storage Class in Google Cloud
Introduction
For Google Cloud, Bunnyshell supports the following types of volumes:
ReadWriteOnce
(Disk) volumesReadWriteMany
(Network) volumes
Prerequisites
The command below helps you list all available GC storage classes present in the cluster, with information that can be used to create a new CSI:
kubectl get sc
Upon using the previous command, you should receive the following Output:
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
premium-rwo pd.csi.storage.gke.io Delete WaitForFirstConsumer true 2d20h
premium-rwx filestore.csi.storage.gke.io Delete WaitForFirstConsumer true 2d20h
standard kubernetes.io/gce-pd Delete Immediate true 2d20h
standard-rwo (default) pd.csi.storage.gke.io Delete WaitForFirstConsumer true 2d20h
standard-rwx filestore.csi.storage.gke.io Delete WaitForFirstConsumer true 2d20h
Steps to create Disk and Network Volumes
The steps detailed below will help you create a Disk (ReadWriteOnce
) Volume:
Setting the proper context
Starting here, you will work in the terminal. Make sure you're connected to the cluster and that the cluster is the current context. Use the command kubectl config --help to obtain the necessary information.
1. To create a storage class, first enter the content below in the csi.yaml file:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: bns-disk-sc
provisioner: pd.csi.storage.gke.io
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
type: pd-balanced
Disk and machine types supported for Zonal and Regional persistent disks
The table below shows disk types and machine types supported for Zonal persistent disks.
pd-standard
All machine types
pd-balanced
All machine types
pd-ssd
All machine types
pd-extreme
n2-standard with 64 or more vCPUs, n2-highmem-64, n2-highmem-80, m1-megamem-96, m2-ultramem-208, m2-ultramem-416
2. Apply the csi.yaml file
kubectl apply -f csi.yaml
// OUTPUT
storageclass.storage.k8s.io/bns-disk-sc created
3. Verify the presence of the bns-disk-sc storage class using the command below:
kubectl get sc
// OUTPUT
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
bns-disk-sc pd.csi.storage.gke.io Delete WaitForFirstConsumer true 25m
Last updated
Was this helpful?