Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DigitalOcean blockstorage using for Kubernetes Volume

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?

like image 729
Katlock Avatar asked Oct 29 '22 08:10

Katlock


1 Answers

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)

like image 98
Oswin Noetzelmann Avatar answered Nov 15 '22 08:11

Oswin Noetzelmann