This article will guide you about how to create HostPath persistent volume in Kubernetes.

You might be knowing that data in the Pod exists till the life time of the Pod. If the Pod dies all your data that belongs to the Pod is also goes away along with Pod. So if you want to persist your data beyond the life cycle of the Pod then you must have some thing called as a Persistent volume in Kubernetes.

So lets study how to How to create HostPath persistent volume which is very easy to experiment. Also to gain knowledge about the fundamentals about the Persistent volume.

There are following types of Persistent volume types available to use within kubernetes by different vendors.

  • GCEPersistentDisk
  • AWSElasticBlockStore
  • AzureFile
  • AzureDisk
  • CSI
  • FC (Fibre Channel)
  • FlexVolume
  • Flocker
  • NFS
  • iSCSI
  • RBD (Ceph Block Device)
  • CephFS
  • Cinder (OpenStack block storage)
  • Glusterfs
  • VsphereVolume
  • Quobyte Volumes
  • HostPath (Single node testing only — local storage is not supported in any way and WILL NOT WORK in a multi-node cluster)
  • Portworx Volumes
  • ScaleIO Volumes
  • StorageOS

As you can see for the HostPath it should be used only for the **testing purpose. **Also it does not support multi-node cluster. In case you want to explore more about the Persistent volumes you may follow this link.

The Basic process for Persistent volumes is as follows:

  1. K8s admin create the persistence volume in cluster.
  2. User will claim it using Persistent volume claim once they claimed it status becomes “Bound”.
  3. Then Pod use that volume for storing out the data which will persist across the life-cycle of Pod.

Enough for the theory Part Lets jump the Technical steps towards it:

  • Create the persistent volume

In this step we are using following manifest yaml file to achieve the same.

#devops #kubernetes

How to create HostPath persistent volume in Kubernetes
1.60 GEEK