As you already found out, migrating Flannel to Calico, on single-node cluster, is not supported. This is due to the Flannel migration controller needs to be scheduled on node that is not currently migrating, which is impossible in single-node cluster.
This can be worked around by creating temporary second node, and scale down back to 1 after the migration is complete.
Other solution is to create a completely new cluster, install Calico, and move resources from old to new cluster.
As a last resort, you can try to uninstall Flannel manually, and install Calico over it.
Warning: All of the below may not work as intended. Doing things this way is obviously not supported by either Flannel, nor Calico. It may break, and render your cluster unusable. Try this solution in testing environment first, adjust to your env, and only then, try this on prod.
You have been warned.
- Remove Flannel with
kubectl delete -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
- SSH into your node
- Stop kubelet service
systemctl stop kubelet
- Stop containerd
systemctl stop containerd
if used as container runtime. (replace with docker if Docker Engine is used)
- Remove any CNI related directories
rm -rf /var/lib/cni
rm -rf /run/flannel
rm -rf /etc/cni
- Look for any CNI/Flannel related interfaces, and remove them
ip link
for each interface do the following
ifconfig <name of the interface from ip link> down
ip link delete <name of the interface from ip link>
- Restart container runtime
- Restart kubelet
- Install Calico as you would on a new cluster.