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 theemptyDir
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 theemptyDir
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/