<p>I'm having some trouble configuring my Kubernetes deployment on minikube use <code>local-storage</code>. I'm trying to set up a <code>rethinkdb</code> instance that will mount a directory from the minikube VM to the rethinkdb Pod. My setup is the following</p>
<h2>Storage</h2>
<pre><code>---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: rethinkdb-pv
spec:
  capacity:
    storage: 10Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Delete
  storageClassName: local-storage
  local:
    path: /mnt/data
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - minikube
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: rethinkdb-pv-claim
spec:
  storageClassName: local-storage
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 5Gi
</code></pre>
<p>So I define a <code>storageClass</code> of <code>local-storage</code> type as described online in the tutorials. I then make a <code>PersistentVolume</code> that asks for 10GB of storage from the <code>/mnt/data</code> path on the underlying host. I have made this directory on the minikube VM</p>
<pre><code>$ minikube ssh
$ ls /mnt
data  sda1
</code></pre>
<p>This <code>PersistentVolume</code> has the storage class of <code>local-storage</code> and requests it from nodes matching the <code>nodeAffinity</code> section of <code>hostname in 'minikube'</code>.</p>
<p>I then make a <code>PersistentVolumeClaim</code> that asks for the type <code>local-storage</code> and requests 5GB.</p>
<p>Everything is good here, right? Here is the output of <code>kubectl</code></p>
<pre><code>$ kubectl get pv,pvc,storageClass
NAME                            CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS    REASON   AGE
persistentvolume/rethinkdb-pv   10Gi       RWO            Delete           Available           local-storage            9m33s

NAME                                       STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS    AGE
persistentvolumeclaim/rethinkdb-pv-claim   Pending                                      local-storage   7m51s

NAME                                             PROVISIONER                    RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
storageclass.storage.k8s.io/local-storage        kubernetes.io/no-provisioner   Delete          WaitForFirstConsumer   false                  9m33s
storageclass.storage.k8s.io/standard (default)   k8s.io/minikube-hostpath       Delete          Immediate              false                  24h
</code></pre>
<h2>RethinkDB Deployment</h2>
<p>I now attempt to make a <code>Deployment</code> with a single replica of the standard RethinkDB container.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    name: database
  name: rethinkdb
spec:
  progressDeadlineSeconds: 2147483647
  replicas: 1
  selector:
    matchLabels:
      service: rethinkdb
  template:
    metadata:
      creationTimestamp: null
      labels:
        service: rethinkdb
    spec:
      containers:
      - name: rethinkdb
        image: rethinkdb:latest
        volumeMounts:
        - mountPath: /data
          name: rethinkdb-data
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: rethinkdb-data
        persistentVolumeClaim:
          claimName: rethinkdb-pv-claim
</code></pre>
<p>This asks for a single replica of <code>rethinkdb</code> and it tries to mount the <code>rethinkdb-pv-claim</code> Persistent Volume Claim as the name <code>rethinkdb-data</code> and then attempts to mount that at <code>/data</code> in the container.</p>
<p>This is what shows, though</p>
<pre><code>Name:           rethinkdb-6dbf4ccdb-64gk5
Namespace:      development
Priority:       0
Node:           &lt;none&gt;
Labels:         pod-template-hash=6dbf4ccdb
                service=rethinkdb
Annotations:    &lt;none&gt;
Status:         Pending
IP:
IPs:            &lt;none&gt;
Controlled By:  ReplicaSet/rethinkdb-6dbf4ccdb
Containers:
  rethinkdb:
    Image:        rethinkdb:latest
    Port:         &lt;none&gt;
    Host Port:    &lt;none&gt;
    Environment:  &lt;none&gt;
    Mounts:
      /data from rethinkdb-data (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-d5ncp (ro)
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  rethinkdb-data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  rethinkdb-pv-claim
    ReadOnly:   false
  default-token-d5ncp:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-d5ncp
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                  From               Message
  ----     ------            ----                 ----               -------
  Warning  FailedScheduling  73s (x7 over 8m38s)  default-scheduler  0/1 nodes are available: 1 node(s) didn't find available persistent volumes to bind.
</code></pre>
<p>&quot;1 node(s) didn't find available persistent volumes to bind&quot;. I'm not sure how that is because the PVC is available.</p>
<pre><code>$ kubectl describe pvc
Name:          rethinkdb-pv-claim
Namespace:     development
StorageClass:  local-storage
Status:        Pending
Volume:
Labels:        &lt;none&gt;
Annotations:   Finalizers:  [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Mounted By:    rethinkdb-6dbf4ccdb-64gk5
Events:
  Type    Reason                Age                 From                         Message
  ----    ------                ----                ----                         -------
  Normal  WaitForFirstConsumer  11s (x42 over 10m)  persistentvolume-controller  waiting for first consumer to be created before binding
</code></pre>
<p>I think one hint is that the field</p>
<p><code>Nodes &lt;null&gt;</code> for the Pod - does that mean it isn't assigned to a node?</p>

<p>I think the issue is that one of mine was <code>ReadWriteOnce</code> and the other one was <code>ReadWriteMany</code>, then I had trouble getting permissions right when running <code>minikube mount /tmp/data:/mnt/data</code> so I just got rid of mounting it to the underlying filesystem and now it works</p>
