gpt4 book ai didi

kubernetes - Kubernetes 是否在主机上挂载了一个 emptyDir 卷?

转载 作者:行者123 更新时间:2023-12-04 13:25:43 27 4
gpt4 key购买 nike

Kubernetes 有很多类型的卷,including emptyDir :

An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. As the name says, it is initially empty. Containers in the pod can all read and write the same files in the emptyDir volume, though that volume can be mounted at the same or different paths in each container. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever.

...

By default, emptyDir volumes are stored on whatever medium is backing the node.


emtpyDir实际安装在节点上,并且可以访问 pod 外部的容器,还是节点 FS 本身?

最佳答案

是的,它也可以在节点上访问。它被绑定(bind)安装到容器中(有点)。源目录位于 /var/lib/kubelet/pods/PODUID/volumes/kubernetes.io~empty-dir/VOLUMENAME

您可以像这样在主机上找到位置:

sudo ls -l /var/lib/kubelet/pods/`kubectl get pod -n mynamespace mypod -o 'jsonpath={.metadata.uid}'`/volumes/kubernetes.io~empty-dir

关于kubernetes - Kubernetes 是否在主机上挂载了一个 emptyDir 卷?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46525081/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com