<p>When I push my deployments, for some reason, I'm getting the error on my pods:</p>

<blockquote>
  <p>pod has unbound PersistentVolumeClaims</p>
</blockquote>

<p>Here are my YAML below:</p>

<p>This is running locally, not on any cloud solution.</p>



<pre class="lang-yaml prettyprint-override"><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.16.0 ()
  creationTimestamp: null
  labels:
    io.kompose.service: ckan
  name: ckan
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        io.kompose.service: ckan
    spec:
      containers:
        image: slckan/docker_ckan
        name: ckan
        ports:
        - containerPort: 5000
        resources: {}
        volumeMounts:
            - name: ckan-home
              mountPath: /usr/lib/ckan/
              subPath: ckan
      volumes:
      - name: ckan-home
        persistentVolumeClaim:
          claimName: ckan-pv-home-claim
      restartPolicy: Always
status: {}
</code></pre>

<hr>

<pre class="lang-yaml prettyprint-override"><code>kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: ckan-pv-home-claim
  labels:
    io.kompose.service: ckan
spec:
  storageClassName: ckan-home-sc
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
  volumeMode: Filesystem
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: ckan-home-sc
provisioner: kubernetes.io/no-provisioner
mountOptions:
  - dir_mode=0755
  - file_mode=0755
  - uid=1000
  - gid=1000
</code></pre>

soniccool
<p>You have to define a <strong>PersistentVolume</strong> providing disc space to be consumed by the <strong>PersistentVolumeClaim</strong>.</p>
<p>When using <code>storageClass</code> Kubernetes is going to enable <strong>&quot;Dynamic Volume Provisioning&quot;</strong> which is not working with the local file system.</p>
<hr />
<h3>To solve your issue:</h3>
<ul>
<li>Provide a <strong>PersistentVolume</strong> fulfilling the constraints of the claim (a size &gt;= 100Mi)</li>
<li>Remove the <code>storageClass</code> from the <strong>PersistentVolumeClaim</strong> or provide it with an empty value (<code>&quot;&quot;</code>)</li>
<li>Remove the <strong>StorageClass</strong> from your cluster</li>
</ul>
<hr />
<h3>How do these pieces play together?</h3>
<p>At creation of the deployment state-description it is usually known which kind (amount, speed, ...) of storage that application will need.<br />
To make a deployment versatile you'd like to avoid a hard dependency on storage. Kubernetes' volume-abstraction allows you to provide and consume storage in a standardized way.</p>
<p>The <strong>PersistentVolumeClaim</strong> is used to provide a storage-constraint alongside the deployment of an application.</p>
<p>The <strong>PersistentVolume</strong> offers cluster-wide volume-instances ready to be consumed (&quot;<code>bound</code>&quot;). One PersistentVolume will be bound to <em>one</em> claim. But since multiple instances of that claim may be run on multiple nodes, that volume may be <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="noreferrer">accessed</a> by multiple nodes.</p>
<p>A <strong>PersistentVolume without StorageClass</strong> is considered to be <strong>static</strong>.</p>
<p><a href="https://kubernetes.io/docs/concepts/storage/dynamic-provisioning" rel="noreferrer"><strong>&quot;Dynamic Volume Provisioning&quot;</strong></a> alongside <strong>with</strong> a <strong>StorageClass</strong> allows the cluster to provision PersistentVolumes on demand.
In order to make that work, the given storage provider must support <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/#provisioner" rel="noreferrer">provisioning</a> - this allows the cluster to request the provisioning of a &quot;new&quot; <strong>PersistentVolume</strong> when an unsatisfied <strong>PersistentVolumeClaim</strong> pops up.</p>
<hr />
<h3>Example PersistentVolume</h3>
<p>In order to find how to specify things you're best advised to take a look at the <a href="https://kubernetes.io/de/docs/reference/#api-referenz" rel="noreferrer">API for your Kubernetes version</a>, so the following example is build from the <a href="https://v1-17.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#persistentvolume-v1-core" rel="noreferrer">API-Reference of K8S 1.17</a>:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: ckan-pv-home
  labels:
    type: local
spec:
  capacity:
    storage: 100Mi
  hostPath:
    path: &quot;/mnt/data/ckan&quot;
</code></pre>
<p>The <strong>PersistentVolumeSpec</strong> allows us to define multiple attributes.
I chose a <code>hostPath</code> volume which maps a local directory as content for the volume. The capacity allows the resource scheduler to recognize this volume as applicable in terms of resource needs.</p>
<hr />
<h3>Additional Resources:</h3>
<ul>
<li><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/" rel="noreferrer">Configure PersistentVolume Guide</a></li>
</ul>
