如何制作microk8s ctr图像修剪
我在安装Microk8和应用程序的服务器上获得了低磁盘空间警告。当我运行Microk8s CTR Image LS命令时,将出现多个用于应用程序的图像。 Docker中的“ Docker Image Prune -f”命令是否在Microk8s中具有等效?还是有可能?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果要删除内置库中的所有自定义添加的图像,则可以这样做:
将其放入.sh文件中并运行脚本
If you want to delete all custom added images from the built-in library, you can do this:
Put it into a .sh file and run the script
您可以使用:
sudo crictl rmi -prune
删除未使用的图像(这是因为
crictl
与containerd
)兼容。说明:
crictl
。配置
crictl
,适应microk8s
(通过使用containerd.sock的实际位置
对microk8s
有效,它是unix:/ ///var/snap/microk8s/common/run/containerd.sock
)。检查
crictl
是否正在针对Microk8s的Containerd
套接字:sudo crictl Images
修剪未使用的图像:
You can use:
sudo crictl rmi --prune
to remove unused images (that's because
crictl
is compatible withcontainerd
).Instructions:
Install
crictl
.Configure
crictl
, adapting k8s crictl setup docs tomicrok8s
(by using the actual location ofcontainerd.sock
valid formicrok8s
, which isunix:///var/snap/microk8s/common/run/containerd.sock
).Check if
crictl
is working against microk8s'scontainerd
socket:sudo crictl images
To prune unused images:
一个衬里:
您可以删除过滤器
name〜='localhost:32000'
或使用它匹配要清理的特定标签,例如:name〜=':v5.2.0 '
。注意:如果未指定过滤器,所有本地图像将被删除
A one liner:
You can remove the filter
name~='localhost:32000'
or use it to match specific tag you want to clean up, example:name~=':v5.2.0'
.NOTE: If no filter is specified, all local images will be removed
我建议正确配置kubelet 外部GC。
“您应该避免使用外部垃圾收集工具,因为这些工具可能会破坏kubelet行为并删除应该存在的容器。”
I recommend properly configuring kubelet, the docs recommend against any external GC.
"You should avoid using external garbage collection tools, as these can break the kubelet behavior and remove containers that should exist."