• terminal使用kubectl.exe delete pod podname删不掉


    今天通过kubernetes的dashboard进行删除有问题或者重启次数太多的pod,发现删不掉,然后就在本地尝试使用terminal进行删除

    先获取指定namespace下的所有的pod,根据status与restars查看crash与重启次数太多的pod

    $ kubectl.exe get pods --namespace rubikt
    NAME                             READY   STATUS             RESTARTS   AGE
    application-55dc49b47f-tmh2q     1/1     Running            1          10d
    application-6969cd9d98-fkmsl     1/1     Running            1          50d
    appointment-774cddb446-m8pw9     1/1     Running            0          30d
    appointment-79c88c5c78-w4d2x     1/1     Running            1          50d
    config-744f9b8c8d-5vn4q          1/1     Running            8          42d
    dynamic-698c8f6857-lgsx4         1/1     Running            0          40s
    dynamic-6d4bd7748d-dc6sc         1/1     Running            0          9d
    feedback-6c76f8ff4c-zcz9g        1/1     Running            1          50d
    feedback-7d46f789b9-tqqks        1/1     Running            9          42d
    gateway-5485b8fbf-mkgmv          1/1     Running            9          42d
    gateway-86584799f-kvvsh          1/1     Running            0          50d
    hospital-74d8c8765b-lnv8w        1/1     Running            7231       50d
    hospital-8579ff984d-f8wp8        0/1     CrashLoopBackOff   343        2d6h
    message-59f877688c-cb2qb         1/1     Running            5          50d

    使用命令进行删除时,提示该pod没找到

    $ kubectl.exe delete pod render-sample-8b4b97bd9-v8p4z --force --grace-period=0
    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.
    Error from server (NotFound): pods "render-sample-8b4b97bd9-v8p4z" not found

    可能是没有找到对应的pod,所以可以通过指定namespace来进行删除

    $ kubectl.exe delete pod dynamic-698c8f6857-ngb79 --namespace=rubikt --grace-period=0 --force
    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 "dynamic-698c8f6857-ngb79" force deleted

    这样就删除了指定的pod

  • 相关阅读:
    SpringBoot系列之缓存使用教程
    Dubbo系列之常用配置用法简介
    SpringBoot系列之集成Dubbo的方式
    JavaScript系列之回调函数callback
    JavaScript系列之事件冒泡机制简介
    Oracle基础之保留字和关键字
    Oracle调优之no_unnest和unnest用法简介
    InnoSetup 以命令行自动编译打包
    InnoSetup 脚本打包及管理员权限设置
    C# 获取系统当前IE版本号
  • 原文地址:https://www.cnblogs.com/miaoying/p/11468309.html
Copyright © 2020-2023  润新知