From 3bbf2ad433969e7d2794c91f58df5b89849db067 Mon Sep 17 00:00:00 2001 From: Kimmo Lehto Date: Wed, 4 Dec 2024 09:42:20 +0200 Subject: [PATCH] Controller tokens point to k0s api, not kube api Signed-off-by: Kimmo Lehto --- phase/install_controllers.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phase/install_controllers.go b/phase/install_controllers.go index 88b405ae..fecef2fc 100644 --- a/phase/install_controllers.go +++ b/phase/install_controllers.go @@ -122,10 +122,13 @@ func (p *InstallControllers) Run() error { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() err := retry.Context(ctx, func(_ context.Context) error { - err := h.Exec(h.Configurer.KubectlCmdf(h, h.K0sDataDir(), "get --raw='/version' --kubeconfig=/dev/stdin"), exec.Sudo(h), exec.Stdin(string(h.Metadata.K0sTokenData.Kubeconfig))) + out, err := h.ExecOutput(h.Configurer.KubectlCmdf(h, h.K0sDataDir(), "get --raw='/healthz' --kubeconfig=/dev/stdin"), exec.Sudo(h), exec.Stdin(string(h.Metadata.K0sTokenData.Kubeconfig))) if err != nil { return fmt.Errorf("failed to connect from controller to kubernetes api - check networking: %w", err) } + if out != "OK" { + return fmt.Errorf("k0s api /healthz response: %q", out) + } return nil }) if err != nil { @@ -209,4 +212,3 @@ func (p *InstallControllers) Run() error { return nil }) } -