shell脚本逐个杀死k8s中某个应用的pod


#!/bin/bash

pod01=`kubectl get pod -o wide -n weifeng-system|grep official-ui-node-prod|awk -F : 'NR==1'|awk -F " " '{print $1}'`
pod02=`kubectl get pod -o wide -n weifeng-system|grep official-ui-node-prod|awk -F : 'NR==2'|awk -F " " '{print $1}'`
pod03=`kubectl get pod -o wide -n weifeng-system|grep official-ui-node-prod|awk -F : 'NR==3'|awk -F " " '{print $1}'`

kubectl delete pod $pod01  -n weifeng-system

sleep 60

kubectl delete pod $pod02  -n weifeng-system

sleep 60

kubectl delete pod $pod03  -n weifeng-system

sleep 20
 

node_prod_status=`kubectl get pod -o wide -n weifeng-system|grep official-ui-node-prod|awk -F " " '{print $3}'|grep -ci "Running"`


if [ $node_prod_status -eq 3 ];then

    echo -e "\033[32m[ the application official-ui-node-pre successfully deployed  ]\033[0m"

else
    echo -e "\033[31m\033[01m[ the application official-ui-node-pre deploy failed  ]\033[0m"

fi

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM