• 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

  • 相关阅读:
    浅谈树的重心
    倍增的奇妙用处
    KMP——从入门到不会打题
    万能的进制哈希
    浅谈扫描线算法的应用
    无需Flash录视频——HTML5中级进阶
    一个模仿微信群聊的H5页面
    关于建议
    前端技术学习线路
    Kurento安装与入门02——运行示例前的准备
  • 原文地址:https://www.cnblogs.com/miaoying/p/11468309.html
Copyright © 2020-2023  润新知