kubernetes/kops · error

error parsing kube-apiserver-healthcheck manifest %s: %w

Error message

error parsing kube-apiserver-healthcheck manifest %s: %w

What it means

addHealthcheckSidecar wraps yaml.Unmarshal failure after successfully reading the kube-apiserver-healthcheck manifest: the file exists but is not a valid corev1.Pod YAML. This indicates a corrupted or incompatible manifest in state storage; the sidecar pod spec cannot be built.

Source

Thrown at nodeup/pkg/model/kube_apiserver_healthcheck.go:50

	return b.findStaticManifest("kube-apiserver-healthcheck")
}

func (b *KubeAPIServerBuilder) addHealthcheckSidecar(ctx context.Context, pod *corev1.Pod) error {
	manifest := b.findHealthcheckManifest()
	if manifest == nil {
		return nil
	}

	p := b.ConfigBase.Join(manifest.Path)

	data, err := p.ReadFile(ctx)
	if err != nil {
		return fmt.Errorf("error reading kube-apiserver-healthcheck manifest %s: %w", p, err)
	}

	sidecar := &corev1.Pod{}
	if err := yaml.Unmarshal(data, sidecar); err != nil {
		return fmt.Errorf("error parsing kube-apiserver-healthcheck manifest %s: %w", p, err)
	}

	// Quick-and-dirty merge of the fields we care about
	pod.Spec.Containers = append(pod.Spec.Containers, sidecar.Spec.Containers...)
	pod.Spec.Volumes = append(pod.Spec.Volumes, sidecar.Spec.Volumes...)

	return nil
}

func (b *KubeAPIServerBuilder) addHealthcheckSidecarTasks(c *fi.NodeupModelBuilderContext) error {
	id := "kube-apiserver-healthcheck"
	secretsDir := "/etc/kubernetes/" + id + "/secrets"
	userID := wellknownusers.KubeApiserverHealthcheckID
	userName := wellknownusers.KubeApiserverHealthcheckName

	// We create user a user and hardcode its UID to 10012 as
	// that is the ID used inside the container.
	{

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the healthcheck manifest YAML in the state store
  2. Report corrupted manifests to kOps maintainers
  3. Recreate the manifest by re-running kops update
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nodeup/pkg/model/kube_apiserver_healthcheck.go:50 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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