kubernetes/kops · error

error parsing addon %v

Error message

error parsing addon %v

What it means

ParseClusterAddon uses kubemanifest.LoadObjectsFrom to decode raw bytes into Kubernetes objects. If decoding fails (invalid YAML, unknown/unsupported objects, schema errors) it returns this error wrapping the decoder's message. This is the lowest-level addon parse error in the load path.

Source

Thrown at pkg/clusteraddons/load.go:61

	klog.V(2).Infof("Loading addon from %q", resolved)
	addonBytes, err := vfsContext.ReadFile(resolved)
	if err != nil {
		return nil, fmt.Errorf("error reading addon %q: %v", resolved, err)
	}
	addon, err := ParseClusterAddon(addonBytes)
	if err != nil {
		return nil, fmt.Errorf("error parsing addon %q: %v", resolved, err)
	}
	klog.V(4).Infof("Addon contents: %s", string(addonBytes))

	return addon, nil
}

// ParseClusterAddon parses a ClusterAddon object
func ParseClusterAddon(raw []byte) (*ClusterAddon, error) {
	objects, err := kubemanifest.LoadObjectsFrom(raw)
	if err != nil {
		return nil, fmt.Errorf("error parsing addon %v", err)
	}

	return &ClusterAddon{Raw: string(raw), Objects: objects}, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Fix the YAML syntax in the addon source based on the wrapped decoder error (line/column info).
  2. Ensure all objects use API versions supported by the kops manifest loader.
  3. Validate the manifest locally with kubectl apply --dry-run=client before adding it as a cluster addon.

Example fix

// before (addon yaml)
apiVersion: v1
kind: ConfigMap
 metadata:
   name: x
// after
apiVersion: v1
kind: ConfigMap
metadata:
  name: x
Defensive patterns

Strategy: validation

Validate before calling

// pre-validate addon bytes as decodable YAML
var check interface{}
if err := yaml.Unmarshal(raw, &check); err != nil {
  return fmt.Errorf("addon YAML invalid: %v", err)
}

Try / catch

addon, err := ParseClusterAddon(raw)
if err != nil {
  return fmt.Errorf("addon content rejected: %w; fix the YAML/API versions in the addon source", err)
}

Prevention

When it happens

Trigger: ParseClusterAddon called (by LoadClusterAddon) with bytes that are not decodable as Kubernetes manifests — malformed YAML, wrong indentation, unsupported API group/version, or binary garbage.

Common situations: Custom/community addons written against newer Kubernetes API versions than the decoder accepts; hand-written addon YAML with syntax errors; files that are JSON/YAML mixes or empty.

Related errors


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