エラーの備忘録
概要
kubeadm + CNI: flannelでKubernetesクラスタを作成したところ、
corednsの作成がContainerCreating で固まった
[root@kube01 ~]# k get pod -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-78fcd69978-srgcc 0/1 ContainerCreating 0 114s
coredns-78fcd69978-z2kd4 0/1 ContainerCreating 0 114s
確認内容
kubectl describe でcorednsのpodを確認したところ、以下のログを確認
"/run/flannel/subnet.env: no such file or directory"
[root@kube01 ~]# k describe pod coredns-78fcd69978-srgcc -n kube-system
…
dbox: rpc error: code = Unknown desc = failed to set up sandbox container "74fc30873acfc616154b3457e3e0aa4fd1595b10f826618240ddcdee91a533b0" network for pod "coredns-78fcd69978-srgcc": networkPlugin cni failed to set up pod "coredns-78fcd69978-srgcc_kube-system" network: open /run/flannel/subnet.env: no such file or directory
解決策
flannel用の以下のファイルを作成する。
/run/flannel/subnet.env
ファイルの中身はデフォルトであればこちら。
FLANNEL_NETWORK=10.244.0.0/16
FLANNEL_SUBNET=10.244.0.1/24
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true
原因は不明ですが、ひとまず動くようになりました。