- Get all the images that are deployed in the k8s system:
kubectl get pods --all-namespaces -o=jsonpath="{range .items[*]}{'\n'}{.metadata.namespace}:{.metadata.name}{'\n'}{'\t'}{range .spec.containers[*]}{.name}:{.image}{'\n'}{end}{end}"
We can grep for the private registry to filter all the images we are managing from our end, and migrate them easily to the new system.
- Get all pods belonging to a particular nodegroup
kubectl get pods --selector=nodegroup=my-node-group # this does not work for some reason
I ended up doing
kubectl get nodes --l=eks.amazonaws.com/nodegroup=nodegroupname | grep default
To get all the containers running in the default namespace. I think this should be possible from the kubectl CLI.