kubernetes/kops · error

error reading full cluster spec for %q: %v

Error message

error reading full cluster spec for %q: %v

What it means

fullClusterSpecs is used by `kops get --full` to load the completed cluster spec from the state store. registry.ConfigBase resolves the state-store path for the cluster; if that resolution fails (invalid state store config, bad VFS path), the error is wrapped as 'error reading full cluster spec for %q'. It aborts the whole listing because a partial --full output would be misleading.

Source

Thrown at cmd/kops/get_cluster.go:287

	for i, obj := range args {
		if i != 0 {
			if err := writeYAMLSep(out); err != nil {
				return fmt.Errorf("error writing to stdout: %v", err)
			}
		}
		if err := marshalToWriter(obj, marshalYaml, out); err != nil {
			return err
		}
	}
	return nil
}

func fullClusterSpecs(ctx context.Context, vfsContext *vfs.VFSContext, clusters []*kopsapi.Cluster) ([]*kopsapi.Cluster, error) {
	var fullSpecs []*kopsapi.Cluster
	for _, cluster := range clusters {
		configBase, err := registry.ConfigBase(vfsContext, cluster)
		if err != nil {
			return nil, fmt.Errorf("error reading full cluster spec for %q: %v", cluster.ObjectMeta.Name, err)
		}
		configPath := configBase.Join(registry.PathClusterCompleted)
		b, err := configPath.ReadFile(ctx)
		if err != nil {
			return nil, fmt.Errorf("error loading Cluster %q: %v", configPath, err)
		}

		o, _, err := kopscodecs.Decode(b, nil)
		if err != nil {
			return nil, fmt.Errorf("error parsing Cluster %q: %v", configPath, err)
		}
		if fullSpec, ok := o.(*kopsapi.Cluster); ok {
			fullSpecs = append(fullSpecs, fullSpec)
		} else {
			return nil, fmt.Errorf("unexpected object type for Cluster %q: %T", configPath, o)
		}
	}
	return fullSpecs, nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set/verify KOPS_STATE_STORE (or --state) to the correct store: `kops get cluster X --full --state s3://my-bucket`.
  2. Validate the state store URL scheme (s3://, gs://, etc.) and that you have read credentials for it.
  3. Confirm the cluster name matches one listed by `kops get clusters`.

Example fix

// before
kops get cluster mycluster.example.com --full   # KOPS_STATE_STORE unset
// after
KOPS_STATE_STORE=s3://my-kops-bucket kops get cluster mycluster.example.com --full
Defensive patterns

Strategy: validation

Validate before calling

[ -n "$KOPS_STATE_STORE" ] || { echo "KOPS_STATE_STORE is not set" >&2; exit 1; }
kops get cluster "$CLUSTER" >/dev/null || exit 1  # resolves config base
kops get cluster "$CLUSTER" --full

Type guard

null

Try / catch

if ! kops get cluster "$CLUSTER" --full 2>err.txt; then
  grep -q 'error reading full cluster spec' err.txt && \
    echo "check KOPS_STATE_STORE=$KOPS_STATE_STORE and credentials" || cat err.txt
fi

Prevention

When it happens

Trigger: `kops get cluster X --full` where the cluster's state store location cannot be resolved — e.g. KOPS_STATE_STORE unset/invalid, malformed s3:// URL, or missing permissions to determine the base path.

Common situations: Missing KOPS_STATE_STORE env var; state store URL typos; VFS context misconfigured for the cluster's origin (cluster created with a different store).

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/a7e35e99d9713157. Report an issue: GitHub.