kubernetes/kops · error

providerID %q not recognized for node %s

Error message

providerID %q not recognized for node %s

What it means

After confirming the providerID is non-empty, IdentifyNode validates that it starts with the "gce://" scheme. ProviderIDs from other clouds (aws://, azure://, etc.) or arbitrary strings cannot be parsed as GCE identifiers, so the node is rejected.

Source

Thrown at pkg/nodeidentity/gce/identify.go:102

	return &nodeIdentifier{
		computeService: computeService,
		project:        project,
		clusterName:    clusterName,
		capiManager:    capiManager,
	}, nil
}

// IdentifyNode queries GCE for the node identity information
func (i *nodeIdentifier) IdentifyNode(ctx context.Context, node *corev1.Node) (*nodeidentity.Info, error) {
	// log := klog.FromContext(ctx)

	providerID := node.Spec.ProviderID
	if providerID == "" {
		return nil, fmt.Errorf("providerID was not set for node %s", node.Name)
	}
	if !strings.HasPrefix(providerID, "gce://") {
		return nil, fmt.Errorf("providerID %q not recognized for node %s", providerID, node.Name)
	}

	tokens := strings.Split(strings.TrimPrefix(providerID, "gce://"), "/")
	if len(tokens) != 3 {
		return nil, fmt.Errorf("providerID %q not recognized for node %s", providerID, node.Name)
	}

	project := tokens[0]
	zone := tokens[1]
	instanceName := tokens[2]

	if project != i.project {
		return nil, fmt.Errorf("providerID %q did not match our project %q", providerID, i.project)
	}

	instance, err := i.getInstance(zone, instanceName)
	if err != nil {
		return nil, err

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the Node is actually a GCE instance; only feed GCE nodes to this identifier (check node labels like topology.kubernetes.io/region or the providerID prefix).
  2. If the node belongs to another cloud, use the corresponding nodeidentity package (pkg/nodeidentity/aws, etc.) instead.
  3. If the providerID exists but with a different scheme casing/format, fix the component that set it — the GCE CCM always writes "gce://".
  4. For migration scenarios, re-register or patch the node so spec.providerID is the GCE canonical form.

Example fix

// before
node.Spec.ProviderID = "aws:///us-east-1a/i-0abc123"
info, err := gceIdentifier.IdentifyNode(ctx, node) // not recognized
// after
node.Spec.ProviderID = "gce://my-project/us-central1-a/my-instance"
info, err := gceIdentifier.IdentifyNode(ctx, node)
Defensive patterns

Strategy: validation

Validate before calling

pid := node.Spec.ProviderID
if !strings.HasPrefix(pid, "gce://") {
    return fmt.Errorf("node %s is not a GCE node (providerID %q); use matching cloud identifier", node.Name, pid)
}

Type guard

func isGCEProviderID(node *corev1.Node) bool {
    return node != nil && strings.HasPrefix(node.Spec.ProviderID, "gce://")
}

Try / catch

info, err := identifier.IdentifyNode(ctx, node)
if err != nil && strings.Contains(err.Error(), "not recognized") {
    // route to the correct cloud's identifier or ignore non-GCE node
    return routeToCorrectIdentifier(node)
}

Prevention

When it happens

Trigger: Calling IdentifyNode with a Node whose Spec.ProviderID does not begin with "gce://" — e.g. it is "aws:///us-east-1a/i-0abc", a bare instance name, or an already-rewritten canonical ID.

Common situations: Running the GCE node-identity controller in a hybrid/multi-cloud cluster where some nodes are not GCE instances; nodes managed by another cloud provider's CCM; test fixtures with placeholder provider IDs; clusters migrated from another cloud where old providerIDs persist.

Related errors


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