I'm trying to switch network plug-in from flannel to something else just for educational purposes.
The flannel had been installed via:
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
So to remowe it I'm trying to
kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
As a result I've got:
k8s@k8s-master:~$ kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": clusterroles.rbac.authorization.k8s.io "flannel" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": clusterrolebindings.rbac.authorization.k8s.io "flannel" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": serviceaccounts "flannel" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": configmaps "kube-flannel-cfg" not found
error when stopping "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": timed out waiting for the condition
It's strange cause several hours earlier I've made such operations with weave & worked fine.
I have got the similar errors in output:
kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": podsecuritypolicies.policy "psp.flannel.unprivileged" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": clusterroles.rbac.authorization.k8s.io "flannel" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": clusterrolebindings.rbac.authorization.k8s.io "flannel" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": serviceaccounts "flannel" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": configmaps "kube-flannel-cfg" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": daemonsets.apps "kube-flannel-ds-amd64" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": daemonsets.apps "kube-flannel-ds-arm64" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": daemonsets.apps "kube-flannel-ds-arm" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": daemonsets.apps "kube-flannel-ds-ppc64le" not found
Error from server (NotFound): error when deleting "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": daemonsets.apps "kube-flannel-ds-s390x" not found
Solution were to change the sequence of steps, first reinstall kubernetes environment after that redeploy flannel over broken one and only then delete it.
kubeadm reset
systemctl daemon-reload && systemctl restart kubelet
kubeadm init --pod-network-cidr=10.244.0.0/16
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Note: You may need also manually unload flannel driver which is the vxlan module:
rmmod vxlan