kubernetes/kops · error

error converting nodeup config to yaml: %v

Error message

error converting nodeup config to yaml: %v

What it means

After building the nodeup configuration struct, kubeEnv serializes it to YAML with utils.YamlMarshal to store as the nodeup config resource. If marshalling fails (the config contains a type not representable in YAML), the error is wrapped and bootstrap script generation fails.

Source

Thrown at pkg/model/bootstrapscript.go:122

	}

	keysets := make(map[string]*fi.Keyset)
	for _, caTask := range b.caTasks {
		name := *caTask.Name
		keyset := caTask.Keyset()
		if keyset == nil {
			return nil, fmt.Errorf("failed to get keyset from %q", name)
		}
		keysets[name] = keyset
	}
	config, bootConfig, err := b.builder.NodeUpConfigBuilder.BuildConfig(ig, wellKnownAddresses, keysets)
	if err != nil {
		return nil, err
	}

	configData, err := utils.YamlMarshal(config)
	if err != nil {
		return nil, fmt.Errorf("error converting nodeup config to yaml: %v", err)
	}
	sum256 := sha256.Sum256(configData)
	bootConfig.NodeupConfigHash = base64.StdEncoding.EncodeToString(sum256[:])
	b.nodeupConfig.Resource = fi.NewBytesResource(configData)

	if ig.Spec.Manager == kops.InstanceManagerKarpenter {
		assetBuilder := assets.NewAssetBuilder(vfs.NewVFSContext(), cluster.Spec.Assets, false)
		nodeUpAssets := make(map[architectures.Architecture]*assets.MirroredAsset)
		for _, arch := range architectures.GetSupported() {
			asset, err := wellknownassets.NodeUpAsset(assetBuilder, arch)
			if err != nil {
				return nil, err
			}
			nodeUpAssets[arch] = asset
		}

		var nodeupScript resources.NodeUpScript
		nodeupScript.NodeUpAssets = nodeUpAssets

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Use a kops binary whose version matches your cluster/state store (no mixed-version binaries).
  2. Retry after identifying the wrapped marshal cause; report to kops if it reproduces on stock config (likely a bug).
  3. Clear any third-party hooks/builders injecting non-serializable values and re-run `kops update cluster`.
Defensive patterns

Strategy: try-catch

Try / catch

if err := kopsUpdate(); err != nil {
  if strings.Contains(err.Error(), "error converting nodeup config to yaml") {
    // check for kops binary/state-store version mismatch and report bug if stock
    return fmt.Errorf("nodeup config marshal failed; verify matching kops version: %w", err)
  }
  return err
}

Prevention

When it happens

Trigger: A nodeup.BootConfig / NodeUpConfig populated with data that cannot be marshalled to YAML during `kops update cluster` — e.g. unexpected types introduced by custom builder output or a kops/nodeup version mismatch in config structs.

Common situations: Running a mismatched kops binary against plugins/extensions injecting unsupported fields; internal bugs after kops version upgrades; binary incompatibility between nodeup config struct versions.

Related errors


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