DigitalOcean blockstorage using for Kubernetes Volume

4/20/2017

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?

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

-- Sonam
block-storage
digital-ocean
kubernetes
volume

3 Answers

4/21/2017

I found this link here about flexvolumes This mentions how you can customize to load vendor volumes. There is also a script on how to do this at script

-- Sonam
Source: StackOverflow

6/19/2018

A Container Storage Interface (CSI) Driver for DigitalOcean Block Storage. https://github.com/digitalocean/csi-digitalocean Have tested with statefulset MySql, working fine

-- Trurl McByte
Source: StackOverflow

4/21/2017

No official support yet. You can try the example from someone in this github issue:

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 https://github.com/wardviaene/kubernetes/tree/do-volume

You can use the following spec in your pod yml:

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.

You will need to add create a config file:

[Global] apikey = do-api-key region = your-region and add these parameters to your kubernetes processes: --cloud-provider=digitalocean --cloud-config=/etc/cloud.config

I'm still waiting for an issue in the godo driver to be resolved, before I can submit a PR (digitalocean/godo#102)

-- Oswin Noetzelmann
Source: StackOverflow