<p>When I try to deploy my microservices locally, I get error regarding volumes. I've trimmed down all other configs and provided only the troubling portion here.</p>
<p><strong>Persistent Volume:</strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: service-1-db-pv
spec:
  capacity:
    storage: 250Mi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  storageClassName: ''
  hostPath:
    path: /mnt/wsl/service-1-pv
    type: DirectoryOrCreate
</code></pre>
<p><strong>Persistent Volume Claim:</strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: service-1-db-pvc
spec:
  volumeName: service-1-db-pv
  resources:
    requests:
      storage: 250Mi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  storageClassName: ''
</code></pre>
<p><strong>Service:</strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: service-service-1-db
spec:
  selector:
    app: service-1-db
  ports:
    - protocol: TCP
      port: 27017
      targetPort: 27017
</code></pre>
<p><strong>Deployment:</strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment-service-1-db
spec:
  selector:
    matchLabels:
      app: service-1-db
  template:
    metadata:
      labels:
        app: service-1-db
    spec:
      containers:
        - name: service-1-db
          image: mongo:latest
          volumeMounts:
            - name: service-1-db-volume
              mountPath: /data/db
          resources:
            requests:
              cpu: 250m
              memory: 128Mi
            limits:
              cpu: 1000m
              memory: 256Mi
      volumes:
        - name: service-1-db-volume
          persistentVolumeClaim:
            claimName: service-1-db-pvc
</code></pre>
<p>When I try to run <code>skaffold run --tail</code>, I get the following output:</p>
<pre><code>Starting deploy...
 - persistentvolume/service-1-db-pv created
 - persistentvolumeclaim/service-1-db-pvc created
 - service/service-service-1-db created
 - deployment.apps/deployment-service-1-db created
Waiting for deployments to stabilize...
 - deployment/deployment-service-1-db: 0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
    - pod/deployment-service-1-db-6f9b896485-mv8qx: 0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
 - deployment/deployment-service-1-db is ready.
Deployments stabilized in 22.23 seconds
</code></pre>
<p>I can't figure out what went wrong. Followed <a href="https://stackoverflow.com/a/52669115">this</a> and <a href="https://stackoverflow.com/a/64744299">this</a>.</p>

msrumon
<p>The &quot;pod has unbound PVC&quot; suggests that the PersistentVolumeClaim associated with your Pods are ... not bound. Meaning your volume provisioner is probably still waiting for a confirmation the corresponding volume was created, before marking your PVC as bound.</p>
<p>Considering your last log mentions deployment being ready, then there isn't much to worry about.</p>
<p>One thing you could look for is your StorageClass VolumeBindingMode:</p>
<ul>
<li>If &quot;Immediate&quot;, then your provisioner would try to create a PV as soon as your register a new PVC.</li>
<li>If &quot;OnDemand&quot;, then Kubernetes would wait for a Pod to try (and fail) attaching your volume once, and only then the PV creation process would start.</li>
</ul>
<p>Although if you're creating both your PVC and Deployment relatively simultaneously, this won't change much.</p>
<p>There's nothing critical here. Although if such error persist: maybe something is wrong either with your volume provisioner, or even more likely: your storage provider. Eg, with Ceph, when you're missing monitors: you won't be able to create new volumes - though you may still read/write existing ones.</p>
<hr />
<p>edit, answering your comment:</p>
<p>There isn't much that can be done.</p>
<p>First: make sure your StorageClass VolumeBindingMode is set to Immediate -- otherwise, there won't be any provisioning before you create a Pod attaching that volume.</p>
<p>Next, you can look into the Operator SDK, or anything that can query the API (Ansible, python, ... shell script), such as you may implement something that would wait for your PVC status to confirm provisioning suceeded.</p>
<p>Then again, there's no guarantee your deployment would always be applied to clusters that offer Immediate volume binding. And there's nothing wrong with OnDemand -- on larger clusters, with lots of users that don't necessarily clean up objects, ... it's not unusual.</p>
<p>Those events you mention arguably are not errors. Even with Immediate binding. It's perfectly normal for the Pod controller to wait for volumes to be properly registered and ready to use.</p>
