Kubernetes是否在主机上安装了emtpyDir卷? [英] Does Kubernetes mount an emtpyDir volume on the host?

查看:99
本文介绍了Kubernetes是否在主机上安装了emtpyDir卷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Kubernetes具有许多类型的卷,包括emptyDir :

Kubernetes features quite a few types of volumes, including emptyDir:

emptyDir卷是在将Pod分配给节点时首先创建的,并且存在,只要该Pod在该节点上运行即可.顾名思义,它最初是空的. Pod中的容器可以全部读取和写入emptyDir卷中的相同文件,尽管该卷可以安装在每个容器中的相同或不同路径上.如果出于任何原因将Pod从节点中删除,则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.

...

默认情况下,emptyDir卷存储在支持该节点的任何介质上.

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

Is the emtpyDir actually mounted on the node, and accessible to a container outside the pod, or to the node FS itself?

推荐答案

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

Yes it is also accessible on the node. It is bind mounted into the container (sort of). The source directories are under /var/lib/kubelet/pods/PODUID/volumes/kubernetes.io~empty-dir/VOLUMENAME

您可以在主机上找到以下位置:

You can find the location on the host like this:

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

这篇关于Kubernetes是否在主机上安装了emtpyDir卷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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