参考文献

kubeadm init error

1
2
3
4
5
6
7
8
9
10
11
12
# kubeadm init --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers'
I0814 13:18:08.628892 4337 version.go:256] remote version is much newer: v1.31.0; falling back to: stable-1.28
W0814 13:18:18.638114 4337 version.go:104] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable-1.28.txt": Get "https://cdn.dl.k8s.io/release/stable-1.28.txt": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
W0814 13:18:18.638252 4337 version.go:105] falling back to the local client version: v1.28.2
[init] Using Kubernetes version: v1.28.2
[preflight] Running pre-flight checks
[WARNING Swap]: swap is enabled; production deployments should disable swap unless testing the NodeSwap feature gate of the kubelet
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: time="2024-08-14T13:18:18+08:00" 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=...`
To see the stack trace of this error execute with --v=5 or higher
  • 解决方法

    1
    2
    3
    $ rm -f /etc/containerd/config.toml
    $ systemctl restart containerd
    $ kubeadm init
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    # cat /etc/containerd/config.toml
    # Copyright 2018-2022 Docker Inc.

    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at

    # http://www.apache.org/licenses/LICENSE-2.0

    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.

    disabled_plugins = ["cri"]

    #root = "/var/lib/containerd"
    #state = "/run/containerd"
    #subreaper = true
    #oom_score = 0

    #[grpc]
    # address = "/run/containerd/containerd.sock"
    # uid = 0
    # gid = 0

    #[debug]
    # address = "/run/containerd/debug.sock"
    # uid = 0
    # gid = 0
    # level = "info"