简体   繁体   English

DigitalOcean blockstorage用于Kubernetes Volume

[英]DigitalOcean blockstorage using for Kubernetes Volume

I have a K8S cluster running on DigitalOcean. 我有一个在DigitalOcean上运行的K8S集群。 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. 我有一个Postgresql数据库在那里运行,我想使用DigitalOcean BlockStorage创建一个卷,由Postgresql pod作为卷使用。 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? 如果无法使用DigitalOcean blockstorage,那么大多数公司如何运行数据库的持久性存储?

No official support yet. 还没有官方支持。 You can try the example from someone in this github issue : 您可以在此github问题中尝试某人的示例:

Update: I finished writing a volume plugin for digitalocean. 更新:我完成了为digitalocean编写的卷插件。 Attach/detach is working on my cluster. 附加/分离正在我的群集上工作。 Looking for anyone willing to test this on their k8s digitalocean cluster. 寻找愿意在他们的k8s digitalocean集群上测试这个的人。 My branch is https://github.com/wardviaene/kubernetes/tree/do-volume 我的分支是https://github.com/wardviaene/kubernetes/tree/do-volume

You can use the following spec in your pod yml: 您可以在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 [Global] apikey = do-api-key region = your-region并将这些参数添加到你的kubernetes进程: - 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) 在我提交PR(digitalocean / godo#102)之前,我还在等待godo驱动程序中的问题得到解决

I found this link here about flexvolumes This mentions how you can customize to load vendor volumes. 我在这里找到了关于flexvolumes的链接。这提到了如何自定义加载供应商卷。 There is also a script on how to do this at script 还有一个关于如何在脚本中执行此操作的脚本

A Container Storage Interface (CSI) Driver for DigitalOcean Block Storage. 用于DigitalOcean块存储的容器存储接口(CSI)驱动程序。 https://github.com/digitalocean/csi-digitalocean Have tested with statefulset MySql, working fine https://github.com/digitalocean/csi-digitalocean已经使用statefulset MySql进行了测试,工作正常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM