kubernetes/kops · error

re-marshaling kops-channels manifest: %w

Error message

re-marshaling kops-channels manifest: %w

What it means

After successfully unmarshaling and adding SELinux hostPath contexts, nodeup re-serializes the Pod via k8scodecs.ToVersionedYaml. If the codec fails to produce versioned YAML (serialization/codec registry error), the failure is wrapped with this message. This is rare and indicates an internal encoding problem rather than user configuration.

Source

Thrown at nodeup/pkg/model/channels.go:110

	}
	data, err := p.ReadFile(ctx)
	if err != nil {
		return nil, fmt.Errorf("reading kops-channels manifest %s: %w", b.NodeupConfig.ChannelsManifest, err)
	}

	// SELinux is per-IG via containerdConfig, so the decoration can only be applied at nodeup.
	// Skip the parse/reserialize round-trip when there's nothing to add.
	if b.NodeupConfig.ContainerdConfig == nil || !b.NodeupConfig.ContainerdConfig.SeLinuxEnabled {
		return data, nil
	}
	pod := &v1.Pod{}
	if err := yaml.Unmarshal(data, pod); err != nil {
		return nil, fmt.Errorf("parsing kops-channels manifest: %w", err)
	}
	kubemanifest.AddHostPathSELinuxContext(pod, b.NodeupConfig)
	out, err := k8scodecs.ToVersionedYaml(pod)
	if err != nil {
		return nil, fmt.Errorf("re-marshaling kops-channels manifest: %w", err)
	}
	return out, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Upgrade/downgrade to a released kops version matching the node's nodeup binary; this is typically a build-level bug.
  2. Rebuild kops/nodeup from source ensuring k8s.io/api and apimachinery versions are consistent (run 'make gomod' and 'make kops').
  3. Verify no custom patches to kubemanifest.AddHostPathSELinuxContext or k8scodecs are producing malformed objects.
  4. As a workaround, disable containerdConfig.seLinuxEnabled so the re-marshal path is skipped.
Defensive patterns

Strategy: try-catch

Try / catch

if err := nodeupRun(ctx); err != nil && strings.Contains(err.Error(), "re-marshaling kops-channels manifest") {
	// internal codec failure: retry once, then surface for a kops version bump
	if err := nodeupRun(ctx); err != nil {
		return fmt.Errorf("persistent channels manifest marshal failure, upgrade kops: %w", err)
	}
	return nil
}

Prevention

When it happens

Trigger: Build() on a master node with SeLinuxEnabled=true; yaml.Unmarshal and AddHostPathSELinuxContext succeeded, but k8scodecs.ToVersionedYaml(pod) returns an error (e.g. codec/scheme registry failure marshaling the modified Pod).

Common situations: kops build with a broken/incompatible k8s.io/api or apimachinery codec registration; extremely unusual field values injected by AddHostPathSELinuxContext; corrupted kops binary.

Related errors


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