kubernetes/kops · error

error loading Cluster %q: %v

Error message

error loading Cluster %q: %v

What it means

Also in fullClusterSpecs (--full output): after resolving ConfigBase, kops reads the completed cluster manifest at <configBase>/cluster-completed.spec. If the read fails (object missing, access denied, connectivity), the error is wrapped as 'error loading Cluster %q: %v' with the full config path. This means the cluster's normalized spec file is absent or unreadable in the state store.

Source

Thrown at cmd/kops/get_cluster.go:292

		}
		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. Check the object exists: `aws s3 ls s3://<bucket>/<cluster>/cluster-completed.spec`.
  2. Run `kops update cluster <name> --yes` (or re-export/refresh state) so the completed spec is written, if the cluster was never fully provisioned.
  3. Verify read permissions on the state store bucket/prefix for your credentials.
  4. Inspect the wrapped error for 404 vs 403 vs network to pick between missing object, permissions, and connectivity fixes.

Example fix

// before
aws s3 rm s3://bucket/mycluster.example.com/cluster-completed.spec  # then kops get --full
// after
aws s3 cp cluster-completed.spec s3://bucket/mycluster.example.com/cluster-completed.spec  # or kops update cluster mycluster.example.com
Defensive patterns

Strategy: retry

Validate before calling

# verify the completed spec object exists before --full
prefix=$(aws s3 ls "$KOPS_STATE_STORE/" | awk '/\//{print $NF}' | head -1)
aws s3 ls "${KOPS_STATE_STORE%/}/${prefix}cluster-completed.spec" >/dev/null \
  || { echo "cluster-completed.spec missing; run kops update cluster first" >&2; exit 1; }

Type guard

null

Try / catch

for i in 1 2 3; do
  kops get cluster "$CLUSTER" --full && break
  sleep $((i*2))   # transient S3/GCS errors

done

Prevention

When it happens

Trigger: `kops get cluster X --full` where cluster-completed.spec does not exist yet (cluster created but never updated/fully provisioned), the S3/GCS object was deleted, or credentials block the read.

Common situations: Freshly created clusters whose `kops update` hasn't produced the completed spec; manually deleted state-store objects; IAM/storage permissions changed after creation; network outage to the object store.

Related errors


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