Set the default StorageClass

A default StorageClass lets your Google Distributed Cloud cluster automatically provision storage for PersistentVolumeClaims (PVCs) that don't specify a storage class. Because Google Distributed Cloud doesn't configure a default StorageClass, these PVCs can't be dynamically provisioned until you designate one.

Overview

Google Distributed Cloud can integrate with block or file storage by using any of the following mechanisms:

Default StorageClass

When you request storage with a PersistentVolumeClaim (PVC), you can specify a StorageClass. If you don't specify a StorageClass, the default StorageClass is used if one is configured in the cluster. Google Distributed Cloud does not configure a default StorageClass. For example, suppose you create a PVC that does not specify a StorageClass. The volume controller will fulfill the claim according to the default StorageClass.

Change the default StorageClass

As a cluster administrator, you might want to change the default storage class. Then all requests for storage that don't specify a StorageClass will be fulfilled according to the StorageClass of your choice. This section gives the steps for changing the default.

Deploy a new storage system

Deploy a new storage system and any software components for integrating the new storage mechanism with a Kubernetes cluster. For example, you might need to install a CSI driver in the cluster.

Mark any existing default StorageClass as non-default

Search your cluster for any existing default StorageClass if one already exists and mark it as non-default. For details, see Change the default StorageClass.

Create a new StorageClass

Create a manifest for a new StorageClass. Include the storageclass.kubernetes.io/is-default-class: "true" annotation. For example:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
  ...
  name: my-storage-class
  ...
parameters:
  ...
provisioner: [MY_PROVISIONER]
...

Save your manifest as a YAML file, and create the new StorageClass:

kubectl --kubeconfig [CLUSTER_KUBECONFIG] apply -f [MANIFEST_FILE]

where [MANIFEST_FILE] is the path to your new StorageClass manifest file.

What's next