<p>I've gone through the steps to create a persistent disk in google compute engine and attach it to a running VM instance. I've also created a docker image with a VOLUME directive. It runs fine locally, in the docker run command, i can pass a -v option to mount a host directory as the volume. I thought there would be a similar command in kubectl, but I don't see one. How can I mount my persistent disk as the docker volume?</p>

<p>In your pod spec, you may specify a Kubernetes <a href="http://kubernetes.io/docs/user-guide/volumes/#gcepersistentdisk" rel="nofollow"><code>gcePersistentDisk</code></a> volume (the <code>spec.volumes</code> field) and where to mount that volume into containers (the <code>spec.containers.volumeMounts</code> field). Here's an example:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-pd
spec:
  containers:
  - image: gcr.io/google_containers/test-webserver
    name: test-container
    volumeMounts:
    - mountPath: /test-pd
      name: test-volume
  volumes:
  - name: test-volume
    # This GCE PD must already exist.
    gcePersistentDisk:
      pdName: my-data-disk
      fsType: ext4
</code></pre>

<p>Read more about Kubernetes volumes: <a href="http://kubernetes.io/docs/user-guide/volumes" rel="nofollow">http://kubernetes.io/docs/user-guide/volumes</a></p>
