I was working in an environment recently that was offline. I needed to ensure that the required images for my Kubernetes cluster were available in the offline registry before starting.

My initial thought was to check the available a
The docs (here)[https://kubernetes.io/docs/setup/independent/install-kubeadm/] outline it which is nice.

Kubeadm is the now the certified method of installation for Kubernetes clusters. It can be used to perform the initial bootstrap. As such it can also be used to validate what images are needed locally and furthermore pull them before running kubeadm init.

This results in downloaded the images relevant for your version of Kubeadm.

kubeadm config images list

This gives us the list of all the relevant images required for installing Kubernetes offline. A similar command kubeadm config images pull will download them to the local Docker registry.

sudo kubeadm config images pull
[config/images] Pulled k8s.gcr.io/kube-apiserver-amd64:v1.11.4
[config/images] Pulled k8s.gcr.io/kube-controller-manager-amd64:v1.11.4
[config/images] Pulled k8s.gcr.io/kube-scheduler-amd64:v1.11.4
[config/images] Pulled k8s.gcr.io/kube-proxy-amd64:v1.11.4
[config/images] Pulled k8s.gcr.io/pause:3.1
[config/images] Pulled k8s.gcr.io/etcd-amd64:3.2.18
[config/images] Pulled k8s.gcr.io/coredns:1.1.3

sudo docker image list | grep k8s.gcr
k8s.gcr.io/kube-proxy-amd64                     v1.11.4             5071d096cfcd        2 weeks ago         98.2 MB
k8s.gcr.io/kube-apiserver-amd64                 v1.11.4             de6de495c1f4        2 weeks ago         187 MB
k8s.gcr.io/kube-controller-manager-amd64        v1.11.4             dc1d57df5ac0        2 weeks ago         155 MB
k8s.gcr.io/kube-scheduler-amd64                 v1.11.4             569cb58b9c03        2 weeks ago         56.8 MB
k8s.gcr.io/coredns                              1.1.3               b3b94275d97c        5 months ago        45.6 MB
k8s.gcr.io/etcd-amd64                           3.2.18              b8df3b177be2        7 months ago        219 MB
k8s.gcr.io/pause                                3.1                 da86e6ba6ca1        10 months ago       742 kB


Beauty. Now just export your images with docker save.

 sudo docker save k8s.gcr.io/coredns:1.1.3 -o ~/export/coredns:1.1.3  

Now just loop through and voila! Your images for an offline install.

Leave a Reply

Your email address will not be published. Required fields are marked *