kubernetes/kops · error

taints: %w

Error message

taints: %w

What it means

Each entry in kubeletConfig.Taints must be a "key=value:Effect" string; parseTaint (via kopsutil.ParseTaint) rejects malformed taints, and the failure is wrapped as "taints: %w". Valid effects are NoSchedule, PreferNoSchedule, NoExecute.

Source

Thrown at nodeup/pkg/model/kubelet.go:421

	if err != nil {
		return nil, fmt.Errorf("evictionMinimumReclaim: %w", err)
	}
	cc.EvictionMinimumReclaim = evictionMinimumReclaim

	featureGates, err := parseFeatureGates(kubeletConfig.FeatureGates)
	if err != nil {
		return nil, fmt.Errorf("featureGates: %w", err)
	}
	cc.FeatureGates = featureGates

	if kubeletConfig.EnforceNodeAllocatable != "" {
		cc.EnforceNodeAllocatable = strings.Split(kubeletConfig.EnforceNodeAllocatable, ",")
	}

	for _, t := range kubeletConfig.Taints {
		taint, err := parseTaint(t)
		if err != nil {
			return nil, fmt.Errorf("taints: %w", err)
		}
		cc.RegisterWithTaints = append(cc.RegisterWithTaints, taint)
	}

	return cc, nil
}

func (b *KubeletBuilder) binaryPath() string {
	path := "/usr/local/bin"
	if b.Distribution == distributions.DistributionFlatcar {
		path = "/opt/kubernetes/bin"
	}
	if b.Distribution == distributions.DistributionContainerOS {
		path = "/home/kubernetes/bin"
	}
	return path
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Format each taint as key=value:Effect, e.g. dedicated=gpu:NoSchedule
  2. Use only NoSchedule, PreferNoSchedule, or NoExecute as the effect
  3. Fix the specific taint named/wrapped in the error message
  4. Re-run kops update cluster and nodeup

Example fix

// before
kubelet:
  taints:
    - "dedicated=gpu"
// after
kubelet:
  taints:
    - "dedicated=gpu:NoSchedule"
Defensive patterns

Strategy: validation

Validate before calling

func validTaints(taints []string) error {
    for _, t := range taints {
        parts := strings.Split(t, ":")
        if len(parts) != 2 || !strings.Contains(parts[0], "=") { return fmt.Errorf("bad taint %q", t) }
        switch parts[1] {
        case "NoSchedule", "PreferNoSchedule", "NoExecute":
        default: return fmt.Errorf("bad effect %q", parts[1])
        }
    }
    return nil
}

Try / catch

for _, t := range cfg.Taints {
    if _, err := kopsutil.ParseTaint(t); err != nil {
        return fmt.Errorf("taint %q must be key=value:Effect: %w", t, err)
    }
}

Prevention

When it happens

Trigger: kubeletConfiguration loops over spec.kubelet.taints and parseTaint(t) returns an error for a taint string missing '=', ':', or having an invalid effect.

Common situations: Writing taints without an effect ("dedicated=gpu"), wrong separator order ("dedicated:gpu=NoSchedule"), invalid effect names ("noschedule" lowercase, "None"), or extra colons.

Related errors


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