GoogleContainerTools/skaffold · error
failed to determine kubernetes cluster node platforms: %w
Error message
failed to determine kubernetes cluster node platforms: %w
What it means
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.
Source
Thrown at pkg/skaffold/platform/resolver.go:127
} else if pl = pl.Intersect(constraints); pl.IsEmpty() {
return r, fmt.Errorf("build target platforms %q do not match platform constraints %q defined for artifact %q", platforms, artifact.Platforms, artifact.ImageName)
}
}
if pl.IsMultiPlatform() && opts.DisableMultiPlatformBuild {
pl = selectOnePlatform(pl)
}
r.platformsByImageName[artifact.ImageName] = pl
log.Entry(ctx).Debugf("platforms selected for artifact %q: %q", artifact.ImageName, pl)
}
}
return r, nil
}
// GetClusterPlatforms returns the platforms for the active kubernetes cluster.
func GetClusterPlatforms(ctx context.Context, kContext string) (Matcher, error) {
client, err := kubernetesclient.Client(kContext)
if err != nil {
return Matcher{}, fmt.Errorf("failed to determine kubernetes cluster node platforms: %w", err)
}
nodes, err := client.CoreV1().Nodes().List(ctx, coreV1.ListOptions{})
if nodes == nil || err != nil {
return Matcher{}, fmt.Errorf("failed to determine kubernetes cluster node platforms: %w", err)
}
set := make(map[string]v1.Platform)
for _, n := range nodes.Items {
pl := v1.Platform{
Architecture: n.Status.NodeInfo.Architecture,
OS: n.Status.NodeInfo.OperatingSystem,
}
set[Format(pl)] = pl
}
keys := make([]string, 0, len(set))
for k := range set {
keys = append(keys, k)
}
sort.Strings(keys) // sort keys to have a deterministic selectionView on GitHub (pinned to a1189de023)
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.
Example fix
// before skaffold dev --platform # uses kContext "staging" which no longer exists // after kubectl config use-context staging # or update skaffold kube-context to an existing context skaffold dev --platform
Defensive patterns
Strategy: try-catch
Validate before calling
const { execSync } = require('child_process');
function contextExists(kContext) {
try {
const out = execSync('kubectl config get-contexts -o name', { encoding: 'utf8' });
return out.split('\n').includes(kContext);
} catch { return false; }
}
if (!contextExists(ctx)) throw new Error(`kubeconfig context "${ctx}" not found`); Type guard
function isKubeContextAvailable(err) {
return err !== null && typeof err === 'object' && /failed to determine kubernetes cluster node platforms/.test(err.message);
} Try / catch
matcher, err := platform.GetClusterPlatforms(ctx, kContext)
if err != nil {
log.Warnf("cluster platform detection failed (%v); falling back to host platform", err)
matcher, err = platform.Parse(defaultPlatforms)
if err != nil {
return err
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to deploy: %w
- getting Kubernetes client: %w
- unable to connect to Kubernetes: %w
- error getting Kubernetes dynamic client: %w
- error getting Kubernetes client: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/26ae189a93e9955f.
Report an issue: GitHub.