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

标签 kubernetes

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/

相关文章:

kubernetes - Kubernetes中的KSQL Server弹性扩展

kubernetes - 如何跨多个 Kubernetes 集群扩展 RabbitMQ

kubernetes - 如何更改 configmap 数据的用户?

docker - Pod "mysql"被禁止 : no API token found for service account default/default

Kubernetes Ingress 重定向和重写

kubernetes - Kubernetes-外部IP与内部IP

kubernetes - 在部署/ pods 创建之前在镜像中编辑配置文件

azure - 无法访问部署在 AKS 上的应用程序

templates - Helm 模板变量为零

kubernetes - Calico 等待 etcd 报错 Kubespray