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?
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)