I have multiple clusters that I want to query and in each cluster I want to find and list the versions of the pods running in there.
I've written a shell script that sets the namespace and then changes context to each cluster and then runs
kubectl describe pods | grep "/version=" -B1 in each cluster.
This seems to be a very hacky and clumsy approach to this problem. Is there a succinct command in the Kubernetes realm that I can issue that will take a list of clusters and return the name/version of each pod?
I feel that there are 2 problems described here and help with either or both would be appreciated:
- How do I issue commands like
kubectl describe podsto multiple clusters at the same time and aggregate those results?
- What is best way to list names with versions of each pod in a cluster?
Update: I built an assumption into the questions that the answer would be a scripted
kubectl command but it does not need to be. The objective is to find all the name/version combos of all pods running in listed clusters.