Recover container images from a running Kubernetes node
book
Article ID: 437463
calendar_today
Updated On:
Products
VMware Tanzu Kubernetes Grid Management
Issue/Introduction
A user has deleted an image from Harbor
Resolution
The images can be rebuilt from a running K8s node:
- ssh into your nodes until you find one that has a copy of the image:
# ssh <USER>@<K8SNODE>
- List the images on the node:
# crictl images
note the image name
- Export that image to a .tar file:
# ctr -n k8s.io image export <OUTPUT-FILE> <IMAGE>:<TAG>
- Copy that output file to Harbor:
# scp <OUTPUT-FILE> <USER>@<HARBOR>:/tmp
- Connect to Harbor via
ssh:
# ssh <USER>@<HARBOR>
- Change directory to where we copied the file:
# cd /tmp
- Use Docker to rebuild the image from the exported layers from step 3:
# docker load -i <OUTPUT-FILE>
- Push the image to Harbor:
# docker push <IMAGE>:<TAG>
- Confirm in the Harbor UI that the image exists.
- Repeat for each image to be recovered.
Feedback
thumb_up
Yes
thumb_down
No