diff --git a/pkg/cli/server/server.go b/pkg/cli/server/server.go index e28fdfa944..6d10af4a5e 100644 --- a/pkg/cli/server/server.go +++ b/pkg/cli/server/server.go @@ -174,7 +174,13 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont serverConfig.ControlConfig.DisableScheduler = true serverConfig.ControlConfig.DisableCCM = true - close(agentReady) + // only close the agentReady channel in case of k3s restoration, because k3s does not start + // the agent until server returns successfully, unlike rke2's agent which starts in parallel + // with the server + if serverConfig.ControlConfig.SupervisorPort == serverConfig.ControlConfig.HTTPSPort { + close(agentReady) + } + dataDir, err := datadir.LocalHome(cfg.DataDir, false) if err != nil { return err