我有 iptables 从cali-
root@Ubuntu-18-VM:~# iptables -S | grep -oP '(?<!^:)cali-[^ ]+'
cali-FORWARD
cali-INPUT
cali-OUTPUT
cali-cidr-block
cali-from-hep-forward
cali-from-host-endpoint
cali-from-wl-dispatch
cali-from-wl-dispatch-5
cali-fw-cali2847b154969
cali-fw-cali4bb24809f90
cali-fw-cali531f8f2e712
cali-fw-cali5a82b3ff301
cali-pri-_CVSZITRyIpEmH8AB6H
cali-pri-_HayIXLB85hzHkIhWER
cali-pri-_PTRGc0U-L5Kz7V6ERW
cali-pri-_u2Tn2rSoAPffvE7JO6
cali-pri-kns.kube-system
cali-pro-_CVSZITRyIpEmH8AB6H
cali-pro-_HayIXLB85hzHkIhWER
cali-pro-_PTRGc0U-L5Kz7V6ERW
cali-pro-_u2Tn2rSoAPffvE7JO6
cali-pro-kns.kube-system
cali-to-hep-forward
cali-to-host-endpoint
cali-to-wl-dispatch
cali-to-wl-dispatch-5
cali-tw-cali2847b154969
cali-tw-cali4bb24809f90
cali-tw-cali531f8f2e712
cali-tw-cali5a82b3ff301
cali-wl-to-host
我怎样才能删除这 31 个 iptables?在 grep 之后我应该添加什么删除命令,以便该iptables -S
命令不显示cali-
iptables?
答案1
删除 calico-Iptables:
使用calico 政策并在脚本末尾添加以下几行:
echo "Flush remaining calico iptables"
iptables-save | grep -i cali | iptables -F
echo "Delete remaining calico iptables"
iptables-save | grep -i cali | iptables -X
当你使用以下命令检查时,这将删除所有 calico iptablesiptables -S
笔记:仅在卸载 K3S 后运行此脚本。
删除 calicoctl:
只需运行sudo rm $(which calicoctl)
命令,它就会找到并删除 calicoctl。