Prakash Palnati
Prakash Palnati

Reputation: 3409

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.

Upvotes: 5

Views: 2667

Answers (1)

Suresh Vishnoi
Suresh Vishnoi

Reputation: 18373

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.

Upvotes: 2

Related Questions