k8s集群中刪除pod:
找到pod的命名空間然后根據命名空間刪除pod
1、先刪除pod 2、再刪除對應的deployment 否則只是刪除pod是不管用的,還會看到pod,因為deployment.yaml文件中定義了副本數量 實例如下: 刪除pod [root@test2 ~]# kubectl get pod -n jenkins NAME READY STATUS RESTARTS AGE jenkins2-8698b5449c-grbdm 1/1 Running 0 8s [root@test2 ~]# kubectl delete pod jenkins2-8698b5449c-grbdm -n jenkins pod "jenkins2-8698b5449c-grbdm" deleted 查看pod仍然存儲 [root@test2 ~]# kubectl get pod -n jenkins NAME READY STATUS RESTARTS AGE jenkins2-8698b5449c-dbqqb 1/1 Running 0 8s [root@test2 ~]# 刪除deployment [root@test2 ~]# kubectl get deployment -n jenkins NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE jenkins2 1 1 1 1 17h [root@test2 ~]# kubectl delete deployment jenkins2 -n jenkins 再次查看pod消失 deployment.extensions "jenkins2" deleted [root@test2 ~]# kubectl get deployment -n jenkins No resources found. [root@test2 ~]# [root@test2 ~]# kubectl get pod -n jenkins No resources found.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
1. 查看deployment 2.刪除指定的deployment
k8s集群上刪除service:
先找到service的命名空間,然后根據命名空間刪除