Problem Summary
CoreDNS pods intermittently restart and fail to create pod sandboxes due to missing Flannel subnet.env file:
failed to setup network for sandbox: plugin type="flannel" failed (add):
failed to load flannel 'subnet.env' file:
open /run/flannel/subnet.env: no such file or directory
The first time setting up was normal but until i reboot the server the restart count always +1. Upon further checking i have found out that core dns has a FailedCreatePodSandBox due to flannel subnet.env race condition
" Warning FailedCreatePodSandBox 4m3s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "86d70ca0ff96f046000ccc39d3d59ae893ce7bbce48f7b1a516c83f3d31fdfcf": plugin type="flannel" failed (add): failed to load flannel 'subnet.env' file: open /run/flannel/subnet.env: no such file or directory. Check the flannel pod log for this node.
"
root@samywj:/home/k8s# kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-flannel kube-flannel-ds-snv4l 1/1 Running 5 (17m ago) 70m
kube-system coredns-7d764666f9-d62dz 1/1 Running 5 (17m ago) 72m
kube-system coredns-7d764666f9-f8n44 1/1 Running 5 (17m ago) 72m
kube-system etcd-samywj 1/1 Running 5 (17m ago) 72m
kube-system kube-apiserver-samywj 1/1 Running 5 (17m ago) 72m
kube-system kube-controller-manager-samywj 1/1 Running 5 (17m ago) 72m
kube-system kube-proxy-9vpl5 1/1 Running 5 (17m ago) 72m
kube-system kube-scheduler-samywj 1/1 Running 5 (17m ago) 72m
My goal is to keep the restart at 0 at all times. I have no idea how to solve this issue. Would be great if anyone has stumble upon this bug/problem
Ubuntu 24.04
Client Version: v1.35.4
Kustomize Version: v5.7.1
Server Version: v1.35.4
FLANNEL CNI (NEWEST VERSION)
Problem Summary
CoreDNS pods intermittently restart and fail to create pod sandboxes due to missing Flannel subnet.env file:
failed to setup network for sandbox: plugin type="flannel" failed (add):
failed to load flannel 'subnet.env' file:
open /run/flannel/subnet.env: no such file or directory
The first time setting up was normal but until i reboot the server the restart count always +1. Upon further checking i have found out that core dns has a FailedCreatePodSandBox due to flannel subnet.env race condition
" Warning FailedCreatePodSandBox 4m3s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "86d70ca0ff96f046000ccc39d3d59ae893ce7bbce48f7b1a516c83f3d31fdfcf": plugin type="flannel" failed (add): failed to load flannel 'subnet.env' file: open /run/flannel/subnet.env: no such file or directory. Check the flannel pod log for this node.
"
root@samywj:/home/k8s# kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-flannel kube-flannel-ds-snv4l 1/1 Running 5 (17m ago) 70m
kube-system coredns-7d764666f9-d62dz 1/1 Running 5 (17m ago) 72m
kube-system coredns-7d764666f9-f8n44 1/1 Running 5 (17m ago) 72m
kube-system etcd-samywj 1/1 Running 5 (17m ago) 72m
kube-system kube-apiserver-samywj 1/1 Running 5 (17m ago) 72m
kube-system kube-controller-manager-samywj 1/1 Running 5 (17m ago) 72m
kube-system kube-proxy-9vpl5 1/1 Running 5 (17m ago) 72m
kube-system kube-scheduler-samywj 1/1 Running 5 (17m ago) 72m
My goal is to keep the restart at 0 at all times. I have no idea how to solve this issue. Would be great if anyone has stumble upon this bug/problem
Ubuntu 24.04
Client Version: v1.35.4
Kustomize Version: v5.7.1
Server Version: v1.35.4
FLANNEL CNI (NEWEST VERSION)