1

I accidentally did: k delete service/kubernetes. it sounds like an essential service... so i would think deleting would break the kubernetes cluster but somehow the service just came back.

will deleting the service "service/kubernetes" break my kubernetes cluster? if no why?

related question: what causes the service service/kubernetes to come back automatically?

Trevor Boyd Smith
  • 18,164
  • 32
  • 127
  • 177

1 Answers1

3

what causes the service service/kubernetes to come back automatically?

A part of the control plane run controllers, and there is a controller that is responsible for the kubernetes Service. See controlplane controller

Jonas
  • 121,568
  • 97
  • 310
  • 388
  • RE your link to source code: i'm not familiar with the large code base of kubernetes. i'm also not fluent in `go`. can you provide a line number where? (i can update your link to be a specific commit so the line number always works). – Trevor Boyd Smith Apr 14 '21 at 21:33
  • You can follow the comments above each function, e.g. the "class" has this comment https://github.com/kubernetes/kubernetes/blob/master/pkg/controlplane/controller.go#L47-L50 This controller continuously run, and this specific function is responsible for recreating the kubernetes service if it does not exists: https://github.com/kubernetes/kubernetes/blob/master/pkg/controlplane/controller.go#L209 – Jonas Apr 14 '21 at 21:46