码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2019-01-11 14:44:22      阅读:387      评论:0      收藏:0      [点我收藏+]

标签:$1   app   ica   shel   shell脚本   gre   led   status   awk   

#!/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

  

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

标签:$1   app   ica   shel   shell脚本   gre   led   status   awk   

原文地址:https://www.cnblogs.com/weifeng1463/p/10254951.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!