k8s删除服务(1)
程序员文章站
2024-03-12 09:30:20
...
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 <none> 53/UDP,53/TCP,9153/TCP 23d
service/nginx-ingress-1596365264-controller LoadBalancer 10.109.99.211 <pending> 80:31304/TCP,443:30112/TCP 33m
service/nginx-ingress-1596365264-default-backend ClusterIP 10.96.97.197 <none> 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 <none> 20d
daemonset.apps/kube-flannel-ds-arm 0 0 0 0 0 <none> 20d
daemonset.apps/kube-flannel-ds-arm64 0 0 0 0 0 <none> 20d
daemonset.apps/kube-flannel-ds-ppc64le 0 0 0 0 0 <none> 20d
daemonset.apps/kube-flannel-ds-s390x 0 0 0 0 0 <none> 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 <none> 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 <none> 20d
daemonset.apps/kube-flannel-ds-arm 0 0 0 0 0 <none> 20d
daemonset.apps/kube-flannel-ds-arm64 0 0 0 0 0 <none> 20d
daemonset.apps/kube-flannel-ds-ppc64le 0 0 0 0 0 <none> 20d
daemonset.apps/kube-flannel-ds-s390x 0 0 0 0 0 <none> 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
推荐阅读
-
k8s删除服务(1)
-
docker和k8s中批量删除不要的资源
-
ASP.NET 动态写入服务器端控件第1/2页
-
K8s删除terminating的namespace
-
k8s学习(四) k8s使用nodeport方式配置service对外暴露服务
-
k8s服务service
-
k8s问题分析解决unable to recognize "pet-set.yaml": no matches for kind "PetSet" in version "apps/v1beta1"
-
C# XML操作 代码大全(读XML,写XML,更新,删除节点,与dataset结合等)第1/2页
-
【达内课程】Android开发中服务端需要了解的知识(1)
-
k8s删除Terminating状态的命名空间