0
内のプロセスを殺す私はKuberntesポッド
: ${DELAY:=30}
if [ "$#" -ne 1 ]; then
echo "One argument expected specifying the time in seconds to run"
else
end=$((SECONDS+$1))
while [ $SECONDS -lt $end ]; do
kubectl \
-o 'jsonpath={.items[*].metadata.name}' \
get pods | \
tr " " "\n" | \
shuf | \
head -n 1 |
#xargs -t --no-run-if-empty \
kubectl exec $(head -n 1) -- kill -9 9
#if [ $((SECONDS+${DELAY})) -lt $end ];then #break loop if (seconds completed + delay) is greater than time specified in argument
# sleep "${DELAY}" #sleep so that pod gets completely deleted and a terminating pod not selecte
#else
# break
#fi
done
fi
ランダムポッド内のプロセスを殺すために、次のコードを使用していたスクリプトが実行されますが、それはいくつかの無限ループに入るのように何も出力が表示されません。誰かが私が間違っている場所を助けることができますか?
ありがとうございます:)これを試してみましょう! –