简体   繁体   English

从Azure容器注册表中提取图像后,图像将存储在Azure Kubernetes群集中的何处?

[英]Where the images get stored in Azure Kubernetes Cluster after pulling from Azure Container Registry?

I am using Kubernetes to deploy all my microservices provided by Azure Kubernetes Services. 我正在使用Kubernetes部署由Azure Kubernetes Services提供的所有微服务。

Whenever I release an update of my microservice which is getting frequently from last one month, it pulls the new image from the Azure Container Registry. 每当我发布上个月开始频繁更新的微服务更新时,它都会从Azure容器注册表中提取新映像。

I was trying to figure out where do these images reside in the cluster? 我试图弄清楚这些图像在群集中的何处?

Just like Docker stores, the pulled images in /var/lib/docker & since the Kubernetes uses Docker under the hood may be it stores the images somewhere too. 就像Docker商店一样,在/ var / lib / docker&中提取的映像也是如此,因为Kubernetes在后台使用Docker可能是因为它也将映像也存储在某个地方。

But if this is the case, how can I delete the old images from the cluster that are not in use anymore? 但是,在这种情况下,如何从群集中删除不再使用的旧映像?

You are correct in guessing that it's mostly up to Docker, or rather to whatever the active CRI plugin is. 您猜对了,这主要取决于Docker,或者取决于活动的CRI插件。 The Kubelet automatically cleans up old images when disk space runs low so it's rare that you need to ever touch it directly, but if you did (and are using Docker as your runtime) then it would be the same docker image commands as per normal. 当磁盘空间不足时,Kubelet会自动清理旧映像,因此很少需要直接触摸它,但是如果您这样做了(并且正在使用Docker作为运行时),则它与通常的Docker docker image命令相同。

I was trying to figure out where do these images reside in the cluster? 我试图弄清楚这些图像在群集中的何处?

With the test and check, the result shows each node in the AKS cluster installed the Docker server, and the images stored like Docker as you say that the image layers stored in the directory /var/lib/docker/. 通过测试和检查,结果显示了AKS集群中安装了Docker服务器的每个节点,以及像Docker一样存储的映像,就像您说的那样,映像层存储在目录/ var / lib / docker /中。

how can I delete the old images from the cluster that are not in use anymore? 如何从群集中删除不再使用的旧映像?

You can do this through the Docker command inside the node. 您可以通过节点内的Docker命令执行此操作。 Follow the steps in Connect with SSH to Azure Kubernetes Service (AKS) cluster nodes to make a connection to the node, then you could delete the image through the Docker CLI docker rmi image_name:tag , but carefully with it, make sure the image is really no more useful. 请按照SSH连接到Azure Kubernetes服务(AKS)群集节点中的步骤建立与节点的连接,然后可以通过Docker CLI docker rmi image_name:tag删除映像,但请仔细进行操作,确保映像为真的没有更多用处了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM