简体   繁体   English

Docker -v(卷装)等效于kubernetes

[英]Docker -v (volume mount) equivalent in kubernetes

I am looking for a kubernetes equivalent of docker -v for mounting the volumes in gcloud. 我正在寻找一个kubernetes相当于docker docker -v用于在gcloud中安装卷。

I am trying to run my container using google-container-engine which uses kubectl to manage clusters. 我正在尝试使用google-container-engine运行我的容器,它使用kubectl来管理集群。 In the kubectl run command I could not fund any provision for mounting the volumes. 在kubectl run命令中,我无法为安装卷的任何条款提供资金。

 kubectl run foo --image=gcr.io/project_id/myimage --port 8080

I checkout their official docs but could not find any clue whatsoever. 我查看他们的官方文档,但无法找到任何线索。

As at the moment, It's not possible to mount a persistent Volume in a container by using imperative ways or using generators command (run, expose).Therefore, You could use declarative way to get it done. 目前,不可能通过使用命令式方法或使用generator命令(运行,公开)在容器中挂载持久性卷。因此,您可以使用声明式方法来完成它。

Kubernetes provides 2 abstractions for storage in a cluster which are persistent volume claim (PVC) and persistent volume (PV). Kubernetes提供了2个集群存储抽象,它们是持久卷声明(PVC)和持久卷(PV)。 Moreover, you can use storage class to provide Persistent volume (PV) in a dynamic way. 此外,您可以使用存储类以动态方式提供持久性卷(PV)。

persistent-volumes . 持续量

storage-classes 存储类

When you write a manifest file for deployment you need to use a volume claim field to access PVC as well as you will write a PVC to claim PV. 当您编写清单文件以进行部署时,您需要使用卷声明字段来访问PVC,并且您将编写PVC来声明PV。

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

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