Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for Kubernetes
  • Comparison with other Yandex Cloud services
  • Getting started
    • All guides
    • Connecting to a node over SSH
    • Connecting to a node via OS Login
    • Updating Kubernetes
    • Configuring autoscaling
      • Dynamic volume provisioning
      • Static volume provisioning
      • Managing storage classes
      • Expanding a pod volume
      • Increasing volume size for the StatefulSet controller
      • Mounting a volume in block mode
      • Integration with Object Storage
    • Connecting external nodes to the cluster
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes

In this article:

  • Create a storage class
  • Create a storage class specification format
  • Change the default storage class
  1. Step-by-step guides
  2. Working with persistent volumes
  3. Managing storage classes

Managing storage classes

Written by
Yandex Cloud
Updated at April 10, 2025
  • Create a storage class
    • Create a storage class specification format
  • Change the default storage class

Storage class (StorageClass) allows administrators to divide the storages they provision into classes with defined parameters. Classes vary by disk type and pricing policy.

Alert

The storage usage cost depends on its disk type. See the Yandex Compute Cloud disk prices prior to creating a storage.

Managed Service for Kubernetes has the following storage classes available that differ by the disk type:

  • yc-network-hdd (default): Network HDD storage (network-hdd).
  • yc-network-ssd: Network SSD storage (network-ssd).
  • yc-network-ssd-nonreplicated: Enhanced performance non-replicated SSD storage (network-ssd-nonreplicated).
  • yc-network-ssd-io-m3: Enhanced performance network SSD storage (network-ssd-io-m3).

Alert

Non-replicated disks have no redundancy. If a disk fails, its data will be irretrievably lost. For more information, see Non-replicated disks and ultra high-speed network storages with three replicas (SSD).

All storages are created with the following parameters:

  • Volume Binding Mode: WaitForFirstConsumer.
  • Reclaim Policy: Delete.

Under these classes, you can use PersistentVolumeClaim and PersistentVolume only in ReadWriteOnce access mode.

You can create your own storage class as well as change the default storage class.

Before you start, install kubectl and configure it to work with the created Managed Service for Kubernetes cluster.

Note

yc-network-nvme is deprecated; use yc-network-ssd instead.

Create a storage classCreate a storage class

  1. Save the storage class creation specification to a YAML file named my-sc-hdd.yaml:

    Learn more about the storage class creation specification format.

    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
      name: my-sc-hdd
    provisioner: disk-csi-driver.mks.ycloud.io
    volumeBindingMode: WaitForFirstConsumer
    parameters:
      type: network-hdd
      csi.storage.k8s.io/fstype: ext4
    allowVolumeExpansion: false
    reclaimPolicy: Retain
    
  2. Run this command:

    kubectl create -f my-sc-hdd.yaml
    

    Result:

    storageclass.storage.k8s.io/my-sc-hdd created
    
  3. Check that the storage class was created:

    kubectl get storageclass
    

    Result:

    NAME                      PROVISIONER                    AGE
    my-sc-hdd                 disk-csi-driver.mks.ycloud.io  76s
    yc-network-hdd (default)  disk-csi-driver.mks.ycloud.io  16m
    yc-network-ssd            disk-csi-driver.mks.ycloud.io  16m
    

Create a storage class specification formatCreate a storage class specification format

Each StorageClass object contains the parameters named parameters, allowVolumeExpansion, and reclaimPolicy used for dynamic allocation of the PersistentVolume object.

YAML file structure:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: <storage_class_name> # Used to access a storage class.
provisioner: <provider_name>
volumeBindingMode: WaitForFirstConsumer
parameters: # Storage class parameters.
  type: <disk_type>
  csi.storage.k8s.io/fstype: <file_system_type>
allowVolumeExpansion: <allow_volume_expansion>
reclaimPolicy: <reclaim_policy>

Acceptable parameter values include:

  • parameters:
    • type: network-hdd, network-ssd, network-ssd-nonreplicated, or network-ssd-io-m3.
    • csi.storage.k8s.io/fstype: ext2, ext3, or ext4.
  • reclaimPolicy: Retain or Delete.
  • allowVolumeExpansion: true or false.

Change the default storage classChange the default storage class

  1. Check which storage class is assigned by default: next to its name, you will see default in parentheses.

    kubectl get storageclass
    

    Result:

    NAME                      PROVISIONER                    AGE
    my-sc-hdd                 disk-csi-driver.mks.ycloud.io  76s
    yc-network-hdd (default)  disk-csi-driver.mks.ycloud.io  16m
    yc-network-ssd            disk-csi-driver.mks.ycloud.io  16m
    
  2. Change the storageclass.kubernetes.io/is-default-class parameter of the default storage class to false to remove its default class status:

    kubectl patch storageclass yc-network-hdd \
      -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
    
  3. Check that yc-network-hdd is no longer the default storage class:

    kubectl get storageclass
    

    Result:

    NAME            PROVISIONER                    AGE
    my-sc-hdd       disk-csi-driver.mks.ycloud.io  2m36s
    yc-network-hdd  disk-csi-driver.mks.ycloud.io  17m
    yc-network-ssd  disk-csi-driver.mks.ycloud.io  17m
    
  4. Specify a new default storage class, e.g., my-sc-hdd:

    kubectl patch storageclass my-sc-hdd \
      -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
    
  5. Check that my-sc-hdd is the default storage class:

    kubectl get storageclass
    

    Result:

    NAME                 PROVISIONER                    AGE
    my-sc-hdd (default)  disk-csi-driver.mks.ycloud.io  4m21s
    yc-network-hdd       disk-csi-driver.mks.ycloud.io  19m
    yc-network-ssd       disk-csi-driver.mks.ycloud.io  19m
    

Was the article helpful?

Previous
Static volume provisioning
Next
Expanding a pod volume
© 2025 Direct Cursus Technology L.L.C.