-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Containerd image labels are lost after restarting k3s #11363
Comments
If you want the images to remain pinned, leave the tarballs in the images dir. On startup, K3s removes the pinned label from all images in the image store, then re-imports and re-pins everything from the images dir. This is to ensure that "old" images that are no longer present on disk don't remain pinned and take up space after their source archives have been removed from disk. If this doesn't work for you, then I would suggest setting up a private registry mirror to hold your images, instead of relying on import pinning. |
@brandond I guess k3s removes the images that have |
Yes, it only unpins things that have a label indicating they were pinned by k3s. So if you remove the k3s label, it should leave the pin - assuming you don't have the image archive around any longer to cause it to re-apply the label. k3s/pkg/agent/containerd/containerd.go Lines 248 to 264 in 1b7dd76
|
Environmental Info:
k3s version v1.31.2+k3s1 (6da2042)
go version go1.22.8
Node(s) CPU architecture, OS, and Version:
x86_64 GNU/Linux
Cluster Configuration:
Single node
Describe the bug:
I import images via air-gap image tar files. They are pinned in containerd to ensure that they remain available and are not pruned by Kubelet garbage collection.
After restarting k3s, the containerd labels are lost.
Steps To Reproduce:
I store the air-gap image tar file under
/var/lib/rancher/k3s/agent/images
and start k3s, k3s labels the images usingio.cattle.k3s.pinned=pinned
andio.cri-containerd.pinned=pinned
.ctr images list
:Then I delete the tar file since the images are already imported. After restarting the k3s service via
systemctl restart k3s
, the labels are lost.ctr images list
:The same issue happens if I manually label the images:
For example:
ctr images list
:Restart k3s via
systemctl restart k3s
and containerd receives ImageUpdate event and updates the labels:BTW I realized that containerd receives the ImageUpdate event after restart only if I label the image with
io.cattle.k3s.pinned=pinned
, otherwise the images keep their labels.Expected behavior:
I would expect containerd image labels to be persistent after restarting k3s.
Actual behavior:
The containerd image labels are lost after restarting k3s service.
The text was updated successfully, but these errors were encountered: