Yandex Cloud
Documentation
PresentationContact UsTry it for free
© 2026 Direct Cursus Technology L.L.C.
Yandex Managed Service for Kubernetes
  • Comparing 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 masquerading in clusters with multiple ranges of pod IP addresses
    • Configuring autoscaling
    • Activating a Kubernetes Terraform provider
    • Installing applications from Yandex Cloud Marketplace using Terraform
    • Working with private Docker image registries
      • Dynamic volume provisioning
      • Static volume provisioning
      • Managing storage classes
      • Encrypted disks for persistent volumes
      • Expanding a volume for pods
      • Mounting a volume in block mode
      • Integration with Object Storage
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes

In this article:

  • Create a PersistentVolumeClaim object
  • Create a pod with the mounted volume
  1. Step-by-step guides
  2. Working with persistent volumes
  3. Mounting a volume in block mode

Mounting a volume in block mode

Written by
Yandex Cloud
Updated at November 5, 2026
View in Markdown
  • Create a PersistentVolumeClaim object
  • Create a pod with the mounted volume

To mount a volume in volumeMode: Block mode:

  1. Create a PersistentVolumeClaim object.
  2. Create a pod with the mounted volume.

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

Create a PersistentVolumeClaim objectCreate a PersistentVolumeClaim object

  1. To create a volume in block mode, set the spec.volumeMode field to Block.

    Save the following PersistentVolumeClaim creation specification to a YAML file named pvc-block.yaml.

    Note

    If the storageClassName parameter is not specified, the default storage class, yc-network-hdd, will be used. Learn how to change the default class in Update the default storage class.

    Learn more about the PersistentVolumeClaim creation specification in the Kubernetes guide.

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: pvc-block
    spec:
      accessModes:
        - ReadWriteOnce
      volumeMode: Block
      storageClassName: "yc-network-hdd"
      resources:
        requests:
          storage: 1Gi
    
  2. Create a PersistentVolumeClaim object:

    kubectl create -f pvc-block.yaml
    

    Result:

    persistentvolumeclaim/pvc-block created
    

Create a pod with the mounted volumeCreate a pod with the mounted volume

  1. When creating a volume pod in block mode, specify the spec.containers.volumeDevices field.

    Save the following pod creation specification to a YAML file named pod.yaml.

    Learn more about the pod creation specification in this Kubernetes guide.

    apiVersion: v1
    kind: Pod
    metadata:
      name: pod
    spec:
      containers:
      - name: app
        image: ubuntu
        command: ["/bin/sh"]
        args: ["-xc", "/bin/dd if=/dev/block of=/dev/null bs=1K count=10; /bin/sleep 3600"]
        volumeDevices:
        - devicePath: /dev/block
          name: persistent-storage
      volumes:
      - name: persistent-storage
        persistentVolumeClaim:
          claimName: pvc-block
    
  2. Run this command:

    kubectl create -f pod.yaml
    

    Result:

    pod/pod created
    

Was the article helpful?

Previous
Expanding a volume for pods
Next
Integration with Object Storage
© 2026 Direct Cursus Technology L.L.C.