calico: After uninstalling calico the nodes stuck in NetworkUnavailable because of CalicoIsDown
Hello. I am new to Kubernetes, so i explore various CNI plugins. Tried out calico - it works perfectly. But it seems like it cannot be removed cleanly. After i remove Installation resource and tigera-operator resources all my nodes stuck with condition NetworkUnavailable with reasons CalicoIsDown. Tried to reset an re-join nodes - no result.
Expected Behavior
I believe nodes should return into “No CNI plugin” state, and after valid configuration is provided become “Ready”.
Current Behavior
When calico and operator manifests are deleted with kubectl nodes stuck in NetworkUnavailable condition. Installing different CNI plugin does not fix the problem.
Steps to Reproduce (for bugs)
1. Deploying
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/tigera-operator.yaml
kubectl apply -f - << EOF
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
name: default
spec:
calicoNetwork:
ipPools:
- blockSize: 28
cidr: 10.10.0.0/22
encapsulation: None
natOutgoing: Disabled
nodeSelector: all()
EOF
2. Observing success
kubectl get node -o jsonpath --template='{range .items[*]}{.metadata.name}{"\n"}{range .status.conditions[*]}{"\t"}{.type}{" : "}{.status}{" -> "}{.reason}{" ("}{.message}{")"}{"\n"}{end}{end}'
kubectl get -n kube-system deployment
3. Uninstalling
kubectl delete installation default
kubectl delete -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/tigera-operator.yaml
4. Observing problem
Provide a valid CNI config of your choice Recreate coredns
kubectl delete -n kube-system pod -l k8s-app=kube-dns
kubectl get -n kube-system pod -l k8s-app=kube-dns -o custom-columns=name:.metadata.name,status:.status.phase,message:.status.conditions[*].message
kubectl get node -o jsonpath --template='{range .items[*]}{.metadata.name}{"\n"}{range .status.conditions[*]}{"\t"}{.type}{" : "}{.status}{" -> "}{.reason}{" ("}{.message}{")"}{"\n"}{end}{end}'
Note
If a toleration for ‘node.kubernetes.io/network-unavailable’ is applied on the deployment its pods are scheduled and got IPs, thus CNI is working fine. But calico causes a node condition of NetworkUnavailable and the respective taints prevent scheduling.
Your Environment
Calico: v3.26.1 Kubernetes: v1.27.3 Debian GNU/Linux 11 (bullseye) Kernel: 5.10.0-23-amd64 Containerd: 1.6.21
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 5
- Comments: 16 (5 by maintainers)
I’m was in the same boat. In case any else is interested, this is how I clean up the nodes on k3s:
Run on on one the control plane nodes This script will remove the NetworkUnavailable condition all nodes that have the condition. Requires
jqto be installedRun on all master nodes:
Run on all worker nodes
Successfully cleaned up the nodes in K8s using @boedy’s script. Just replaced env variable K3S_CONFIG with env variable K8S_ADMIN_CONFIG=“/etc/kubernetes/admin.conf” and changed the following curl command’s --cacert parameter into “/etc/kubernetes/pki/ca.crt”.
Though as said by @caseydavenport, uninstalling a CNI plugin from a cluster is a destructive operation. It’s still a bit awkward that Calico can not be removed gracefully from the cluster.