kubernetes/kops · error

node name is required

Error message

node name is required

What it means

BootstrapControlPlaneNodeLabels requires the name of the node to label; this guard fires when the nodeName argument is empty (typically because the node-name source, e.g. NODE_NAME, was not provided by the caller in runApplyChannelIteration).

Source

Thrown at channels/pkg/nodelabeler/labeler.go:43

	"k8s.io/apimachinery/pkg/types"
	"k8s.io/client-go/kubernetes"
	"k8s.io/klog/v2"
	"k8s.io/kops/pkg/nodelabels"
)

type nodePatch struct {
	Metadata *nodePatchMetadata `json:"metadata,omitempty"`
}

type nodePatchMetadata struct {
	Labels map[string]string `json:"labels,omitempty"`
}

// BootstrapControlPlaneNodeLabels applies labels to the current node so that it acts as a control-plane.
// Safe to call repeatedly: the patch is skipped when the labels already match.
func BootstrapControlPlaneNodeLabels(ctx context.Context, client kubernetes.Interface, nodeName string, nodeLabels map[string]string) error {
	if nodeName == "" {
		return fmt.Errorf("node name is required")
	}

	klog.V(2).Infof("querying k8s for node %q", nodeName)
	node, err := client.CoreV1().Nodes().Get(ctx, nodeName, metav1.GetOptions{})
	if err != nil {
		return fmt.Errorf("querying node %q: %w", nodeName, err)
	}

	labels := nodelabels.BuildMandatoryControlPlaneLabels(nodeLabels)

	shouldPatch := false
	for k, v := range labels {
		if actual, found := node.Labels[k]; !found || actual != v {
			shouldPatch = true
			break
		}
	}
	if !shouldPatch {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure the node name is passed to the labeler (e.g. NODE_NAME env from the downward API)
  2. Verify the pod spec for kops-channels sets the node name field/env
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at channels/pkg/nodelabeler/labeler.go:43 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/9c67fb738a3b7fe1. Report an issue: GitHub.