kubernetes/kops · error
error serializing addons: %v
Error message
error serializing addons: %v
What it means
For addons of type 'additionalObjects', Build creates an in-memory manifest location and serializes the objects to YAML via ToYAML(). This error is returned if that serialization fails, blocking generation of the addon source bytes.
Source
Thrown at upup/pkg/fi/cloudup/bootstrapchannelbuilder/bootstrapchannelbuilder.go:180
applyAdditionalObjectsToCluster = append(applyAdditionalObjectsToCluster, addon)
}
}
}
if len(applyAdditionalObjectsToCluster) != 0 {
key := "cluster-addons.kops.k8s.io"
location := key + "/default.yaml"
addon := addons.Add(&channelsapi.AddonSpec{
Name: new(key),
Selector: map[string]string{"k8s-addon": key},
Manifest: new(location),
})
addon.SkipRemap = true
manifestBytes, err := applyAdditionalObjectsToCluster.ToYAML()
if err != nil {
return fmt.Errorf("error serializing addons: %v", err)
}
addon.Source = fi.NewBytesResource(manifestBytes)
addon.SkipRender = true
}
preRegisterAddonImages := b.shouldPreRegisterAddonImages()
var addonTasks []*AddonManifest
for _, addon := range addons.Items {
if preRegisterAddonImages {
if err := addon.CollectImages(b.assetBuilder, b.addonRenderer); err != nil {
klog.Warningf("unable to pre-register addon images for %q: %v", addonKey(addon.Spec), err)
}
}
task := &AddonManifest{
Name: new(b.Cluster.ObjectMeta.Name + "-addons-" + addonKey(addon.Spec)),
Lifecycle: b.Lifecycle,View on GitHub (pinned to 4c8573c808)
Solutions
- Inspect the wrapped %v error to find the failing object/field
- Fix or regenerate the additionalObjects in the addon channel manifest
- Remove the addon entry if the objects are no longer needed
- Upgrade kops/addon channel to compatible versions
Example fix
// before (channel yaml)
additionalObjects:
- apiVersion: v1
kind: ConfigMap
unknownField: <custom type>
// after: only standard serializable objects
additionalObjects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: my-config Defensive patterns
Strategy: validation
Validate before calling
// Validate additionalObjects decode as Kubernetes objects first
for _, obj := range addon.Spec.AdditionalObjects {
if obj.APIVersion == "" || obj.Kind == "" {
return fmt.Errorf("additionalObject %v missing apiVersion/kind", obj)
}
} Try / catch
yamlBytes, err := applyAdditionalObjectsToCluster.ToYAML()
if err != nil {
return fmt.Errorf("cannot serialize additionalObjects addon: %w", err)
} Prevention
- Only include standard serializable Kubernetes objects in additionalObjects
- Regenerate channels with current kops tooling
- Dry-run `kops update cluster --dry-run` to surface serialization issues early
When it happens
Trigger: Building a cluster whose spec.addons include an addon with additionalObjects (or additionalObjects addons provided externally) where one of the embedded Kubernetes objects cannot be converted to YAML by applyAdditionalObjectsToCluster.ToYAML().
Common situations: additionalObjects entries with fields that fail YAML/JSON marshaling (e.g. raw nested values from a hand-written channel); version skew between kops and the addon channel format.
Related errors
- error serializing addons yaml: %v
- unable to marshal YAML: %v
- error converting to yaml: %v
- marshaling to yaml for %v: %w
- error marshaling manifest to yaml: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/577dfac067baa774.
Report an issue: GitHub.