while [ 1 ] do tun0_route=`ip route |grep -ci "100.100.80.0"` if [ $tun0_route -eq 0 ];then echo "ip route for 100.100.80.0/24 via dev tun0 is not exist, it's normal status " >> /tmp/tun0_route.log else echo "ip route for 100.100.80.0/24 via dev tun0 is exist which cause k8s imagepullbackoff error , it would be deleted" ip route delete 100.100.80.0/24 via 10.8.0.85 fi sleep 60 done
并加入开机启动 :
[root@k8s-node01 home]# cat /etc/rc.local sh /home/tun0_route_monitor.sh & > /dev/null 2>&1