当前位置: 首页 > news >正文

rancher平台上强制删除pod服务操作

背景:

在日常paas平台运维工作中需要对rancher平台进行巡检的工作,在巡检时发现在rancher管理界面无法删除异常的pod服务,

 

处理:

像这样的情况就是k8s集群的pod无法通过默认的方式去删除掉pod服务,这时候只能是手工强制性去删除pod服务。

注:rancher平台怎么切换到kubelet命名行界面指导:

 

 

 强制删除pod服务,有两种方式:

方式一:

先查询出来需要强制删除掉pod服务,然后再执行强制删除。

查询: 

> kubectl get pods -n dit-sup  | grep Terminating
dit-sup-upload-6fd555686c-zxz9h       1/1     Terminating   0          167d

强制删除:

> kubectl delete pod dit-sup-upload-6fd555686c-zxz9h --force --grace-period=0 -n dit-sup
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "dit-sup-upload-6fd555686c-zxz9h" force deleted

方式二:

查询出来整个集群所有异常的pod服务,然后一次性全部删除掉

查询: 

> kubectl get pod -A |egrep -v "Run|Completed|Crea|NAMESPACE|NAME" |awk '{print $1,$2}'
ness-portal ness-portal-reservoir-7d8b49f6-h6xv4
default intake-project2-646df8d457-p7jlg
vwts cloud-platform-buiness-54b546577c-xlpwq

删除:

> kubectl get pod -A |egrep -v "Run|Completed|Crea|NAMESPACE|NAME" |awk '{print $1,$2}'|xargs -n2 kubectl delete pod  --grace-period=0  --force -n
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "ness-portal-reservoir-7d8b49f6-h6xv4" force deleted
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "intake-project2-646df8d457-p7jlg" force deleted
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "cloud-platform-buiness-54b546577c-xlpwq" force deleted

 验证:

> kubectl get pod -A |egrep -v "Run|Completed|Crea|NAMESPACE|NAME" |awk '{print $1,$2}'

总结:

在日常的paas平台运维工作,会经常遇见大量的pod运行异常的情况,也存在对pod服务进行强制删除的操作,可以参考如上的。

http://www.lryc.cn/news/96843.html

相关文章:

  • 【Docker】Docker的通信安全
  • c# 函数中可选参数太多,想设置最后一个参数,又不想修改前面默认参数
  • openvino资料(1)
  • 第71篇:某银行外网打点到内网核心区红队评估复盘
  • 网络安全 Day21-数据库知识
  • python测试开发面试常考题:装饰器
  • 语音同声翻译软件让你不再为语言障碍困扰
  • 又有一个手艺人震惊了B站用户
  • HDFS的设计目标和重要特性
  • 【JMeter】JMeter添加插件
  • 测牛学堂:车载测试面试总结之语音助手相关
  • Android开发之Fragment动态添加与管理
  • Python爬虫+数据可视化:分析唯品会商品数据
  • el-tree数据渲染超出省略
  • 若依vue -【 44】
  • React 基础篇(一)
  • Bean 的作用域和生命周期
  • STP和MTP(第二十二课)
  • Java-WebSocket
  • elementui的el-date-picker选择日期范围第二个不能早于第一个
  • 【NLP】无服务器问答系统
  • Dubbo
  • Java设计模式之策略(Strategy)模式
  • Vue引入CDN JS或本地JS文件之后 使用报错
  • NRF52832-扩展广播
  • springboot项目新增子module
  • Python Web 开发及 Django 总结
  • 《向量数据库指南》:向量数据库Pinecone故障排除
  • [86] 分割链表
  • 【python】 清空socket缓冲区