1

I'm trying to build kubernetes with containerd in bare-metal server (RHEL8).

There's no Internet connection so I manually downloaded needed images (e.g. k8s.gcr.io/kube-scheduler:v1.22.1) and loaded them using "ctr image import".

The images seem to be loaded successfully.

#ctr images ls -q
k8s.gcr.io/coredns/coredns:v1.8.4
k8s.gcr.io/etcd:3.5.0-0
k8s.gcr.io/kube-apiserver:v1.22.1
k8s.gcr.io/kube-controller-manager:v1.22.1
k8s.gcr.io/kube-proxy:v1.22.1
k8s.gcr.io/kube-scheduler:v1.22.1
k8s.gcr.io/pause:3.5

Then I executed "kubeadm init" but it failed with ImagePull errors.

#kubeadm init --kubernetes-version=1.22.1 --cri-socket=/run/containerd/containerd.sock
[init] Using Kubernetes version: v1.22.1
[preflight] Running pre-flight checks
        [WARNING FileExisting-tc]: tc not found in system path
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
error execution phase preflight: [preflight] Some fatal errors occurred:

How can I let kubeadm to use local images? Or is it OK to ignore these preflight errors?

Edit: This procedure (manually loading images instead of executing kubeadm config images pull) worked well when with docker and CentOS7.

Daigo
  • 343
  • 7
  • 20

2 Answers2

2

It turned out that I had to load images to the k8s.io namespace of the containerd so that Kubernetes can recognize them. I was importing the images to the wrong namespace (default).

ctr -n k8s.io images import xxx.tar
...

After loading all the images that Kubernetes needs, kubeadm init worked well without executing
kubeadm config images pull. The images that Kubernetes can use are shown in
ctr -n k8s.io images ls or crictl images.

# crictl images
IMAGE                                                          TAG                 IMAGE ID            SIZE
k8s.gcr.io/coredns/coredns                                     v1.8.4              8d147537fb7d1       47.7MB
k8s.gcr.io/etcd                                                3.5.0-0             0048118155842       296MB
k8s.gcr.io/kube-apiserver                                      v1.22.1             f30469a2491a5       130MB
k8s.gcr.io/kube-controller-manager                             v1.22.1             6e002eb89a881       123MB
k8s.gcr.io/kube-proxy                                          v1.22.1             36c4ebbc9d979       105MB
k8s.gcr.io/kube-scheduler                                      v1.22.1             aca5ededae9c8       53.9MB
k8s.gcr.io/pause                                               3.5                 ed210e3e4a5ba       686kB
Daigo
  • 343
  • 7
  • 20
1

To manually pull the images execute the following:

kubeadm config images list
kubeadm config images pull

There is also a section for running kubeadm without an internet connection in the Kubernetes docs.

F1ko
  • 131
  • 2
  • Actually I wanted to do that but there’s no Internet connection. With docker and CentOS7, I successfully installed kubernetes using the same procedure. – Daigo Oct 03 '21 at 11:37