-3

I cannot force delete kubernetes service. However I don't have any deployments at the moment.

~$ kubectl get all --all-namespaces
NAMESPACE     NAME                                            READY   STATUS             RESTARTS   AGE
kube-system   pod/etcd-kubernetes-master                      1/1     Running            0          26m
kube-system   pod/kube-apiserver-kubernetes-master            1/1     Running            0          26m
kube-system   pod/kube-controller-manager-kubernetes-master   1/1     Running            0          26m
kube-system   pod/kube-flannel-ds-amd64-5h46j                 0/1     CrashLoopBackOff   9          26m
kube-system   pod/kube-proxy-ltz4v                            1/1     Running            0          26m
kube-system   pod/kube-scheduler-kubernetes-master            1/1     Running            0          26m

NAMESPACE     NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
default       service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP                  17m
kube-system   service/kube-dns     ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP,9153/TCP   48m

NAMESPACE     NAME                                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
kube-system   daemonset.apps/kube-flannel-ds-amd64     1         1         0       1            0           <none>                   47m
kube-system   daemonset.apps/kube-flannel-ds-arm       0         0         0       0            0           <none>                   47m
kube-system   daemonset.apps/kube-flannel-ds-arm64     0         0         0       0            0           <none>                   47m
kube-system   daemonset.apps/kube-flannel-ds-ppc64le   0         0         0       0            0           <none>                   47m
kube-system   daemonset.apps/kube-flannel-ds-s390x     0         0         0       0            0           <none>                   47m
kube-system   daemonset.apps/kube-proxy                1         1         1       1            1           kubernetes.io/os=linux   48m


~$ kubectl get deployments --all-namespaces 
No resources found

Please help to stop and delete the kubernetes service

Farkhod
  • 99
  • 2
  • 10
  • What exactly do you want to delete? By "service" -- do you mean some specific resource? – Grigoriy Mikhalkin May 21 '20 at 09:45
  • Can you add some logs? What problem do you face when you do `kubectl delete svc ` – leoOrion May 21 '20 at 09:46
  • 1
    you want to delete the service that makes everything to talk to the api-server? – suren May 21 '20 at 10:34
  • 1
    Why do you want deleting it? https://stackoverflow.com/questions/47523136/whats-the-purpose-of-the-default-kubernetes-service sheds light on the service you'd like to delete. – Nick May 21 '20 at 12:35

2 Answers2

0

It's not mandatory to a have a deployment for pods. Generally, system pods running in kube-system namespace are created as static pods directly. You can delete a pod via kubectl delete po podname and deamonset via kubectl delete ds daemonsetname and a service via kubectl delete svc servicename

The services kubernetes and kube-dns in kube-system namespace are managed by kubernetes control plane and will be recreated automatically upon removal. Also I don't think you have a reason to delete those.

Nick
  • 1,882
  • 11
  • 16
Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107
0

The list which you posted are all core kubernetes services, these should not be deleted. If you have used kubeadm to create the kubernetes cluster, you can run kubeadm reset to destroy the cluster.

hdhruna
  • 865
  • 6
  • 15
  • 1
    Try to remove finalizer field if it exist on the deployed service via kubectl edit service-name. Once, this field is removed, the service will be automatically remove – Lamine BA Apr 20 '22 at 16:28