Create StorageClass(s)
This document provides step-by-step instructions for creating a custom StorageClass for OpenEBS Local PV Hostpath. It explains how to create the StorageClass using a YAML definition and highlights the use of the default openebs-hostpath StorageClass.
important
You can skip this section if you would like to use the default OpenEBS Local PV Hostpath StorageClass created by OpenEBS.
The default Storage Class is called openebs-hostpath and its BasePath is configured as /var/openebs/local.
To create your own StorageClass with custom
BasePath, save the following StorageClass definition aslocal-hostpath-sc.yaml(Optional) Custom Node Labeling#
In Kubernetes, Local PV Hostpath identifies nodes using labels such as
kubernetes.io/hostname=<node-name>. However, these default labels might not ensure each node is distinct across the entire cluster. To solve this, you can make custom labels. As an admin, you can define and set these labels when configuring a StorageClass. Here's a sample storage class:note
Using NodeAffinityLabels does not influence the scheduling of the application Pod. Use Kubernetes Allowed Topologies to configure scheduling options.
Edit
local-hostpath-sc.yamland update with your desired values formetadata.nameandcas.openebs.io/config.BasePath.note
If the
BasePathdoes not exist on the node, OpenEBS Dynamic Local PV Provisioner will attempt to create the directory, when the first Local Volume is scheduled on to that node. You must ensure that the value provided forBasePathis a valid absolute path.Create OpenEBS Local PV Hostpath Storage Class.
Verify that the StorageClass is successfully created.
Support#
If you encounter issues or have a question, file a Github issue, or talk to us on the #openebs channel on the Kubernetes Slack server.