在本地VM上安装kubernetes时,sudo kubeadm init会出错

wlp8pajw  于 2023-10-17  发布在  Kubernetes
关注(0)|答案(1)|浏览(129)

我正在根据此[设置]安装主程序[1]
当在master中运行此命令时:

sudo kubeadm init --apiserver-advertise-address 192.xxx.xxx.11 --control-plane-endpoint 192.xxx.xxx.11 --v=5

我得到这个错误:

I0817 15:09:06.849300    9476 initconfiguration.go:117] detected and using CRI socket: unix:///var/run/containerd/containerd.sock
I0817 15:09:06.849676    9476 kubelet.go:196] the value of KubeletConfiguration.cgroupDriver is empty; setting it to "systemd"
I0817 15:09:06.857181    9476 version.go:187] fetching Kubernetes version from URL: https://dl.k8s.io/release/stable-1.txt
I0817 15:09:07.881888    9476 version.go:256] remote version is much newer: v1.28.0; falling back to: stable-1.27
I0817 15:09:07.882540    9476 version.go:187] fetching Kubernetes version from URL: https://dl.k8s.io/release/stable-1.27.txt
[init] Using Kubernetes version: v1.27.4
[preflight] Running pre-flight checks
I0817 15:09:08.406639    9476 checks.go:563] validating Kubernetes and kubeadm version
I0817 15:09:08.406676    9476 checks.go:168] validating if the firewall is enabled and active
I0817 15:09:08.429295    9476 checks.go:203] validating availability of port 6443
I0817 15:09:08.429943    9476 checks.go:203] validating availability of port 10259
I0817 15:09:08.430034    9476 checks.go:203] validating availability of port 10257
I0817 15:09:08.430052    9476 checks.go:280] validating the existence of file /etc/kubernetes/manifests/kube-apiserver.yaml
I0817 15:09:08.430122    9476 checks.go:280] validating the existence of file /etc/kubernetes/manifests/kube-controller-manager.yaml
I0817 15:09:08.430129    9476 checks.go:280] validating the existence of file /etc/kubernetes/manifests/kube-scheduler.yaml
I0817 15:09:08.430133    9476 checks.go:280] validating the existence of file /etc/kubernetes/manifests/etcd.yaml
I0817 15:09:08.430139    9476 checks.go:430] validating if the connectivity type is via proxy or direct
I0817 15:09:08.430158    9476 checks.go:469] validating http connectivity to first IP address in the CIDR
I0817 15:09:08.430181    9476 checks.go:469] validating http connectivity to first IP address in the CIDR
I0817 15:09:08.430187    9476 checks.go:104] validating the container runtime
I0817 15:09:08.470401    9476 checks.go:639] validating whether swap is enabled or not
I0817 15:09:08.470568    9476 checks.go:370] validating the presence of executable crictl
I0817 15:09:08.470617    9476 checks.go:370] validating the presence of executable conntrack
I0817 15:09:08.470651    9476 checks.go:370] validating the presence of executable ip
I0817 15:09:08.470687    9476 checks.go:370] validating the presence of executable iptables
I0817 15:09:08.470723    9476 checks.go:370] validating the presence of executable mount
I0817 15:09:08.470757    9476 checks.go:370] validating the presence of executable nsenter
I0817 15:09:08.470789    9476 checks.go:370] validating the presence of executable ebtables
I0817 15:09:08.470822    9476 checks.go:370] validating the presence of executable ethtool
I0817 15:09:08.471398    9476 checks.go:370] validating the presence of executable socat
I0817 15:09:08.471425    9476 checks.go:370] validating the presence of executable tc
I0817 15:09:08.471439    9476 checks.go:370] validating the presence of executable touch
I0817 15:09:08.471454    9476 checks.go:516] running all checks
I0817 15:09:08.496022    9476 checks.go:401] checking whether the given node name is valid and reachable using net.LookupHost
I0817 15:09:08.496068    9476 checks.go:605] validating kubelet version
I0817 15:09:08.591962    9476 checks.go:130] validating if the "kubelet" service is enabled and active
I0817 15:09:08.614732    9476 checks.go:203] validating availability of port 10250
I0817 15:09:08.614910    9476 checks.go:329] validating the contents of file /proc/sys/net/bridge/bridge-nf-call-iptables
I0817 15:09:08.614946    9476 checks.go:329] validating the contents of file /proc/sys/net/ipv4/ip_forward
I0817 15:09:08.614961    9476 checks.go:203] validating availability of port 2379
I0817 15:09:08.614977    9476 checks.go:203] validating availability of port 2380
I0817 15:09:08.615076    9476 checks.go:243] validating the existence and emptiness of directory /var/lib/etcd
[preflight] Some fatal errors occurred:
        [ERROR CRI]: container runtime is not running: output: time="2023-08-17T15:09:08Z" level=fatal msg="validate service connection: CRI v1 runtime API is not implemented for endpoint \"unix:///var/run/containerd/containerd.sock\": rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService"
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
error execution phase preflight
k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow.(*Runner).Run.func1
        cmd/kubeadm/app/cmd/phases/workflow/runner.go:260
k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow.(*Runner).visitAll
        cmd/kubeadm/app/cmd/phases/workflow/runner.go:446
k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow.(*Runner).Run
        cmd/kubeadm/app/cmd/phases/workflow/runner.go:232
k8s.io/kubernetes/cmd/kubeadm/app/cmd.newCmdInit.func1
        cmd/kubeadm/app/cmd/init.go:111
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:1598
docker --version
Docker version 24.0.5, build ced0996

kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.4", GitCommit:"fa3d7990104d7c1f16943a67f11b154b71f6a132", GitTreeState:"clean", BuildDate:"2023-07-19T12:19:40Z", GoVersion:"go1.20.6", Compiler:"gc", Platform:"linux/amd64"}
  [1]: https://medium.com/@mojabi.rafi/create-a-kubernetes-cluster-using-virtualbox-and-without-vagrant-90a14d791617
8wtpewkr

8wtpewkr1#

假设你有Ubuntu,显然,这是一个known issue
1.按照https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository中的说明设置Docker存储库
1.删除旧容器d:apt remove containerd
1.更新存储库数据并安装新containerd:apt update, apt install containerd.io
1.删除已安装的默认配置文件:rm /etc/containerd/config.toml
1.重新启动containerd:systemctl restart containerd

相关问题