kubernetes/kops · error

error loading cluster addon %s: %v

Error message

error loading cluster addon %s: %v

What it means

RunCreateCluster wraps any failure from clusteraddons.LoadClusterAddon when iterating over the user-supplied --addon paths. It means kops could not read or parse one of the addon manifests given on the command line, so cluster creation aborts before any state is written. The wrapped %v carries the underlying cause (unreadable path, invalid YAML, or bad addon schema).

Source

Thrown at cmd/kops/create_cluster.go:757

	fullCluster, err := cloudup.PopulateClusterSpec(ctx, clientset, cluster, instanceGroups, cloud, assetBuilder)
	if err != nil {
		return err
	}

	kubernetesVersion, err := kopsutil.ParseKubernetesVersion(clusterResult.Cluster.Spec.KubernetesVersion)
	if err != nil {
		return fmt.Errorf("cannot parse KubernetesVersion %q in cluster: %w", clusterResult.Cluster.Spec.KubernetesVersion, err)
	}

	addons, err := wellknownoperators.CreateAddons(clusterResult.Channel, kubernetesVersion, fullCluster)
	if err != nil {
		return err
	}

	for _, p := range c.AddonPaths {
		addon, err := clusteraddons.LoadClusterAddon(clientset.VFSContext(), p)
		if err != nil {
			return fmt.Errorf("error loading cluster addon %s: %v", p, err)
		}
		addons = append(addons, addon.Objects...)
	}

	{
		// Build full IG spec to ensure we end up with a valid IG
		fullInstanceGroups := []*api.InstanceGroup{}
		for _, group := range instanceGroups {
			fullGroup, err := cloudup.PopulateInstanceGroupSpec(cluster, group, cloud, clusterResult.Channel)
			if err != nil {
				return err
			}
			fullInstanceGroups = append(fullInstanceGroups, fullGroup)
		}

		err = validation.DeepValidate(fullCluster, fullInstanceGroups, true, clientset.VFSContext(), nil)
		if err != nil {
			return fmt.Errorf("validation of the full cluster and instance group specs failed: %w", err)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the path passed to --addon exists and is readable (ls/cat the file).
  2. Validate the addon manifest is a valid kops addon (correct apiVersion/kind and addon spec fields).
  3. Re-download or re-export the addon manifest from a trusted source.
  4. Run with -v=2 to see which path failed and the underlying parse error.

Example fix

// before
kops create cluster --name mycluster.k8s.local --addons=./adons/csi.yaml
// after
kops create cluster --name mycluster.k8s.local --addons=./addons/csi.yaml
Defensive patterns

Strategy: validation

Validate before calling

for _, p := range addonPaths {
	if st, err := os.Stat(p); err != nil || st.IsDir() {
		return fmt.Errorf("addon path %s is not a readable file", p)
	}
}

Try / catch

if err := runCreateCluster(...); err != nil {
	if strings.Contains(err.Error(), "error loading cluster addon") {
		// parse the failing path from the message and fix/replace the manifest
	}
	return err
}

Prevention

When it happens

Trigger: `kops create cluster --addon <path>` where the path does not exist, is unreadable, or the file is not a valid cluster addon YAML/JSON manifest (clusteraddons.LoadClusterAddon returns err for that path).

Common situations: Typo in the addon file path; addon manifest copied from docs with wrong schema/version; file exists locally but not in the working directory of the CI job; passing a raw Kubernetes manifest that is not kops addon format.

Related errors


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