(如果这是一个愚蠢的问题,请原谅...)
chuck@k8smaster:~$ sudo systemctl status crio
● crio.service - Container Runtime Interface for OCI (CRI-O)
Loaded: loaded (/lib/systemd/system/crio.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-12-16 15:36:06 UTC; 28min ago
Docs: https://github.com/cri-o/cri-o
Main PID: 955 (crio)
Tasks: 25
Memory: 59.1M
CPU: 563ms
CGroup: /system.slice/crio.service
└─955 /usr/bin/crio
chuck@k8smaster:~$ sudo kubeadm init --pod-network-cidr=192.168.2.0/16
Found multiple CRI endpoints on the host. Please define which one do you wish to use by setting the 'criSocket' field in the kubeadm configuration file: unix:///var/run/containerd/containerd.sock, unix:///var/run/crio/crio.sock
To see the stack trace of this error execute with --v=5 or higher
chuck@k8smaster:~$ sudo kubeadm init --pod-network-cidr=192.168.2.0/16 --v=5
Found multiple CRI endpoints on the host. Please define which one do you wish to use by setting the 'criSocket' field in the kubeadm configuration file: unix:///var/run/containerd/containerd.sock, unix:///var/run/crio/crio.sock
k8s.io/kubernetes/cmd/kubeadm/app/util/runtime.detectCRISocketImpl
cmd/kubeadm/app/util/runtime/runtime.go:166
k8s.io/kubernetes/cmd/kubeadm/app/util/runtime.DetectCRISocket
cmd/kubeadm/app/util/runtime/runtime.go:174
k8s.io/kubernetes/cmd/kubeadm/app/util/config.SetNodeRegistrationDynamicDefaults
cmd/kubeadm/app/util/config/initconfiguration.go:112
k8s.io/kubernetes/cmd/kubeadm/app/util/config.SetInitDynamicDefaults
cmd/kubeadm/app/util/config/initconfiguration.go:63
k8s.io/kubernetes/cmd/kubeadm/app/util/config.DefaultedInitConfiguration
cmd/kubeadm/app/util/config/initconfiguration.go:242
k8s.io/kubernetes/cmd/kubeadm/app/util/config.LoadOrDefaultInitConfiguration
cmd/kubeadm/app/util/config/initconfiguration.go:276
k8s.io/kubernetes/cmd/kubeadm/app/cmd.newInitData
cmd/kubeadm/app/cmd/init.go:300
k8s.io/kubernetes/cmd/kubeadm/app/cmd.newCmdInit.func3
cmd/kubeadm/app/cmd/init.go:153
k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow.(*Runner).InitData
cmd/kubeadm/app/cmd/phases/workflow/runner.go:183
k8s.io/kubernetes/cmd/kubeadm/app/cmd.newCmdInit.func1
cmd/kubeadm/app/cmd/init.go:104
github.com/spf13/cobra.(*Command).execute
vendor/github.com/spf13/cobra/command.go:916
github.com/spf13/cobra.(*Command).ExecuteC
vendor/github.com/spf13/cobra/command.go:1040
github.com/spf13/cobra.(*Command).Execute
vendor/github.com/spf13/cobra/command.go:968
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:1594
chuck@k8smaster:~$ sudo kubeadm init --pod-network-cidr=192.168.2.0/16 --cri-socket=unix:///var/run/cri-dockerd.sock
[sudo] password for chuck:
[init] Using Kubernetes version: v1.26.0
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: time="2022-12-16T16:25:36Z" level=fatal msg="unable to determine runtime 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: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
chuck@k8smaster:~$ sudo kubeadm init --pod-network-cidr=192.168.2.0/16
Found multiple CRI endpoints on the host. Please define which one do you wish to use by setting the 'criSocket' field in the kubeadm configuration file: unix:///var/run/containerd/containerd.sock, unix:///var/run/crio/crio.sock
To see the stack trace of this error execute with --v=5 or higher
答案1
此错误表明您已安装 containerd 和 CRI 作为运行时,但只能使用其中一个。如果您想使用 CRI,请卸载 containerd
apt-get purge containerd