kubernetes/kops · warning

error building ConfigStore.Base for cluster: %v

Error message

error building ConfigStore.Base for cluster: %v

What it means

When a loaded Cluster has an empty Spec.ConfigStore.Base, find derives it from the state-store path via the deprecated configBase helper. If that helper returns an error (empty cluster name), the failure is re-wrapped as 'error building ConfigStore.Base for cluster'.

Source

Thrown at pkg/client/simple/vfsclientset/cluster.go:210

			return nil, nil
		}
		return nil, fmt.Errorf("error reading cluster configuration %q: %v", clusterName, err)
	}

	c := o.(*api.Cluster)

	if c.ObjectMeta.Name == "" {
		c.ObjectMeta.Name = clusterName
	}
	if c.ObjectMeta.Name != clusterName {
		klog.Warningf("Name of cluster does not match: actual name was %q, but cluster name was %q (using registry path %v).", c.ObjectMeta.Name, clusterName, registry.PathCluster)
	}

	// TODO: Split this out into real version updates / schema changes
	if c.Spec.ConfigStore.Base == "" {
		configBase, err := r.configBase(clusterName)
		if err != nil {
			return nil, fmt.Errorf("error building ConfigStore.Base for cluster: %v", err)
		}
		c.Spec.ConfigStore.Base = configBase.Path()
	}

	return c, nil
}

func (r *ClusterVFS) Delete(name string, options *metav1.DeleteOptions) error {
	return fmt.Errorf("cluster Delete not implemented for vfs store")
}

func (r *ClusterVFS) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
	return fmt.Errorf("cluster DeleteCollection not implemented for vfs store")
}

func (r *ClusterVFS) Watch(opts metav1.ListOptions) (watch.Interface, error) {
	return nil, fmt.Errorf("cluster Watch not implemented for vfs store")
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure the cluster name passed to Get/find is non-empty so configBase can build the path
  2. Set Spec.ConfigStore.Base explicitly in the cluster config (kops edit cluster) to skip defaulting
  3. Re-save the cluster config with a current kops so ConfigStore.Base is persisted

Example fix

// before (cluster config yaml)
spec:
  configStore: {}
// after
spec:
  configStore:
    base: s3://kops-clusters/prod.example.com
Defensive patterns

Strategy: validation

Validate before calling

if cluster.Spec.ConfigStore.Base == "" && cluster.ObjectMeta.Name == "" {
	return fmt.Errorf("cannot default ConfigStore.Base: both base and cluster name are empty")
}

Try / catch

cluster, err := clusterVFS.Get(ctx, name, metav1.GetOptions{})
if err != nil && strings.Contains(err.Error(), "error building ConfigStore.Base") {
	// fall back to computing base from a known state store URL
	cluster.Spec.ConfigStore.Base = stateStoreURL + "/" + name
}

Prevention

When it happens

Trigger: find(ctx, "") reaching the ConfigStore.Base defaulting branch — but note find normally rejects empty names earlier; also configBase failing for any wrapped reason while defaulting ConfigStore.Base for a legacy cluster config that predates the field.

Common situations: Old cluster configs created before ConfigStore.Base was always persisted; programmatic callers constructing ClusterVFS with an unset basePath and empty name.

Related errors


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