kubernetes 无法验证kubelet标志:容器运行时端点地址未指定或为空,请使用--container-runtime-endpoint设置[closed]

tp5buhyn  于 2023-01-20  发布在  Kubernetes
关注(0)|答案(1)|浏览(4335)

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题有关,您可以留下评论,说明在何处可以回答此问题。
3天前关闭。
Improve this question
我正在尝试设置Kubernetes主节点。每次尝试启动Kubelet时,我都会收到错误消息:

command failed" err="failed to validate kubelet flags: the container runtime endpoint address was not specified or empty, use --container-runtime-endpoint to set

我尝试使用以下命令设置容器运行时端点:

sudo kubelet --container-runtime-endpoint=unix:///run/containerd/containerd.sock

但当我这样做时,我会得到以下包含失败命令的日志:

I0116 09:43:02.562785    4142 server.go:412] "Kubelet version" kubeletVersion="v1.26.0"
I0116 09:43:02.563067    4142 server.go:414] "Golang settings" GOGC="" GOMAXPROCS="" GOTRACEBACK=""
I0116 09:43:02.563458    4142 server.go:575] "Standalone mode, no API client"
I0116 09:43:02.566523    4142 server.go:463] "No api server defined - no events will be sent to API server"
I0116 09:43:02.566664    4142 server.go:659] "--cgroups-per-qos enabled, but --cgroup-root was not specified.  defaulting to /"
I0116 09:43:02.567002    4142 container_manager_linux.go:267] "Container manager verified user specified cgroup-root exists" cgroupRoot=[]
I0116 09:43:02.567130    4142 container_manager_linux.go:272] "Creating Container Manager object based on Node Config" nodeConfig={RuntimeCgroupsName: SystemCgroupsName: KubeletCgroupsName: KubeletOOMScoreAdj:-999 ContainerRuntime: CgroupsPerQOS:true CgroupRoot:/ CgroupDriver:cgroupfs KubeletRootDir:/var/lib/kubelet ProtectKernelDefaults:false NodeAllocatableConfig:{KubeReservedCgroupName: SystemReservedCgroupName: ReservedSystemCPUs: EnforceNodeAllocatable:map[pods:{}] KubeReserved:map[] SystemReserved:map[] HardEvictionThresholds:[]} QOSReserved:map[] CPUManagerPolicy:none CPUManagerPolicyOptions:map[] ExperimentalTopologyManagerScope:container CPUManagerReconcilePeriod:10s ExperimentalMemoryManagerPolicy:None ExperimentalMemoryManagerReservedMemory:[] ExperimentalPodPidsLimit:-1 EnforceCPULimits:true CPUCFSQuotaPeriod:100ms ExperimentalTopologyManagerPolicy:none ExperimentalTopologyManagerPolicyOptions:map[]}
I0116 09:43:02.567232    4142 topology_manager.go:134] "Creating topology manager with policy per scope" topologyPolicyName="none" topologyScopeName="container"
I0116 09:43:02.567305    4142 container_manager_linux.go:308] "Creating device plugin manager"
I0116 09:43:02.567449    4142 state_mem.go:36] "Initialized new in-memory state store"
E0116 09:43:02.570133    4142 run.go:74] "command failed" err="failed to run Kubelet: validate service connection: CRI v1 runtime API is not implemented for endpoint \"unix:///run/containerd/containerd.sock\": rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService"

有人能帮我吗?
我已经尝试过重新设置kubeadm,因为我在一个论坛上看到可能会导致这个问题。这并没有解决我的问题。除此之外,我看到回到旧版本的Kubernetes将工作。但我没有尝试。我想使用版本1.26,这是最新的。我无法想象Kubernetes使一个版本的containerd不工作。那么在哪里修复?

jogvjijk

jogvjijk1#

看起来您遇到了在K8s 1.26中删除CRI v1alpha2 API和containerd 1.5支持的问题。

    • 可能的解决方法:**

你可以通过移除Ubuntu自带的containerd软件包并从docker仓库安装www.example.com软件包来解决这个问题。然后你会得到一个1.6版本。然后重新生成container的配置,包括组更改,并在1.25 - 05上重新启动。然后你就可以完成到1.26的升级了。containerd.io package from docker repositories. Then you get a 1.6 release. Then re-generate the container's config including the group changes and restart on 1.25-05. Then you are able to complete the upgrade to 1.26.
从那时起,这是一个简单的做发布升级到最新的ubuntu。

    • 1)**在Docker repos中,有containerd 1.6和更高版本的软件包。因此,您也可以添加Docker repos,并从那里安装www.example.com:containerd.io from there:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install containerd.io
    • 2)**通过下载和替换二进制文件,手动将containerd升级到1.6或更高版本
wget https://github.com/containerd/containerd/releases/download/v1.6.12/containerd-1.6.12-linux-amd64.tar.gz
tar xvf containerd-1.6.12-linux-amd64.tar.gz
systemctl stop containerd
cd bin
cp * /usr/bin/
systemctl start containerd
    • 3)**上面链接中列出的版本-运行较旧版本的kubelet(1.25)
apt remove --purge kubelet
apt install -y kubeadm kubelet=1.25.5-00

请通过类似的ServerFault Answers了解详细的分步srep信息。

    • 编辑:**
    • 4)提供第三方替代产品cri-dockerd。cri-dockerd适配器允许您通过容器运行时接口**使用Docker引擎。

如果你已经在使用cri-dockerd,你不会受到dockershim删除的影响。在开始之前,Check whether your nodes use the dockershim.

相关问题