how can I find the related image version with the kubernetes version?

10/22/2019

When I use kubeadm to install Kubernetes, I can use the command below to get.

kubeadm config images list

the output like:

k8s.gcr.io/kube-apiserver:v1.12.2
k8s.gcr.io/kube-controller-manager:v1.12.2
k8s.gcr.io/kube-scheduler:v1.12.2
k8s.gcr.io/kube-proxy:v1.12.2
k8s.gcr.io/pause:3.1
k8s.gcr.io/etcd:3.2.24
k8s.gcr.io/coredns:1.2.2

Besides kubeadm, how can I find the related image version with the kubernetes version?

-- cxyfreedom
kubernetes

1 Answer

10/22/2019

As per List All Container Images Running in a Cluster, you can use:

kubectl get pods --namespace kube-system -o jsonpath="{..image}"

This will list all images used by containers running in kube-system namespace.

You can use go-template to improve the formatting. Here is an output example using a vanilla Minikube:

$ kubectl get pods --namespace=kube-system -o go-template --template='{{range .items}}{{range .spec.containers}}{{.image}}{{"\n"}} {{end}}{{end}}'
 k8s.gcr.io/coredns:1.6.2
 k8s.gcr.io/coredns:1.6.2
 k8s.gcr.io/etcd:3.3.15-0
 k8s.gcr.io/kube-addon-manager:v9.0.2
 k8s.gcr.io/kube-apiserver:v1.16.0
 k8s.gcr.io/kube-controller-manager:v1.16.0
 k8s.gcr.io/kube-proxy:v1.16.0
 k8s.gcr.io/kube-scheduler:v1.16.0
 gcr.io/k8s-minikube/storage-provisioner:v1.8.1
-- Eduardo Baitello
Source: StackOverflow