Ubuntu Server 22.04.2 LTS (64-bit)でKubeadm initしたときにでたエラーをChatGPTに相談して解決したときのメモです。
Raspberry Pi 4にUbuntu Server 22.04.2 LTS (64-bit)をインストールして、そこにDocker, Kubernetes周りの設定をした。
インストール自体はこの記事を参考にして実行した。
https://future-architect.github.io/articles/20220908a/
そして、kubeadm init
するときにエラーが出た
tawachan@tawaberry-4a:~$ sudo kubeadm init
[sudo] password for tawachan:
[init] Using Kubernetes version: v1.27.4
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: time="2023-07-28T22:34:16+09: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
ChatGPTに聞いたところ、/etc/containerd/config.toml
が怪しいと指摘される。
tawachan@tawaberry-4a:~$ 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"
この内容を教えたら次の回答を得た。
エラーの原因は、設定ファイル/etc/containerd/config.tomlにてcriプラグインが無効化されていることで、これはKubernetesが動作するために必要なコンポーネントです。したがって、それを有効化するために次の手順を試してみてください。
disabled_plugins = ["cri"]
この箇所を削除したら無事に動いた。
ChatGPTのおかげで、個別環境に合わせて応答してくれるからとても助かった。