On RKE2 1.34 I have this script to remove unused i...
# rke2
h
On RKE2 1.34 I have this script to remove unused images
Copy code
export CONTAINER_RUNTIME_ENDPOINT=unix:///run/k3s/containerd/containerd.sock
export CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock
export PATH=/var/lib/rancher/rke2/bin:$PATH
/var/lib/rancher/rke2/bin/crictl rmi --prune
On control plane / etcd nodes it works fine and I see its removing old images On agent nodes, its throwing
Copy code
ERRO[0000] validate service connection: validate CRI v1 image API for endpoint "unix:///run/containerd/containerd.sock": rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial unix /run/containerd/containerd.sock: connect: no such file or directory"
ERRO[0000] validate service connection: validate CRI v1 image API for endpoint "unix:///run/crio/crio.sock": rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial unix /run/crio/crio.sock: connect: no such file or directory"
ERRO[0000] validate service connection: validate CRI v1 image API for endpoint "unix:///var/run/cri-dockerd.sock": rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial unix /var/run/cri-dockerd.sock: connect: no such file or directory"
FATA[0000] validate service connection: validate CRI v1 image API for endpoint "unix:///var/run/cri-dockerd.sock": rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial unix /var/run/cri-dockerd.sock: connect: no such file or directory"
What is proper way to do this on agent nodes?
c
It isn't recommended to do image garbage collection underneath the kubelet. I was looking at eraser prior to
imageMaximumGCAge
landing - I think that came in 1.35 though (kubernetes.io/docs/concepts/architecture/garbage-collection#…)
👍 1
c
You're not running it right on agents. It's trying the default socket path, not the one you claim you're setting in env vars
h
🤦‍♂️
I got so carried away the error didn't even register in my brain
Thank you!!