简体   繁体   中英

Unable to mount the volume to the pod in kubernetes

I have k8tes cluster in which I am facing issues while mounting the existing volume to the pod in the new deployment. I have the existing deployments where I am mounting the same existing PV and PVCs. But facing issues only new deployment.

What could be the reason? How can I mount(NFS) volume to the new deployments because both PV and PVC statuses are bound and claimed respectively?

you can not ideally If your mount mode is set to ReadWriteOnce .

If you are planning to use the NFS and want to attach multiple PODs to a single mount you have to use the ReadWriteMany .

Example:

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs-data
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 2Gi
  storageClassName: nfs

A PersistentVolumeClaim (PVC) is a request for storage by a user. It is similar to a Pod. Pods consume node resources and PVCs consume PV resources. Pods can request specific levels of resources (CPU and Memory). Claims can request specific size and access modes (eg, they can be mounted ReadWriteOnce, ReadOnlyMany or ReadWriteMany, see AccessModes).

Acces mode: https://kube.netes.io/docs/concepts/storage/persistent-volumes/#access-modes

GKE example: https://medium.com/platformer-blog/nfs-persistent-volumes-with-kube.netes-a-case-study-ce1ed6e2c266

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