用于 Kubernetes 卷的 DigitalOcean 块存储

DigitalOcean blockstorage using for Kubernetes Volume

我在 DigitalOcean 上有一个 K8S 集群 运行ning。我在那里有一个 Postgresql 数据库 运行ning,我想使用 DigitalOcean BlockStorage 创建一个卷,以供 Postgresql pod 用作卷。有没有关于如何做到这一点的例子?

如果无法使用 DigitalOcean 块存储,那么大多数公司如何 运行 他们的数据库持久存储?

暂无官方支持。您可以尝试 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)

我在这里 link 找到了关于 flexvolumes This mentions how you can customize to load vendor volumes. There is also a script on how to do this at script

DigitalOcean 块存储的容器存储接口 (CSI) 驱动程序。 https://github.com/digitalocean/csi-digitalocean 已使用 statefulset MySql 进行测试,工作正常