<p>I have a deployment configuration as follows:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
--- REMOVED FOR BREVITY ---
      volumes:
      - gcePersistentDisk: {fsType: pd-ssd, pdName: devtasker-disk}
        name: devtasker-disk
      - gcePersistentDisk: {fsType: pd-ssd, pdName: devtasker-pg}
        name: devtasker-pg
</code></pre>

<p>This works fine, however it requires the persistent volumes to be created manually and then the deployment can take place.</p>

<p>I saw in Kubernetes 1.4 they have released "Dyanmic Provisioning &amp; Storage Classes". </p>

<p>I have added a storage class as follows:</p>

<pre><code>kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
  name: ssd-storage
provisioner: kubernetes.io/gce-pd
parameters:
  type: pd-ssd
</code></pre>

<p>I now want to add a PVC to my deployment configuration file mentioned above. The standard PVC for the above storage class goes like this:</p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations: {volume.beta.kubernetes.io/storage-class: ssd-storage}
  name: claim1
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests: {storage: 30Gi}
</code></pre>

<p>Im struggling to get the above PVC into my deployment configuration mentioned in the first code block above.</p>

<p>I tried this:</p>

<pre><code>      volumes:
      - gcePersistentDisk: {fsType: pd-ssd, pdName: devtasker-disk}
        name: devtasker-disk
      - gcePersistentDisk: {fsType: pd-ssd, pdName: devtasker-pg}
        name: devtasker-pg
      - persistentVolumeClaim: {claimName: ssd-storage, annotations: {volume.beta.kubernetes.io/storage-class: ssd-storage}}
        name: ssd-storage
</code></pre>

<p>.. but I haven't had any luck with many different combinations. I get the following:</p>

<pre><code>error validating "kubernetes/deployment.yml": error validating data: found invalid field annotations for v1.PersistentVolumeClaimVolumeSource; if you choose to ignore these errors, turn validation off with --validate=false
</code></pre>

<p>Could anyone please point me in the right direction here?</p>

<p>The storage class tells how to create the PV. The PVC claim requests the actual PV from the underlining infrastructure. </p>

<p>Your deployment should only know about the PVC, so using your example you would end up with the following and remove the <code>gcePersistentDisk</code> entries: </p>

<pre><code>volumes:
   - name: storage
     persistentVolumeClaim
       claimName: claim1
   - name: storage2
     persistentVolumeClaim
       claimName: claim2
</code></pre>
