{"record":{"id":"26ae189a93e9955f","repo":"GoogleContainerTools/skaffold","slug":"failed-to-determine-kubernetes-cluster-node-platfo","errorCode":null,"errorMessage":"failed to determine kubernetes cluster node platforms: %w","messagePattern":"failed to determine kubernetes cluster node platforms: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/platform/resolver.go","lineNumber":127,"sourceCode":"\t\t\t\t} else if pl = pl.Intersect(constraints); pl.IsEmpty() {\n\t\t\t\t\treturn r, fmt.Errorf(\"build target platforms %q do not match platform constraints %q defined for artifact %q\", platforms, artifact.Platforms, artifact.ImageName)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif pl.IsMultiPlatform() && opts.DisableMultiPlatformBuild {\n\t\t\t\tpl = selectOnePlatform(pl)\n\t\t\t}\n\t\t\tr.platformsByImageName[artifact.ImageName] = pl\n\t\t\tlog.Entry(ctx).Debugf(\"platforms selected for artifact %q: %q\", artifact.ImageName, pl)\n\t\t}\n\t}\n\treturn r, nil\n}\n\n// GetClusterPlatforms returns the platforms for the active kubernetes cluster.\nfunc GetClusterPlatforms(ctx context.Context, kContext string) (Matcher, error) {\n\tclient, err := kubernetesclient.Client(kContext)\n\tif err != nil {\n\t\treturn Matcher{}, fmt.Errorf(\"failed to determine kubernetes cluster node platforms: %w\", err)\n\t}\n\tnodes, err := client.CoreV1().Nodes().List(ctx, coreV1.ListOptions{})\n\tif nodes == nil || err != nil {\n\t\treturn Matcher{}, fmt.Errorf(\"failed to determine kubernetes cluster node platforms: %w\", err)\n\t}\n\tset := make(map[string]v1.Platform)\n\tfor _, n := range nodes.Items {\n\t\tpl := v1.Platform{\n\t\t\tArchitecture: n.Status.NodeInfo.Architecture,\n\t\t\tOS:           n.Status.NodeInfo.OperatingSystem,\n\t\t}\n\t\tset[Format(pl)] = pl\n\t}\n\tkeys := make([]string, 0, len(set))\n\tfor k := range set {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys) // sort keys to have a deterministic selection","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/platform/resolver.go#L109-L145","documentation":"GetClusterPlatforms wraps two failure modes under one message; this site is when creating the Kubernetes client via kubernetesclient.Client(kContext) fails (bad kubeconfig, unknown context, missing credentials). It is thrown while determining the node platforms of the active cluster, typically used with --platform detection from cluster nodes.","triggerScenarios":"Calling GetClusterPlatforms with a kContext that has no matching entry in kubeconfig, an unreachable/invalid kubeconfig file, or expired credentials so the client constructor errors.","commonSituations":"Wrong KUBECONFIG path or context name; running in CI without a mounted kubeconfig; context deleted after switching clusters; RBAC/credential plugin failures during client creation.","solutions":["Run `kubectl config get-contexts` and use/verify the correct context name (or `kubectl config use-context <name>`).","Fix or regenerate kubeconfig (KUBECONFIG env var, `kubectl config set-context`, re-login via cloud CLI like gcloud/aws eks).","Test connectivity first with `kubectl get nodes` using the same context to reproduce the underlying error.","Inspect the wrapped (%w) cause in the message for the precise client-creation failure."],"exampleFix":"// before\nskaffold dev --platform  # uses kContext \"staging\" which no longer exists\n// after\nkubectl config use-context staging  # or update skaffold kube-context to an existing context\nskaffold dev --platform","handlingStrategy":"try-catch","validationCode":"const { execSync } = require('child_process');\nfunction contextExists(kContext) {\n  try {\n    const out = execSync('kubectl config get-contexts -o name', { encoding: 'utf8' });\n    return out.split('\\n').includes(kContext);\n  } catch { return false; }\n}\nif (!contextExists(ctx)) throw new Error(`kubeconfig context \"${ctx}\" not found`);","typeGuard":"function isKubeContextAvailable(err) {\n  return err !== null && typeof err === 'object' && /failed to determine kubernetes cluster node platforms/.test(err.message);\n}","tryCatchPattern":"matcher, err := platform.GetClusterPlatforms(ctx, kContext)\nif err != nil {\n  log.Warnf(\"cluster platform detection failed (%v); falling back to host platform\", err)\n  matcher, err = platform.Parse(defaultPlatforms)\n  if err != nil {\n    return err\n  }\n}","preventionTips":["Pin the kube-context in skaffold.yaml and verify it exists before invoking cluster-based platform detection.","Run `kubectl config current-context` as a preflight in CI before skaffold commands.","Set KUBECONFIG explicitly in scripts/environments rather than relying on default paths.","Refresh cloud credentials (gcloud auth, aws eks update-kubeconfig) before long-running sessions."],"tags":["kubernetes","kubeconfig","cluster","platforms"],"backgroundTag":"kubeconfig-context-not-found","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"}