[Kubernetes] calico-node PodInitializing 대기 현상 해결
쿠버네티스 클러스터 환경에서 모든 노드의 서버를 재시작하면서 발생한 현상이다.
calico-node의 daemonset의 Init-Container가 실행되지 않고, 해당 컨테이너가 실행되는 것을 무한 대기하는 현상이 발생한 것이다.
위와 같은 현상을 겪은 Github Issue도 찾아서 확인하였고, iptables에 관하여 언급한 사람이 있어서 초기에 쿠버네티스 설정했던 네트워크 설정이 초기화가 된 것으로 추측하였다.
https://github.com/projectcalico/calico/issues/6256
Kubernetes cluster fails bringing up calico node · Issue #6256 · projectcalico/calico
Our kubernetes clusters have been failing with the below error approximately from June 22nd 3am (IST) Using Calico v3.23.1 from https://docs.projectcalico.org/manifests/calico.yaml From calico node...
github.com
그래서 쿠버네티스 Docs의 Container Runtime 부분에 나온 iptables과 관련된 설정을 다시 해주었다.
https://kubernetes.io/docs/setup/production-environment/container-runtimes/
Container Runtimes
Note: Dockershim has been removed from the Kubernetes project as of release 1.24. Read the Dockershim Removal FAQ for further details. You need to install a container runtime into each node in the cluster so that Pods can run there. This page outlines what
kubernetes.io
Docs 내 네트워크 관련 아래 명령어를 실행한 후 문제는 해결되었고, 해당 sysctl설정은 서버를 재시작하면 해제된다는 것을 알게 된 사례이다.
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
# Apply sysctl params without reboot
sudo sysctl --system