Change:
} // NodeAddresses is an implementation of Instances.NodeAddresses. <del> func (g *Cloud) NodeAddresses(_ context.Context, _ types.NodeName) ([]v1.NodeAddress, error) { internalIP, err := metadata.Get("instance/network-interfaces/0/ip") if err != nil { return nil, fmt.Errorf("couldn't get internal IP: %v", err) </del> <ins> func (g *Cloud) NodeAddresses(ctx context.Context, nodeName types.NodeName) ([]v1.NodeAddress, error) { timeoutCtx, cancel := context.WithTimeout(ctx, 1*time.Hour) defer cancel() instanceName := string(nodeName) if g.useMetadataServer { // Use metadata server if possible if g.isCurrentInstance(instanceName) { internalIP, err := metadata.Get("instance/network-interfaces/0/ip") if err != nil { return nil, fmt.Errorf("couldn't get internal IP: %v", err) } externalIP, err := metadata.Get("instance/network-interfaces/0/access-configs/0/external-ip") if err != nil { return nil, fmt.Errorf("couldn't get external IP: %v", err) } addresses := []v1.NodeAddress{ {Type: v1.NodeInternalIP, Address: internalIP}, {Type: v1.NodeExternalIP, Address: externalIP}, } if internalDNSFull, err := metadata.Get("instance/hostname"); err != nil { klog.Warningf("couldn't get full internal DNS name: %v", err) } else { addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalDNS, Address: internalDNSFull}, v1.NodeAddress{Type: v1.NodeHostName, Address: internalDNSFull}, ) } return addresses, nil } </ins> } <del> externalIP, err := metadata.Get("instance/network-interfaces/0/access-configs/0/external-ip") </del> <ins> // Use GCE API instanceObj, err := g.getInstanceByName(instanceName) </ins> if err != nil { <del> return nil, fmt.Errorf("couldn't get external IP: %v", err) } addresses := []v1.NodeAddress{ {Type: v1.NodeInternalIP, Address: internalIP}, {Type: v1.NodeExternalIP, Address: externalIP}, </del> <ins> return nil, fmt.Errorf("couldn't get instance details: %v", err) </ins> } <del> if internalDNSFull, err := metadata.Get("instance/hostname"); err != nil { klog.Warningf("couldn't get full internal DNS name: %v", err) } else { addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalDNS, Address: internalDNSFull}, v1.NodeAddress{Type: v1.NodeHostName, Address: internalDNSFull}, ) </del> <ins> instance, err := g.c.Instances().Get(timeoutCtx, meta.ZonalKey(canonicalizeInstanceName(instanceObj.Name), instanceObj.Zone)) if err != nil { return []v1.NodeAddress{}, fmt.Errorf("error while querying for instance: %v", err) </ins> } <del> return addresses, nil </del> <ins> return nodeAddressesFromInstance(instance) </ins> } // NodeAddressesByProviderID will not be called from the node that is requesting this ID.

Discussion:
What would you like to be : Please see Implement Instances::NodeAddresses so it doesn't ignore the node input. Why is this needed: The current implementation assumes it will be only run on the Kubelet. That is no longer a valid assumption and in fact it the nearish future it will no longer be run on the Kubelet.
/sig cloud-provider /area provider/gcp
This issue is about the GCE implementation found at This problem cannot be fixed in the cloud node controller.
According to is indeed only used for the address of the calling instance. Maybe we should use instead? Note that implements
Or, we should definitely remove the if its TODO item is no longer true.
I believe the TODO is no longer true as there is also a call in