Score:1

How can I delete manually calicoctl and iptables created by calico from my k3s setup

ar flag

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 -

  1. Command kubectl delete -f https://raw.githubusercontent.com/aws/amazon-vpc-cni-k8s/release-1.5/config/v1.5/calico.yaml deletes the calico-node- but calico-kube-controller , calicoctl and iptables -S are still present
  2. Kubectl delete commands in this que also not working for me, after executing these two commands still calicoctl and iptables -S are present
Score:2
th flag

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.

Score:0
id flag

Here you will find a dedicated script that will remove whole calico policy. Everything you need should be in the script.

Edit: completely guide you can find here

solveit avatar
ar flag
Mikolaj-:: while running this script "sh remove-calico-policy.sh" the script goes in sleeping stage and didnt come out of that. the last line sleeping... it get stuck
solveit avatar
ar flag
Also calico-node-xxx pods and calicoctl still present after running this script
Mikołaj Głodziak avatar
id flag
Where did you run this script? Note, that you need to run it on the node. This `sleep` at the end is fine, so DaemonSet doesn't die. It works as expected. I have edited the answer and send you completely guide to remove whole calico policy.
MrValdez avatar
tk flag
The link have changed to https://github.com/projectcalico/calico/blob/master/calico/hack/remove-calico-policy/remove-calico-policy.sh and https://github.com/projectcalico/calico/tree/master/calico/hack/remove-calico-policy; respectively.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.