k8s删除服务(1)

1、查看命名空间

kubectl get all -n kube-system

2、显示

NAME                                                            READY   STATUS    RESTARTS   AGE
pod/coredns-66bff467f8-hlzmv                                    1/1     Running   1          23d
pod/coredns-66bff467f8-tmf2p                                    1/1     Running   1          23d
pod/etcd-k8s-master                                             1/1     Running   1          23d
pod/kube-apiserver-k8s-master                                   1/1     Running   1          23d
pod/kube-controller-manager-k8s-master                          1/1     Running   2          23d
pod/kube-flannel-ds-amd64-dd8s5                                 1/1     Running   1          20d
pod/kube-flannel-ds-amd64-lxbw2                                 1/1     Running   1          20d
pod/kube-flannel-ds-amd64-srzn2                                 1/1     Running   1          20d
pod/kube-proxy-6vl9f                                            1/1     Running   1          23d
pod/kube-proxy-rsmff                                            1/1     Running   1          20d
pod/kube-proxy-swrrh                                            1/1     Running   1          20d
pod/kube-scheduler-k8s-master                                   1/1     Running   2          23d
pod/nginx-ingress-1596365264-controller-5649588965-z7ql4        0/1     Running   6          4m31s
pod/nginx-ingress-1596365264-default-backend-769454dd68-hq2xm   1/1     Running   0          33m

NAME                                               TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/kube-dns                                   ClusterIP      10.96.0.10              53/UDP,53/TCP,9153/TCP       23d
service/nginx-ingress-1596365264-controller        LoadBalancer   10.109.99.211        80:31304/TCP,443:30112/TCP   33m
service/nginx-ingress-1596365264-default-backend   ClusterIP      10.96.97.197            80/TCP                       33m

NAME                                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
daemonset.apps/kube-flannel-ds-amd64     3         3         3       3            3                              20d
daemonset.apps/kube-flannel-ds-arm       0         0         0       0            0                              20d
daemonset.apps/kube-flannel-ds-arm64     0         0         0       0            0                              20d
daemonset.apps/kube-flannel-ds-ppc64le   0         0         0       0            0                              20d
daemonset.apps/kube-flannel-ds-s390x     0         0         0       0            0                              20d
daemonset.apps/kube-proxy                3         3         3       3            3           kubernetes.io/os=linux   23d

NAME                                                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/coredns                                    2/2     2            2           23d
deployment.apps/nginx-ingress-1596365264-controller        0/1     1            0           33m
deployment.apps/nginx-ingress-1596365264-default-backend   1/1     1            1           33m

NAME                                                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/coredns-66bff467f8                                    2         2         2       23d
replicaset.apps/nginx-ingress-1596365264-controller-5649588965        1         1         0       33m
replicaset.apps/nginx-ingress-1596365264-default-backend-769454dd68   1         1         1       33m

3、现在要把nginx-ingress的相关服务删除
有pod
pod/nginx-ingress-1596365264-controller-5649588965-z7ql4
pod/nginx-ingress-1596365264-default-backend-769454dd68-hq2xm
有service
service/nginx-ingress-1596365264-controller
service/nginx-ingress-1596365264-default-backend
有deployment.apps
deployment.apps/nginx-ingress-1596365264-controller
deployment.apps/nginx-ingress-1596365264-default-backend
有replicaset.apps
replicaset.apps/nginx-ingress-1596365264-controller-5649588965
replicaset.apps/nginx-ingress-1596365264-default-backend-769454dd68

4、先删除deployment,删除后replicaset.apps和pod自动没了

kubectl delete deployment.apps/nginx-ingress-1596365264-controller -n kube-system
kubectl delete deployment.apps/nginx-ingress-1596365264-default-backend -n kube-system

5、再删除service

kubectl delete service/nginx-ingress-1596365264-controller -n kube-system
kubectl delete service/nginx-ingress-1596365264-default-backend -n kube-system

6、再查看命名空间

kubectl get all -n kube-system
NAME                                     READY   STATUS    RESTARTS   AGE
pod/coredns-66bff467f8-hlzmv             1/1     Running   1          23d
pod/coredns-66bff467f8-tmf2p             1/1     Running   1          23d
pod/etcd-k8s-master                      1/1     Running   1          23d
pod/kube-apiserver-k8s-master            1/1     Running   1          23d
pod/kube-controller-manager-k8s-master   1/1     Running   2          23d
pod/kube-flannel-ds-amd64-dd8s5          1/1     Running   1          20d
pod/kube-flannel-ds-amd64-lxbw2          1/1     Running   1          20d
pod/kube-flannel-ds-amd64-srzn2          1/1     Running   1          20d
pod/kube-proxy-6vl9f                     1/1     Running   1          23d
pod/kube-proxy-rsmff                     1/1     Running   1          20d
pod/kube-proxy-swrrh                     1/1     Running   1          20d
pod/kube-scheduler-k8s-master            1/1     Running   2          23d

NAME               TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
service/kube-dns   ClusterIP   10.96.0.10           53/UDP,53/TCP,9153/TCP   23d

NAME                                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
daemonset.apps/kube-flannel-ds-amd64     3         3         3       3            3                              20d
daemonset.apps/kube-flannel-ds-arm       0         0         0       0            0                              20d
daemonset.apps/kube-flannel-ds-arm64     0         0         0       0            0                              20d
daemonset.apps/kube-flannel-ds-ppc64le   0         0         0       0            0                              20d
daemonset.apps/kube-flannel-ds-s390x     0         0         0       0            0                              20d
daemonset.apps/kube-proxy                3         3         3       3            3           kubernetes.io/os=linux   23d

NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/coredns   2/2     2            2           23d

NAME                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/coredns-66bff467f8   2         2         2       23d

 

你可能感兴趣的:(其它)