diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go index 54ff8d6a26b..6e9cb834819 100644 --- a/cmd/kubelet/app/server.go +++ b/cmd/kubelet/app/server.go @@ -905,12 +905,12 @@ func run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Depend if s.HealthzPort > 0 { mux := http.NewServeMux() healthz.InstallHandler(mux) - go wait.Until(func() { + go wait.UntilWithContext(ctx, func(ctx context.Context) { err := http.ListenAndServe(net.JoinHostPort(s.HealthzBindAddress, strconv.Itoa(int(s.HealthzPort))), mux) if err != nil { logger.Error(err, "Failed to start healthz server") } - }, 5*time.Second, wait.NeverStop) + }, 5*time.Second) } // If systemd is used, notify it that we have started