简体   繁体   中英

Docker -v (volume mount) equivalent in kubernetes

I am looking for a kubernetes equivalent of docker -v for mounting the volumes in gcloud.

I am trying to run my container using google-container-engine which uses kubectl to manage clusters. In the kubectl run command I could not fund any provision for mounting the volumes.

 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.

Kubernetes provides 2 abstractions for storage in a cluster which are persistent volume claim (PVC) and persistent volume (PV). Moreover, you can use storage class to provide Persistent volume (PV) in a dynamic way.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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