gpt4 book ai didi

kubernetes - 临时存储垃圾收集

转载 作者:行者123 更新时间:2023-12-02 11:46:55 25 4
gpt4 key购买 nike

我在容器上指定了临时存储限制和请求,并且我使用的是最新的 amazon-eks-node-1.12-v20190701 图像。

我的问题是,当我指定 ephemeral-storage: 1Mi 时,我的 pod 因使用过多而被驱逐。我可以轻松地添加更多内容,但我想知道这究竟是如何工作的,而 kubernetes 文档并不是很有帮助。

根据我的阅读,有一个垃圾收集器 可以清理未使用的图像和未使用的容器。 Kubelet 每分钟对容器进行一次垃圾回收,每五分钟对镜像进行一次垃圾回收。

这也适用于临时存储吗?

如何检查临时存储中的内容(通过容器或节点?)以及如何减少它?

当 ephemeral-storage 达到 85% 并且运行垃圾收集时,它会被清理吗?

不好意思问了很多,只是想了解一下,很难找到一个简单的答案

最佳答案

据我所知(如果这是错误的,请纠正我)没有用于临时存储的垃圾收集。

我们可以在 Kubernetes 文档中读到关于 Garbage Collection 的信息.

Some Kubernetes objects are owners of other objects. For example, a ReplicaSet is the owner of a set of Pods. The owned objects are called dependents of the owner object. Every dependent object has a metadata.ownerReferences field that points to the owning object.

Sometimes, Kubernetes sets the value of ownerReference automatically. For example, when you create a ReplicaSet, Kubernetes automatically sets the ownerReference field of each Pod in the ReplicaSet. In 1.8, Kubernetes automatically sets the value of ownerReference for objects created or adopted by ReplicationController, ReplicaSet, StatefulSet, DaemonSet, Deployment, Job and CronJob.

You can also specify relationships between owners and dependents by manually setting the ownerReference field.

因此我们可以利用垃圾回收来删除依赖对象。

When you delete an object, you can specify whether the object’s dependents are also deleted automatically. Deleting dependents automatically is called cascading deletion. There are two modes of cascading deletion: background and foreground.

If you delete an object without deleting its dependents automatically, the dependents are said to be orphaned.

在 Kubernetes v1.16 中引入了新资源 Local ephemeral storage>

In each Kubernetes node, kubelet’s root directory (/var/lib/kubelet by default) and log directory (/var/log) are stored on the root partition of the node. This partition is also shared and consumed by Pods via emptyDir volumes, container logs, image layers and container writable layers.

然后回答你的问题

How do I check what’s inside the ephemeral storage (via container or a node?) and how can I reduce it?

可能可以执行到安装了存储的 docker 容器并查看那里有什么,但除此之外我看不到访问内容的方法。至于减少存储(我没有测试过)它可能会删除临时存储的内容,因为它不可扩展。

关于kubernetes - 临时存储垃圾收集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58644690/

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