GoogleContainerTools/skaffold · error

unable to retrieve node's images: %w

Error message

unable to retrieve node's images: %w

What it means

loadImages lists the images already present on the target cluster's nodes via findKnownImages (a kubectl get nodes jsonpath query) so it can skip images the nodes already have. This error wraps a failure of that kubectl query — the cluster is unreachable, kubectl is misconfigured, or the API call fails.

Source

Thrown at pkg/skaffold/kubernetes/loader/load.go:145

	output.Default.Fprintln(out, "Loading images into k3d cluster nodes...")
	return i.loadImages(ctx, out, artifacts, func(tag string) *exec.Cmd {
		return exec.CommandContext(ctx, "k3d", "image", "import", "--cluster", k3dCluster, tag)
	})
}

func (i *ImageLoader) loadImages(ctx context.Context, out io.Writer, artifacts []graph.Artifact, createCmd func(tag string) *exec.Cmd) error {
	start := time.Now()

	var knownImages []string

	for _, artifact := range artifacts {
		output.Default.Fprintf(out, " - %s -> ", artifact.Tag)

		// Only load images that are unknown to the node
		if knownImages == nil {
			var err error
			if knownImages, err = findKnownImages(ctx, i.cli); err != nil {
				return fmt.Errorf("unable to retrieve node's images: %w", err)
			}
		}
		normalizedImageRef, err := reference.ParseNormalizedNamed(artifact.Tag)
		if err != nil {
			return err
		}
		if stringslice.Contains(knownImages, normalizedImageRef.String()) {
			output.Green.Fprintln(out, "Found")
			continue
		}

		cmd := createCmd(artifact.Tag)
		if cmdOut, err := util.RunCmdOut(ctx, cmd); err != nil {
			output.Red.Fprintln(out, "Failed")
			return fmt.Errorf("unable to load image %q into cluster: %w, %s", artifact.Tag, err, cmdOut)
		}

		output.Green.Fprintln(out, "Loaded")

View on GitHub (pinned to a1189de023)

Solutions

  1. Run `kubectl get nodes` with the same context to reproduce the error directly
  2. Confirm the cluster is fully started (kind/k3d can still be initializing right after creation); retry after it is Ready
  3. Check kubeconfig: `kubectl config current-context` and KUBECONFIG env var pointing to the right file
  4. Verify RBAC allows reading nodes (`kubectl auth can-i get nodes`)
  5. Inspect the wrapped error for connectivity issues (API server address, proxy/VPN)

Example fix

// before: KUBECONFIG points to a stale file
export KUBECONFIG=~/.kube/old-config
// after
export KUBECONFIG=~/.kube/config && kubectl config use-context kind-kind && skaffold dev
Defensive patterns

Strategy: validation

Validate before calling

// Check cluster reachability before loading images
cmd := exec.Command("kubectl", "get", "nodes")
if err := cmd.Run(); err != nil {
    return fmt.Errorf("cluster unreachable, fix kubeconfig before image load: %w", err)
}

Try / catch

err := loader.LoadImages(ctx, out, artifacts)
if err != nil {
    if strings.Contains(err.Error(), "unable to retrieve node's images") {
        log.Warnf("cannot list node images, will reload everything: %v", err)
        // proceed by forcing the load command for each artifact
    }
    return err
}

Prevention

When it happens

Trigger: Any skaffold load into a kind/k3d cluster where findKnownImages' `kubectl get nodes -ojsonpath=...` fails: cluster unreachable, kubeconfig context invalid, nodes NotReady, or RBAC denying node read.

Common situations: Cluster not yet started (kind/k3d still bootstrapping) when dev runs; kubeContext pointing at the wrong kubeconfig file; a restricted user without permission to list nodes; network/VPN preventing access to the API server.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/69f51d8b3157170f. Report an issue: GitHub.