简体   繁体   English

通过Kubernetes使用Terraform动态配置Cinder卷和持久卷

[英]Dynamic provisioning of Cinder volume and Persistent volume using Terraform through Kubernetes

I have been doing a research and I've been trying to find out if there is way to create Cinder and Persistent volumes dynamically using Terraform through Kubernetes. 我一直在做研究,一直在尝试找出是否有办法通过Kubernetes使用Terraform动态创建Cinder和Persistent卷。 So I am taking info from here: 所以我从这里获取信息:

https://www.terraform.io/docs/providers/kubernetes/r/persistent_volume.html https://docs.okd.io/latest/install_config/persistent_storage/persistent_storage_cinder.html https://www.terraform.io/docs/providers/kubernetes/r/persistent_volume.html https://docs.okd.io/latest/install_config/persistent_storage/persistent_storage_cinder.html

but looks like Cinder volume must be created manually before and then Persistent volume could be associated with already created "volume_id" . 但是看起来Cinder卷必须在此之前手动创建,然后持久卷可以与已经创建的“ volume_id”关联。

However, I believe there is a way of dynamic creation of PV looking here 但是,我相信这里有一种动态创建PV的方法

https://www.terraform.io/docs/providers/kubernetes/d/storage_class.html https://www.terraform.io/docs/providers/kubernetes/d/storage_class.html

but I am not sure how should it looks like AND If it is possible using Terraform ? 但是我不确定使用Terraform时它的外观应该是AND吗?

Thank you ! 谢谢 !

I found the way .Here is the way to do that --> https://kubernetes.io/blog/2017/03/dynamic-provisioning-and-storage-classes-kubernetes/ and https://www.terraform.io/docs/providers/kubernetes/r/storage_class.html and https://kubernetes.io/docs/concepts/storage/storage-classes/#openstack-cinder 我找到了方法。这就是方法-> https://kubernetes.io/blog/2017/03/dynamic-provisioning-and-storage-classes-kubernetes/https://www.terraform。 io / docs / providers / kubernetes / r / storage_class.htmlhttps://kubernetes.io/docs/concepts/storage/storage-classes/#openstack-cinder

So when when you deploying with Terraform you must specify "storage_class_name = name_of_your_class" in your "resource "kubernetes_persistent_volume_claim"" in "spec" section . 因此,当使用Terraform进行部署时,必须在“规格”部分的“资源” kubernetes_persistent_volume_claim”中指定“ storage_class_name = name_of_your_class”。

Storage class must be created before tat in Kubernetes. 必须在Kubernetes中先创建存储类。

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

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