2022.06.07 Kubernetes flannelが起動しない

なんどやってもflannelが起動できない。。。

# kubectl get po --all-namespaces 
NAMESPACE     NAME                                     READY   STATUS             RESTARTS      AGE
kube-system   coredns-6d4b75cb6d-79vnd                 1/1     Running            0             5m32s
kube-system   coredns-6d4b75cb6d-zx9lb                 1/1     Running            0             5m32s
kube-system   etcd-linstor-master                      1/1     Running            1             5m44s
kube-system   kube-apiserver-linstor-master            1/1     Running            1             5m44s
kube-system   kube-controller-manager-linstor-master   1/1     Running            1             5m44s
kube-system   kube-flannel-ds-k8cs2                    0/1     CrashLoopBackOff   5 (45s ago)   3m50s
kube-system   kube-flannel-ds-mtf5l                    0/1     CrashLoopBackOff   5 (49s ago)   3m50s
kube-system   kube-flannel-ds-nr7tk                    0/1     CrashLoopBackOff   5 (49s ago)   3m50s
kube-system   kube-flannel-ds-q6qjl                    0/1     CrashLoopBackOff   5 (44s ago)   3m50s
kube-system   kube-proxy-gcfj4                         1/1     Running            0             5m13s
kube-system   kube-proxy-khrj7                         1/1     Running            0             5m33s
kube-system   kube-proxy-kvv2w                         1/1     Running            0             5m11s
kube-system   kube-proxy-z2lr6                         1/1     Running            0             5m11s
kube-system   kube-scheduler-linstor-master            1/1     Running            1             5m44s
# kubectl describe po kube-flannel-ds-q6qjl -n kube-system
Events:
  Type     Reason     Age                     From               Message
  ----     ------     ----                    ----               -------
  Normal   Scheduled  9m56s                   default-scheduler  Successfully assigned kube-system/kube-flannel-ds-q6qjl to linstor-node02
  Normal   Pulled     9m55s                   kubelet            Container image "rancher/mirrored-flannelcni-flannel-cni-plugin:v1.1.0" already present on machine
  Normal   Created    9m55s                   kubelet            Created container install-cni-plugin
  Normal   Started    9m55s                   kubelet            Started container install-cni-plugin
  Normal   Pulled     9m54s                   kubelet            Container image "rancher/mirrored-flannelcni-flannel:v0.18.1" already present on machine
  Normal   Created    9m54s                   kubelet            Created container install-cni
  Normal   Started    9m54s                   kubelet            Started container install-cni
  Normal   Pulled     9m6s (x4 over 9m53s)    kubelet            Container image "rancher/mirrored-flannelcni-flannel:v0.18.1" already present on machine
  Normal   Created    9m5s (x4 over 9m53s)    kubelet            Created container kube-flannel
  Normal   Started    9m5s (x4 over 9m53s)    kubelet            Started container kube-flannel
  Warning  BackOff    4m54s (x24 over 9m49s)  kubelet            Back-off restarting failed container

対応

前のバージョンのflannelを使うと起動できた。

curl -L -O https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl delete -f kube-flannel.yml
sed -i.org 's/v0.18.1$/v0.17.0/g' kube-flannel.yml
kubectl apply -f kube-flannel.yml
# diff kube-flannel.yml kube-flannel.yml.org 
182c182
<         image: rancher/mirrored-flannelcni-flannel:v0.17.0
---
>         image: rancher/mirrored-flannelcni-flannel:v0.18.1
197c197
<         image: rancher/mirrored-flannelcni-flannel:v0.17.0
---
>         image: rancher/mirrored-flannelcni-flannel:v0.18.1