(持續更新) k8s日常操作命令

2020-08-10 16:16:21
  1. 批次清理遭驅趕(status: Evicted)的Pods
    $ kubectl get pods [-n 可指定名稱空間] | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
    # xargs: http://www.ruanyifeng.com/blog/2019/08/xargs-tutorial.html
    # 這裏的作用是將|管道左側輸出內容,將空行轉爲空格,繼而轉成參數傳入到xargs命令後,後半段類似於: kubectl delete pods a1 a2 a3