k8s环境中通过helm安装kruise,提供预热镜像的能力,并通过crictl查看预热的镜像列表
步骤
1、helm安装kruise
# Firstly add openkruise charts repository if you haven't do this.
$ helm repo add openkruise https://openkruise.github.io/charts/
# [Optional]
$ helm repo update
# Install the latest version.
$ helm install kruise --set featureGates="ImagePullJobGate=true" --set manager.image.repository=openkruise-registry.cn-shanghai.cr.aliyuncs.com/openkruise/kruise-manager:v1.6.0 --set manager.replicas=1 openkruise/kruise
2、创建ImagePullJob
cat << EOF | kubectl apply -f -
apiVersion: apps.kruise.io/v1alpha1
kind: ImagePullJob
metadata:
name: test-imagepulljob-777777777
spec:
image: registry.cn-hangzhou.aliyuncs.com/fu-wanglei/ubuntu:24.04
completionPolicy:
type: Always
activeDeadlineSeconds: 1200
ttlSecondsAfterFinished: 300
pullPolicy:
backoffLimit: 3
timeoutSeconds: 300
EOF
3、查看镜像拉取结果
上述job为在每个节点上都拉取一份镜像
进入一个节点查看镜像列表
root@wanglei:~# crictl images
WARN[0000] image connect using default endpoints: [unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]. As the default settings are now deprecated, you should set the endpoint instead.
IMAGE TAG IMAGE ID SIZE
docker.io/library/nginx latest 4f67c83422ec7 71MB
registry.cn-hangzhou.aliyuncs.com/fu-wanglei/ubuntu 24.04 35a88802559dd 30.6MB
刚开始一直以为在节点中直接使用docker images就能看到镜像了,实际上是看不到。最后了解到crictl工具,才明白~~~