Profile picture

[k8s] 쿠버네티스 클러스터 생성 관련 오류 조치 및 클러스터 초기화

JaehyoJJAng2024년 01월 02일

▶︎ 클러스터 초기화

sudo kubeadm reset cleanup-node
sudo systemctl restart kubelet

▶︎ 오류 내용

1. container runtime is not running

클러스터 kubeadm init 중 CRI 에러 발생 (container runtime is not running)

master@k8s-master:/var/lib$ sudo kubeadm init --pod-network-cidr=192.168.24.0/24 --apiserver-advertise-address=192.168.219.110
[init] Using Kubernetes version: v1.27.0
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR CRI]: container runtime is not running: output: E0104 10:16:49.332510   45118 remote_runtime.go:948] "Status from runtime service failed" err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
time="2023-01-04T14:16:39Z" level=fatal msg="getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.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

아래 명령어 입력 후 init 재시도

sudo rm -rf /etc/containerd/config.toml
sudo sytemctl restart containerd

2. /var/lib/etcd is not empty

클러스터 kubeadm init중 etcd 에러 발생 (/var/lib/etcd is not empty)

master@k8s-master:/var/lib$ sudo kubeadm init --pod-network-cidr=172.24.0.0/24 --apiserver-advertise-address=192.168.219.110
[init] Using Kubernetes version: v1.27.0
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR DirAvailable--var-lib-etcd]: /var/lib/etcd is not empty
[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

etcd 저장소를 강제로 삭제 후 init 재시도

sudo rm -rf /var/lib/etcd

Loading script...