How can I delete manually calicoctl and iptables created by calico from my k3s setup
I have a K3s setup with calico pods [calico-node-
& calico-kube-controllers-
] running. On uninstalling K3s, calico pods get deleted but I see that calicoctl
and iptables -S
commands still running and shows data.
I want to delete calico (including calicoctl and Iptables created by calico) completely. Which commands will help me to do so ?
K3s uninstalltion command: /usr/local/bin/k3s-uninstall.sh
deletes all k3s pods including calico, but calicoctl
and iptables -S
still works.
PS: I already tried few things -
- Command
kubectl delete -f https://raw.githubusercontent.com/aws/amazon-vpc-cni-k8s/release-1.5/config/v1.5/calico.yaml
deletes thecalico-node-
butcalico-kube-controller
,calicoctl
andiptables -S
are still present -
Kubectl delete
commands in this que also not working for me, after executing these two commands stillcalicoctl
andiptables -S
are present
Solution 1:
Deleting calico-Iptables:
Use calico-policy and add below lines at the end of script:
echo "Flush remaining calico iptables"
iptables-save | grep -i cali | iptables -F
echo "Delete remaining calico iptables"
iptables-save | grep -i cali | iptables -X
This will delete all calico iptables when you check with iptables -S
Note: Run this script only after uninstalling K3S.
Deleting calicoctl:
Simply run sudo rm $(which calicoctl)
command, it will find and delete the calicoctl.