{"record":{"id":"a5bbff8ff9d8d21b","repo":"GoogleContainerTools/skaffold","slug":"unable-to-inspect-the-nodes-w","errorCode":null,"errorMessage":"unable to inspect the nodes: %w","messagePattern":"unable to inspect the nodes: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/kubernetes/loader/load.go","lineNumber":173,"sourceCode":"\t\t}\n\n\t\tcmd := createCmd(artifact.Tag)\n\t\tif cmdOut, err := util.RunCmdOut(ctx, cmd); err != nil {\n\t\t\toutput.Red.Fprintln(out, \"Failed\")\n\t\t\treturn fmt.Errorf(\"unable to load image %q into cluster: %w, %s\", artifact.Tag, err, cmdOut)\n\t\t}\n\n\t\toutput.Green.Fprintln(out, \"Loaded\")\n\t}\n\n\toutput.Default.Fprintln(out, \"Images loaded in\", timeutil.Humanize(time.Since(start)))\n\treturn nil\n}\n\nfunc findKnownImages(ctx context.Context, cli *kubectl.CLI) ([]string, error) {\n\tnodeGetOut, err := cli.RunOut(ctx, \"get\", \"nodes\", `-ojsonpath={@.items[*].status.images[*].names[*]}`)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to inspect the nodes: %w\", err)\n\t}\n\n\tknownImages := strings.Split(string(nodeGetOut), \" \")\n\treturn knownImages, nil\n}\n\nfunc (i *ImageLoader) getCurrentContext() (*api.Context, error) {\n\tcurrentCfg, err := kubectx.CurrentConfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get kubernetes config: %w\", err)\n\t}\n\n\tcurrentContext, present := currentCfg.Contexts[i.kubeContext]\n\tif !present {\n\t\treturn nil, fmt.Errorf(\"unable to get current kubernetes context: %w\", err)\n\t}\n\treturn currentContext, nil\n}","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/kubernetes/loader/load.go#L155-L191","documentation":"findKnownImages queries all cluster nodes with `kubectl get nodes -ojsonpath={@.items[*].status.images[*].names[*]}` to build the list of images the nodes already hold. This error wraps any failure of that kubectl invocation — API server unreachable, authentication/authorization failure, or kubectl configuration problems.","triggerScenarios":"The first image being loaded into a kind/k3d cluster triggers findKnownImages (knownImages is nil); the kubectl get nodes call fails because the context is invalid, the API server is down, or the user lacks node list permission.","commonSituations":"Expired/missing credentials in kubeconfig; API server endpoint changed (cluster recreated with same context name); RBAC-restricted service account; kubectl version too old for the cluster; network/firewall blocking the API server port.","solutions":["Reproduce with `kubectl get nodes` using the same context; the wrapped error identifies the root cause","Refresh credentials (e.g. `gcloud container clusters get-credentials`, re-login, or regenerate kubeconfig)","Check RBAC: `kubectl auth can-i get nodes` — use a context/user with node read access","Verify connectivity to the API server (endpoint, proxy, VPN) in kubeconfig's cluster server URL","If the cluster was recreated, update the kubeconfig to the new endpoint/certificate"],"exampleFix":"// before: stale credentials\n$ kubectl get nodes  # Unauthorized\n// after: refresh and retry\n$ gcloud container clusters get-credentials mycluster --region us-central1\n$ skaffold dev","handlingStrategy":"validation","validationCode":"// Pre-flight: can this context list nodes?\nif err := exec.Command(\"kubectl\", \"auth\", \"can-i\", \"get\", \"nodes\").Run(); err != nil {\n    return fmt.Errorf(\"context lacks node read permission; findKnownImages will fail\")\n}","typeGuard":null,"tryCatchPattern":"known, err := k8sloader.FindKnownImages(ctx, cli)\nif err != nil && strings.Contains(err.Error(), \"unable to inspect the nodes\") {\n    log.Warnf(\"skipping known-image optimization, forcing full load: %v\", err)\n    known = nil // proceed with unconditional load\n}","preventionTips":["Grant the current user RBAC read on nodes (cluster-admin or node reader role)","Run `kubectl get nodes` as a pre-flight in CI before skaffold","Refresh cluster credentials regularly to avoid auth expiry mid-deploy"],"tags":["kubernetes","kubectl","rbac","cluster-connectivity"],"backgroundTag":"kubectl-get-nodes-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}