I did fresh install for several Ubuntu 22.04 servers with the latest (1.24.3) kubeadm, kubelet, and kubectl installed. I am also using containerd as the CRI.
The error happens when I was trying to initiate the K8s cluster by running the preflight:
# kubeadm config images pull --kubernetes-version=v1.24.3 --v=5
I0808 04:27:08.139042 475778 initconfiguration.go:117] detected and using CRI socket: unix:///var/run/containerd/containerd.sock
I0808 04:27:08.139530 475778 interface.go:432] Looking for default routes with IPv4 addresses
I0808 04:27:08.139580 475778 interface.go:437] Default route transits interface "ens160"
I0808 04:27:08.140022 475778 interface.go:209] Interface ens160 is up
I0808 04:27:08.140168 475778 interface.go:257] Interface "ens160" has 2 addresses :[10.0.1.12/8 fe80::250:56ff:fe83:e1e3/64].
I0808 04:27:08.140231 475778 interface.go:224] Checking addr 10.0.1.12/8.
I0808 04:27:08.140271 475778 interface.go:231] IP found 10.0.1.12
I0808 04:27:08.140307 475778 interface.go:263] Found valid IPv4 address 10.0.1.12 for interface "ens160".
I0808 04:27:08.140344 475778 interface.go:443] Found active IP 10.0.1.12
I0808 04:27:08.140415 475778 kubelet.go:218] the value of KubeletConfiguration.cgroupDriver is empty; setting it to "systemd"
exit status 1
output: time="2022-08-08T04:27:08Z" level=fatal msg="unable to determine image API version: rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/cri-dockerd.sock: connect: no such file or directory\""
, error
k8s.io/kubernetes/cmd/kubeadm/app/util/runtime.(*CRIRuntime).PullImage
cmd/kubeadm/app/util/runtime/runtime.go:121
k8s.io/kubernetes/cmd/kubeadm/app/cmd.PullControlPlaneImages
cmd/kubeadm/app/cmd/config.go:340
k8s.io/kubernetes/cmd/kubeadm/app/cmd.newCmdConfigImagesPull.func1
cmd/kubeadm/app/cmd/config.go:312
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).execute
vendor/github.com/spf13/cobra/command.go:856
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).ExecuteC
vendor/github.com/spf13/cobra/command.go:974
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).Execute
vendor/github.com/spf13/cobra/command.go:902
k8s.io/kubernetes/cmd/kubeadm/app.Run
cmd/kubeadm/app/kubeadm.go:50
main.main
cmd/kubeadm/kubeadm.go:25
runtime.main
/usr/local/go/src/runtime/proc.go:250
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1571
failed to pull image "k8s.gcr.io/kube-apiserver:v1.24.3"
k8s.io/kubernetes/cmd/kubeadm/app/cmd.PullControlPlaneImages
cmd/kubeadm/app/cmd/config.go:341
k8s.io/kubernetes/cmd/kubeadm/app/cmd.newCmdConfigImagesPull.func1
cmd/kubeadm/app/cmd/config.go:312
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).execute
vendor/github.com/spf13/cobra/command.go:856
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).ExecuteC
vendor/github.com/spf13/cobra/command.go:974
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).Execute
vendor/github.com/spf13/cobra/command.go:902
k8s.io/kubernetes/cmd/kubeadm/app.Run
cmd/kubeadm/app/kubeadm.go:50
main.main
cmd/kubeadm/kubeadm.go:25
runtime.main
/usr/local/go/src/runtime/proc.go:250
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1571
Obviously, the output is compaining version was not found and cri-dockerd was not found. This shouldn't be the case since I explicit specified the kube version and at the beginning of the output, and it was also be able to find the containerd at the beginning.
cri plugin has already disabled in /etc/containerd/config.toml
:
# cat /etc/containerd/config.toml|grep cri
disabled_plugins = ["cri"]
I am new to k8s so not sure what is wrong with it. I was followed the k8s doc from the beginning, not sure what is missing: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/
Best Answer
You shouldn't disable the cri plugin.
Please remove
cri
from that section then restart the containerd.And it's better to add
cri-socket
option to every kubeadm command just in case: