GoogleContainerTools/skaffold · error · ReadRemoteManifestErr

getting remote manifests: %w

Error message

getting remote manifests: %w

What it means

readRemoteManifest runs `kubectl get <name> -o yaml` via the kubectl CLI to fetch a live manifest from the cluster, and wraps failures with ReadRemoteManifestErr('getting remote manifests'). It fires when the kubectl command itself fails (cluster unreachable, RBAC, missing resource).

Source

Thrown at pkg/skaffold/render/generate/generate.go:171

	return manifests, nil
}

// readRemoteManifests will try to read manifests from the given kubernetes
// context in the specified namespace and for the specified type
func (g Generator) readRemoteManifest(ctx context.Context, rm latest.RemoteManifest) ([]byte, error) {
	var args []string
	ns := ""
	name := rm.Manifest
	if parts := strings.Split(name, ":"); len(parts) > 1 {
		ns = parts[0]
		name = parts[1]
	}
	args = append(args, name, "-o", "yaml")

	var manifest bytes.Buffer
	err := kubectl.NewCLI(NewKCfg(rm.KubeContext, "", ""), "").RunInNamespace(ctx, nil, &manifest, "get", ns, args...)
	if err != nil {
		return nil, rErrors.ReadRemoteManifestErr(fmt.Errorf("getting remote manifests: %w", err))
	}

	return manifest.Bytes(), nil
}

// walkLocalManifests finds out all the manifests from the `.manifests.generate`, so they can be registered in the file watcher.
// Note: the logic about manifest dependencies shall separate from the "Generate" function, which requires "context" and
// only be called when a rendering action is needed (normally happens after the file watcher registration).
func (g Generator) walkLocalManifests() ([]string, error) {
	var dependencyPaths []string
	var err error

	// Generate in-place hydrated kpt Manifests
	kptPaths, err := localManifests(g.config.Kpt, g.workingDir)
	if err != nil {
		return nil, err
	}
	dependencyPaths = append(dependencyPaths, kptPaths...)

View on GitHub (pinned to a1189de023)

Solutions

  1. Verify cluster connectivity: kubectl --context <KubeContext> get <resource> -n <ns>
  2. Confirm the resource name and namespace exist in the cluster
  3. Check RBAC: the current user needs 'get' on the resource in that namespace
  4. Ensure kubectl is installed and matches the cluster's API version

Example fix

// before: stale context
render:
  generate:
    kubeContext: old-dev-cluster
// after
render:
  generate:
    kubeContext: current-dev-cluster
Defensive patterns

Strategy: try-catch

Validate before calling

kubectl --context "$CTX" get "$RESOURCE" -n "$NS" -o yaml > /dev/null || echo 'remote manifest unreachable'

Try / catch

if rErrors.IsReadRemoteManifestErr(err) {
    // check cluster connectivity, namespace/resource existence, and RBAC get permission
}

Prevention

When it happens

Trigger: Render generate with a manifest that must be read from a running cluster; kubectl.NewCLI(...).RunInNamespace(ctx, nil, &manifest, "get", ns, args...) returns non-zero (no cluster, no context, resource not found, RBAC denied).

Common situations: KubeContext in the generate config points to a cluster that is down; user lacks get permission on the resource/namespace; the resource name/namespace doesn't exist; kubectl not installed or version-incompatible.

Related errors


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