kubeadm部署报错
WARNING Swap
报错信息
[WARNING Swap]: swap is enabled; production deployments should disable swap unless testing the NodeSwap feature gate of the kubelet
解决方案
执行如下命令,关闭swap
swapoff -a
container runtime is not running
报错信息
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: time="2022-05-04T16:22:53+08:00" level=fatal msg="getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
排查步骤
ps aux | grep docker | grep -v grep
root 1110 0.0 1.5 1036724 60084 ? Ssl 16:15 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
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"
原因分析
containerd进程禁用了cri模块插件
解决方案
rm -fr /etc/containerd/config.toml
systemctl restart containerd
systemctl status containerd.service
● containerd.service - containerd container runtime Loaded: loaded (/usr/lib/systemd/system/containerd.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2022-05-04 16:31:35 CST; 1min 43s ago Docs: https://containerd.io Process: 2132 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS) Main PID: 2134 (containerd) Tasks: 11 Memory: 31.5M CGroup: /system.slice/containerd.service └─2134 /usr/bin/containerd May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.854547360+08:00" level=info msg=...c.v1 May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.854744640+08:00" level=info msg=...trpc May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.854770148+08:00" level=info msg=...sock May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.854808350+08:00" level=info msg=...91s" May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.856026731+08:00" level=info msg=...ent" May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.856093747+08:00" level=info msg=...ate" May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.856167505+08:00" level=info msg=...tor" May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.857523064+08:00" level=info msg=...cer" May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.857677043+08:00" level=info msg=...cer" May 04 16:31:35 master containerd[2134]: time="2022-05-04T16:31:35.858021033+08:00" level=info msg=...ver" Hint: Some lines were ellipsized, use -l to show in full.
cat /usr/lib/systemd/system/containerd.service
[Unit] Description=containerd container runtime Documentation=https://containerd.io After=network.target local-fs.target [Service] ExecStartPre=-/sbin/modprobe overlay ExecStart=/usr/bin/containerd Type=notify Delegate=yes KillMode=process Restart=always RestartSec=5 # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNPROC=infinity LimitCORE=infinity LimitNOFILE=infinity # Comment TasksMax if your systemd version does not supports it. # Only systemd 226 and above support this version. TasksMax=infinity OOMScoreAdjust=-999 [Install] WantedBy=multi-user.target