Version 1.7. This version is supported as outlined in the Anthos version support policy, offering the latest patches and updates for security vulnerabilities, exposures, and issues affecting Anthos clusters on bare metal. For more details, see the release notes 1.7. For a complete list of each minor and patch release in chronological order, see the combined release notes.

Available versions: 1.9  |   1.8  |   1.7

Setting the default StorageClass

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