<p>I have a K8S cluster running on DigitalOcean.  I have a Postgresql database running there and I want to create a volume using the DigitalOcean BlockStorage to be used by the Postgresql pod as volume.  Is there any examples on how to do that?  </p>

<p>If it's not possible to use DigitalOcean blockstorage then how do most companies run their persistence storage for databases?  </p>

<p>No official support yet. You can try the example from someone in <a href="https://github.com/kubernetes/kubernetes/issues/32334" rel="nofollow noreferrer">this github issue</a>:</p>

<blockquote>
  <p>Update: I finished writing a volume plugin for digitalocean. Attach/detach is working on my cluster. Looking for anyone willing to
  test this on their k8s digitalocean cluster. My branch is
  <a href="https://github.com/wardviaene/kubernetes/tree/do-volume" rel="nofollow noreferrer">https://github.com/wardviaene/kubernetes/tree/do-volume</a></p>
  
  <p>You can use the following spec in your pod yml:</p>

<pre><code>spec:
  containers:
  - name: k8s-demo
    image: yourimage
    volumeMounts:
    - mountPath: /myvol
      name: myvolume
    ports:
    - containerPort: 3000
  volumes:
  - name: myvolume
    digitaloceanVolume:
      volumeID: mykubvolume
      fsType: ext4 Where mykubvolume is the volume created in DigitalOcean in the same region.
</code></pre>
  
  <p>You will need to add create a config file:</p>
  
  <p>[Global] apikey = do-api-key region = your-region and add these
  parameters to your kubernetes processes: --cloud-provider=digitalocean
  --cloud-config=/etc/cloud.config</p>
  
  <p>I'm still waiting for an issue in the godo driver to be resolved,
  before I can submit a PR (digitalocean/godo#102)</p>
</blockquote>
