Mount Local Volume With Kubernetes

Kubernetes local volume is a feature that allows you to create and attach storage devices to your clusters nodes. You can use local volumes to store data, applications, or configuration files.

When you create a local volume, Kubernetes creates a Persistent Volume Claim (PVC) and uses it to provide a storage device on one of the cluster nodes. You can then access the storage device from any node in the cluster.


Kubernetes Volumes are used to store persistent data in a Kubernetes cluster, and as of writing these lines, Kubernetes offer many types of volumes connected to a cluster. They range from Azure file share, AWS storage and, in our case, local volumes.

In the example below, we are creating a volume mount in our cluster that creates a storage volume directory on the actual Kubernetes node.

apiVersion: v1
kind: PersistentVolume
  name: local-pv
    storage: 1Gi
  volumeMode: Filesystem
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Delete
  storageClassName: local-storage
    path: "/volumes/myvol01"
      - matchExpressions:
        - key:
          operator: In
          - my-node

To apply the configuration, I will run the following command.

kubectl apply -f local-volume.yaml

To get more information about the volume, use this command.

kubectl describe pv local-pv

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.