批量把pod实例调成0

#!/bin/bash

namespace=`kubectl get ns|grep '^te-'|grep -v datamgr|awk '{print $1}'`
#---------------------------
for i in $namespace
  do
    podname=`kubectl get deploy -n $i |awk 'NR>1{if ($2>0) print $1}'`
    for j in $podname
      do
        kubectl scale --replicas=0 deployment/$j -n $i
        #echo $i  $j >> pod.txt
      done
  done
posted @ 2019-12-13 20:55  博客萨斯州  阅读(525)  评论(0编辑  收藏  举报