简体   繁体   English

无法将卷挂载到 kube.netes 中的 pod

[英]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.我有 k8tes 集群,在将现有卷安装到新部署中的 pod 时,我在其中遇到问题。 I have the existing deployments where I am mounting the same existing PV and PVCs.我有现有的部署,我正在其中安装相同的现有 PV 和 PVC。 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?由于 PV 和 PVC 状态分别绑定和声明,我如何将(NFS)卷安装到新部署?

you can not ideally If your mount mode is set to ReadWriteOnce .如果您的挂载模式设置为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 .如果您计划使用 NFS 并希望将多个 POD 附加到单个挂载,则必须使用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. PersistentVolumeClaim (PVC) 是用户的存储请求。 It is similar to a Pod.它类似于 Pod。 Pods consume node resources and PVCs consume PV resources. Pod消耗节点资源,PVC消耗PV资源。 Pods can request specific levels of resources (CPU and Memory). Pod 可以请求特定级别的资源(CPU 和内存)。 Claims can request specific size and access modes (eg, they can be mounted ReadWriteOnce, ReadOnlyMany or ReadWriteMany, see AccessModes).声明可以请求特定的大小和访问模式(例如,它们可以挂载为 ReadWriteOnce、ReadOnlyMany 或 ReadWriteMany,请参阅 AccessModes)。

Acces mode: https://kube.netes.io/docs/concepts/storage/persistent-volumes/#access-modes访问模式: 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 GKE 示例: https://medium.com/platformer-blog/nfs-persistent-volumes-with-kube.netes-a-case-study-ce1ed6e2c266

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

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