From f01baba4a92f5e8f70399ca97f7ed3ead997c84a Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Thu, 19 Oct 2023 19:47:39 +0300 Subject: [PATCH 1/3] remove pod-manifests dir in killall script Signed-off-by: galal-hussein --- bundle/bin/rke2-killall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle/bin/rke2-killall.sh b/bundle/bin/rke2-killall.sh index 3f3e3bb3f8..ac5784b488 100755 --- a/bundle/bin/rke2-killall.sh +++ b/bundle/bin/rke2-killall.sh @@ -89,7 +89,7 @@ if [ -d /sys/class/net/nodelocaldns ]; then ip link delete nodelocaldns fi -rm -rf /var/lib/cni/ /var/log/pods/ /var/log/containers +rm -rf /var/lib/cni/ /var/log/pods/ /var/log/containers /var/lib/rancher/rke2/agent/pod-manifests # Delete iptables created by CNI plugins or Kubernetes (kube-proxy) iptables-save | grep -v KUBE- | grep -v CNI- | grep -v cali- | grep -v cali: | grep -v CILIUM_ | grep -v flannel | iptables-restore From b0352f079c2663d9b8bdbef7fca29c8259cb9c80 Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Thu, 19 Oct 2023 20:41:21 +0300 Subject: [PATCH 2/3] remove pod-manifests dir in killall script Signed-off-by: galal-hussein --- bundle/bin/rke2-killall.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundle/bin/rke2-killall.sh b/bundle/bin/rke2-killall.sh index ac5784b488..111034c050 100755 --- a/bundle/bin/rke2-killall.sh +++ b/bundle/bin/rke2-killall.sh @@ -89,7 +89,8 @@ if [ -d /sys/class/net/nodelocaldns ]; then ip link delete nodelocaldns fi -rm -rf /var/lib/cni/ /var/log/pods/ /var/log/containers /var/lib/rancher/rke2/agent/pod-manifests +rm -rf /var/lib/cni/ /var/log/pods/ /var/log/containers +grep -rl "tier: control-plane" /var/lib/rancher/rke2/agent/pod-manifests/ | while read MANIFEST; do rm -f $MANIFEST; done # Delete iptables created by CNI plugins or Kubernetes (kube-proxy) iptables-save | grep -v KUBE- | grep -v CNI- | grep -v cali- | grep -v cali: | grep -v CILIUM_ | grep -v flannel | iptables-restore From 88edca38df274147d2cc6a8a8a47d99c2ba9fd5b Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Thu, 19 Oct 2023 21:35:49 +0300 Subject: [PATCH 3/3] remove pod-manifests dir in killall script Signed-off-by: galal-hussein --- bundle/bin/rke2-killall.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bundle/bin/rke2-killall.sh b/bundle/bin/rke2-killall.sh index 111034c050..ce92b58ede 100755 --- a/bundle/bin/rke2-killall.sh +++ b/bundle/bin/rke2-killall.sh @@ -90,7 +90,16 @@ if [ -d /sys/class/net/nodelocaldns ]; then fi rm -rf /var/lib/cni/ /var/log/pods/ /var/log/containers -grep -rl "tier: control-plane" /var/lib/rancher/rke2/agent/pod-manifests/ | while read MANIFEST; do rm -f $MANIFEST; done + +# Remove pod-manifests files for rke2 components +POD_MANIFESTS_DIR=/var/lib/rancher/rke2/agent/pod-manifests + +rm -f ${POD_MANIFESTS_DIR}/etcd.yaml \ + ${POD_MANIFESTS_DIR}/kube-apiserver.yaml \ + ${POD_MANIFESTS_DIR}/kube-controller-manager.yaml \ + ${POD_MANIFESTS_DIR}/cloud-controller-manager.yaml\ + ${POD_MANIFESTS_DIR}/kube-scheduler.yaml \ + ${POD_MANIFESTS_DIR}/kube-proxy.yaml # Delete iptables created by CNI plugins or Kubernetes (kube-proxy) iptables-save | grep -v KUBE- | grep -v CNI- | grep -v cali- | grep -v cali: | grep -v CILIUM_ | grep -v flannel | iptables-restore