32
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

k8sでEvictedされたpodを一括削除する

Last updated at Posted at 2019-01-26

EKS等を使用していて、EC2のインスタンスtypeをケチってしまった場合に、nodeのリソースが足りず、podがガンガンEvictedされてはpodが再起動されるという。

で、Evitedされたpodが大量でちまちま消してらんないのでワンライナー探しててあった
https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d

いっぱいありますが、コレ使いました

kubectl get pods | awk '{if ($3 ~ /Evicted/) system ("kubectl delete pods " $1)}'

まずは、ちゃんとnodeのリソースとそれに見合ったインスタンスtypeを選びましょう

32
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?