Version 1.7. This version is no longer supported. For more information, see the version support policy. For information about how to upgrade to version 1.8, see Upgrading Anthos on bare metal in the 1.8 documentation.

Available supported versions: 1.12  |   1.11  |   1.10

Setting the default StorageClass

Stay organized with collections Save and categorize content based on your preferences.

This page shows how to set the default StorageClass for an Anthos clusters on bare metal cluster.

Overview

Anthos clusters on bare metal 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 do not specify a StorageClass, the default StorageClass is used if one is configured in the cluster. Anthos clusters on bare metal 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.

Changing the default StorageClass

As a cluster administrator, you might want to change the default storage class. Then all requests for storage that do not 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