Skip to content

Commit

Permalink
Controller tokens point to k0s api, not kube api
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Dec 4, 2024
1 parent 6c37bcc commit 3bbf2ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions phase/install_controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -209,4 +212,3 @@ func (p *InstallControllers) Run() error {
return nil
})
}

0 comments on commit 3bbf2ad

Please sign in to comment.