<p>We have <em>one</em> bare metal machine with one SSD and one HDD. The pods in Minikube (k8s) will claim some pvc and get some volumes. We want to enforce that these volumes are actually on our SSD, not HDD. How to do that? Thanks very much!</p>

<p>p.s. What I have tried: When wanting a PVC, we find that Minikube will assign one on <code>/tmp/hostpath-provisioner/...</code>. In addition, IMHO this is the path <em>inside</em> the <em>Docker</em> that Minikube itself runs, not the host machine path. Thus, I have tried to <code>minikube mount /data/minikube-my-tmp-hostpath-provisioner:/tmp/hostpath-provisioner</code> where the <code>/data</code> of <em>host</em> bare metal machine is on SSD (not HDD). However, this makes the pods unhappy, and after a restart they all fail... In addition, I find that only <em>new</em> files will be written to the newly mounted path, while the existing files will still be inside the container...</p>

ch271828n
<p>This sounds exactly like the reason for which <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/" rel="nofollow noreferrer">storage classes</a> exist:</p>

<blockquote>
  <p>A StorageClass provides a way for administrators to describe the “classes” of storage they offer. Different classes might map to quality-of-service levels, or to backup policies, or to arbitrary policies determined by the cluster administrators. Kubernetes itself is unopinionated about what classes represent. This concept is sometimes called “profiles” in other storage systems.</p>
</blockquote>

<p>So in other words - you can create multiple storage classes with different performance or other characteristics. And then decide which one is most appropriate for each claim they create.</p>

<p>For example, this is a storage class you can use on minikube:</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: fast
provisioner: k8s.io/minikube-hostpath
parameters:
  type: pd-ssd
</code></pre>

<p>And you'll probably also need to create a PV, you can do that using:</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: some-name-pv
spec:
  capacity: 
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
    - ReadOnlyMany
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: /tmp/path
</code></pre>

<p>Then, finally, the PVC would like this:</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: some-pvc 
spec:
  storageClassName: fast
  resources:
    requests:
      storage: 100Mi
  accessModes:
    - ReadWriteOnce
</code></pre>
