Better way at scale to pull image uris from all pod specs on k8s cluster

Team, I see this [list-all-running-container-image]https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/. however, I cannot bank operations on this because it is very heavy operation as I have 25K pods on cluster.

so what is the better performance approach to get all the image uri's from all specs of a pod? or from pod logs when container is pulled.

Goal is count the number of images that are pulled and their frequency. what would be better solution to do this instead of kubectl command?

if this portal is not for such question, please help reroute. Once I have solution, then I will plan on storing it later and how.


Solution 1:

One way I figured out is instead of querying pods, query the node status itself that shows all the images pulled however it still does not show me time it was pulled. if anyone has a better solution, let know.

Kubectl get node node1 -o json | jq .status.images

[
  {
    "names": [
      "nbt.io/tb/gpu-tests@sha256:df989f2a6418bb5fb8af67b20facbd503b92e538489f50ba0a",
      "nbt.io/tb/gpu-tests:20210616-1706"
    ],
    "sizeBytes": 11701534918
  },