<p>I am currently setting up a Kubernetes cluster but I noticed there are no default storage classes defined.</p>
<pre><code>u@n:~$ kubectl get sc                                                                         
No resources found in default namespace.
</code></pre>
<p>When reading through the docs there are lots of examples for storage classes used when you're deploying your cluster on cloud providers, but not self hosted. What kind of storage class do I need to use in my case?</p>

<p>In general, you can start from the Kubernetes documentation. <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/#provisioner" rel="nofollow noreferrer">Here</a> you can find storage-classes concept. Each StorageClass has a provisioner that determines what volume plugin is used for provisioning PVs. This field must be specified. <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/#local" rel="nofollow noreferrer">local volumes</a> could help you. Look at the example:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
</code></pre>
<p>Local volumes do not currently support dynamic provisioning, however a StorageClass should still be created to delay volume binding until Pod scheduling. This is specified by the  <code>WaitForFirstConsumer</code>  volume binding mode.</p>
<p>Delaying volume binding allows the scheduler to consider all of a Pod's scheduling constraints when choosing an appropriate PersistentVolume for a PersistentVolumeClaim.</p>
<p>If you are looking for complete guide to configure storage for bare metal cluster you can find it <a href="https://www.weave.works/blog/kubernetes-faq-configure-storage-for-bare-metal-cluster" rel="nofollow noreferrer">here</a>. As I mentioned before local volumes do not currently support dynamic provisioning. However it could be workaround, if you are using NFS Server. Look at <a href="https://geoffreymahugu.medium.com/kubernetes-bare-metal-dynamic-storage-allocation-e5311ac45909" rel="nofollow noreferrer">this guide</a>.</p>
