英文:
Kubernetes PVs and PVCs - access from multiple pods
问题
I have a persistent volume created locally in my Kubernetes cluster running in VULTR managed K8S.
当我部署多个 pod(例如一个 Web 服务,其中可以上传图像 - 使用多个副本部署),这些 pod 使用持久卷通过持久卷声明来使用(通过 volumeMounts 挂载到 pod 中的特定路径)->
当通过描述的 Web 服务上传图像时,该图像如何在已复制的 pod 中运行的特定节点上的特定 pod 中可用于其他 pod/节点?
发生的情况是,通过 pod-x 上的 Web 服务上传的图像仅保存在 volumeMounts 路径上,只能在 pod-x 上使用,而不在其他 pod 的 volumeMounts 路径上可用。
由于在大多数情况下使用 Kubernetes 假定在多个 pod/节点上运行应用程序,我在这里可能遗漏了什么?
PS:我不是使用云提供商的存储,我通过 "local" 模式应用了 PV。
我还猜想这可能不是问题所在。问题必须在 PVC 的一侧,因为这是 pod 访问绑定的 PV 的地方。
也许有人对这个问题有经验。
Franz
英文:
I have a persistent volume created locally in my Kubernetes cluster running in VULTR managed K8S.
When I then deploy multiple pods (for example a Webservice where one can upload images - deployed with multiple replicas) that use this persistent volume via a persistent volume claim, (mounted to a specific path in the pod via volumeMounts) ->
How is it possible, when an image gets uploaded via that described Webservice, that runs in the described replicated pods, to make these uploads (uploaded on a specific pod of that service, that runs on a specific node), available to the other pods/nodes?
What happens is, that an image uploaded via the Webservice on pod-x gets saved in the volumeMounts path ONLY and that pod-x, and is not available on the others pods volumeMounts path.
As using Kubernetes in most cases assumed running an application in more then 1 pod/node, what am I missing out here?
PS I am not using a cloud providers storage, I applied the PV via mode „local“.
I also guess that this is not the issue. The issue must be on the PVC end of side as this is where the pods access that bound PV..
Maybe someone has experience with this topic.
Franz
答案1
得分: 1
Kubernetes不会在本地卷之间复制数据。您需要使用共享存储,如NFS或SMB。
英文:
Kubernetes does not replicate data across local volumes. You need to use shared storage like NFS or SMB.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论