kubernetes/kops · error

querying node %q: %w

Error message

querying node %q: %w

What it means

BootstrapControlPlaneNodeLabels fetches the Node object from the API to compare labels; this wraps that GET failing. The node name was provided, so the fault is an API-level error: node not found yet, RBAC denial, or connectivity.

Source

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

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 {
		return nil
	}

	klog.V(2).Infof("patching node %q to add labels %v", nodeName, labels)
	patch, err := json.Marshal(&nodePatch{
		Metadata: &nodePatchMetadata{Labels: labels},

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the node object with the given name exists (node registration may lag boot)
  2. Check RBAC allows the kops-channels service account to get nodes
  3. Inspect the wrapped error for the API server reason
Defensive patterns

Strategy: retry

When it happens

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