[root@k8s-master ~]# kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
nginx-86c57db685-2nrfp   1/1     Running   0          48m
nginx3-bc84fb766-vh8v5   1/1     Running   0          46m

现在我想删除nginx

先删除deployment:

查询:
[root@k8s-master ~]# kubectl get deployment
NAME     READY   UP-TO-DATE   AVAILABLE   AGE
nginx    1/1     1            1           49m
nginx3   1/1     1            1           46m
删除
[root@k8s-master ~]# kubectl delete deployment nginx
deployment.apps "nginx" delete

再次查看:

[root@k8s-master ~]# kubectl get deployment
NAME     READY   UP-TO-DATE   AVAILABLE   AGE
nginx3   1/1     1            1           48m
[root@k8s-master ~]# kubectl get rs
NAME               DESIRED   CURRENT   READY   AGE
nginx3-bc84fb766   1         1         1       49m
[root@k8s-master ~]# kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
nginx3-bc84fb766-vh8v5   1/1     Running   0          49m

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐