在Kubernetes中的Pod之间共享持久卷 [英] Sharing a persistent volume between pods in Kubernetes

查看:100
本文介绍了在Kubernetes中的Pod之间共享持久卷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Kubernetes中我们有两个Pod,为了便于交谈,我们将其称为pod1和pod2.我在pod 1上创建了pv1和pvc1,并且工作正常. 在我看来,有关这种情况的文档不够清楚,或者我找不到正确的Wiki. 如何从pod2访问pv1和pc1?

We have two pods in Kubernetes that for sake of conversation we'll call pod1 and pod2. I created pv1 and pvc1 on pod 1 and it's working fine. In my opinion the documentation is not clear enough about this scenario or I couldn't find the right wiki. How can I access pv1 and pc1 from pod2?

推荐答案

来自k8s文档:

PersistentVolume(PV)是集群中的一部分存储, 由管理员提供.它是 群集就像节点是群集资源一样. PV是体积插件 像卷一样,但是生命周期独立于任何单独的广告连播 使用PV.这个API物件会撷取 存储的实施,可以是NFS,iSCSI或 特定于云提供商的存储系统.

A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator. It is a resource in the cluster just like a node is a cluster resource. PVs are volume plugins like Volumes, but have a lifecycle independent of any individual pod that uses the PV. This API object captures the details of the implementation of the storage, be that NFS, iSCSI, or a cloud-provider-specific storage system.

PersistentVolumeClaim(PVC)是用户的存储请求. 它类似于吊舱. Pod消耗节点资源,PVC消耗 光伏资源. Pod可以请求特定级别的资源(CPU和 记忆).声明可以要求特定的大小和访问方式(例如 一次读/写或多次只读都可以安装.

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 (e.g., can be mounted once read/write or many times read-only).

在问题所示的场景中,这意味着PodA_deployment.yaml是否创建了批量索赔:

Meaning that in the scenario pictured in the question, if PodA_deployment.yaml creates a volume claim:

volumeMounts:
- name: myapp-data-pv-1
  mountPath: /home/myappdata/mystuff

然后PodB将能够安装pv,如下所示:

then PodB will be able to mount the pv making a claim like the following:

volumes:
   - name: myapp-data-pv-1
     persistentVolumeClaim:
       claimName: myapp-data-pvc-1

在PodB_deployment.yaml中

. 虽然一目了然,并且一旦您理解它就很有意义,但是文档可以对它进行更好的解释.

in PodB_deployment.yaml. While it's clear once and it makes sense once you get to understand it, the documentation could explain it better.

这篇关于在Kubernetes中的Pod之间共享持久卷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆