<p>I have a <code>k3s</code> cluster that have system pods with <code>calico</code> policy applied:</p>
<pre><code>kube-system   pod/calico-node-xxxx                          
kube-system   pod/calico-kube-controllers-xxxxxx   
kube-system   pod/metrics-server-xxxxx
kube-system   pod/local-path-provisioner-xxxxx
kube-system   pod/coredns-xxxxx
app-system    pod/my-app-xxxx
</code></pre>
<p>I ran <a href="https://rancher.com/docs/k3s/latest/en/upgrades/killall/" rel="nofollow noreferrer">/usr/local/bin/k3s-killall.sh</a> to clean up containers and networks. Will this clean/remove/reset my calico networking also? (though after <code>killall.sh</code> the iptables of calico still present)</p>
<p><strong>Quoting from the killall.sh link:</strong></p>
<blockquote>
<p>The killall script cleans up containers, K3s directories, and networking components while also removing the iptables chain with all the associated rules.</p>
</blockquote>
<p>It says that networking component will also be cleaned up though but is it kubernetes networking or any networking applied to cluster?</p>

solveit
<p>When you install <code>k3s</code> based on the instructions <a href="https://rancher.com/docs/k3s/latest/en/installation/install-options/" rel="nofollow noreferrer">here</a> it won't install Calico CNI by default. There is a need to install Calico CNI <a href="https://docs.projectcalico.org/getting-started/kubernetes/k3s/quickstart" rel="nofollow noreferrer">separately</a>.</p>
<p>To answer you question, let's analyse <code>/usr/local/bin/k3s-killall.sh</code> file, especially the part with <code>iptables</code> command:</p>
<pre><code>...
iptables-save | grep -v KUBE- | grep -v CNI- | iptables-restore
</code></pre>
<p>As can see, this command only removes <code>iptables</code> <a href="https://unix.stackexchange.com/questions/506729/what-is-a-chain-in-iptables">chains</a> starting with <code>KUBE</code> or <code>CNI</code>.</p>
<p>If you run command <code>iptables -S</code> on cluster setup with <code>k3s</code> and Calico CNI you can see that chains used by Calico are starting with <code>cali-</code>:</p>
<pre><code> iptables -S
-A cali-FORWARD -m comment --comment &quot;cali:vjrMJCRpqwy5oRoX&quot; -j MARK --set-xmark 0x0/0xe0000
-A cali-FORWARD -m comment --comment &quot;cali:A_sPAO0mcxbT9mOV&quot; -m mark --mark 0x0/0x10000 -j cali-from-hep-forward
...
</code></pre>
<p>Briefly answering your questions:</p>
<blockquote>
<p>I ran <a href="https://rancher.com/docs/k3s/latest/en/upgrades/killall/" rel="nofollow noreferrer">/usr/local/bin/k3s-killall.sh</a> to clean up containers and networks. Will this clean/remove/reset my calico networking also ?</p>
</blockquote>
<p>No. There will be still some of Calico CNI components for example earlier mentioned <code>iptables</code> chains but also network interfaces:</p>
<pre><code> ip addr
 6: calicd9e5f8ac65@if4: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt;
 7: cali6fcd2eeafde@if4: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt;
 ...
</code></pre>
<blockquote>
<p>It says that networking component will also be cleaned up though, but is it kubernetes networking or any networking applied to cluster ?</p>
</blockquote>
<p>Those are network components provided by <code>k3s</code> by default like earlier mentioned <code>KUBE-</code> and <code>CNI-</code> <code>iptables</code> chains. To get more information what exatcly <code>k3s-killall.sh</code> script does, I'd recommend reading it's <a href="https://get.k3s.io/" rel="nofollow noreferrer">code</a> (<code>k3s-killall.sh</code> script starting from <code># --- create killall script ---</code>, line 575).</p>
