kubernetes/kops · error
getting local IP from metadata is not supported for cloud pr
Error message
getting local IP from metadata is not supported for cloud provider: %q
What it means
GetMetadataLocalIP only implements local-IP lookup for AWS and Hetzner. Any other cloud provider falls into the default branch and returns this error, because there is no metadata lookup path implemented for that provider.
Source
Thrown at nodeup/pkg/model/context.go:632
MACAddress string `json:"mac_address"`
NetworkID int `json:"network_id"`
NetworkName string `json:"network_name"`
Network string `json:"network"`
Subnet string `json:"subnet"`
Gateway net.IP `json:"gateway"`
}
err = yaml.Unmarshal([]byte(privateNetworksYaml), &privateNetworks)
if err != nil {
return "", fmt.Errorf("failed to convert private networks to object: %w", err)
}
for _, privateNetwork := range privateNetworks {
if privateNetwork.InterfaceNum == 1 {
internalIP = privateNetwork.IP.String()
}
}
default:
return "", fmt.Errorf("getting local IP from metadata is not supported for cloud provider: %q", c.BootConfig.CloudProvider)
}
return internalIP, nil
}
func (c *NodeupModelContext) findStaticManifest(key string) *nodeup.StaticManifest {
if c == nil || c.NodeupConfig == nil {
return nil
}
for _, manifest := range c.NodeupConfig.StaticManifests {
if manifest.Key == key {
return manifest
}
}
return nil
}
func (c *NodeupModelContext) findFileAsset(path string) *kops.FileAssetSpec {View on GitHub (pinned to 4c8573c808)
Solutions
- Do not call features requiring GetMetadataLocalIP on unsupported providers; set the node IP via instance-group or cluster spec instead
- Verify spec.cloudProvider in the cluster spec matches the actual infrastructure
- Implement the provider case in GetMetadataLocalIP (nodeup/pkg/model/context.go) and contribute upstream if you need that provider
- Use a kOps version where your provider is supported for this code path
Example fix
// before (kops ClusterSpec) cloudProvider: aws // after (match real infrastructure, e.g. Hetzner) cloudProvider: hetzner
Defensive patterns
Strategy: validation
Validate before calling
import "k8s.io/kops/pkg/apis/kops"
func localIPMetadataSupported(p kops.CloudProviderID) bool {
switch p {
case kops.CloudProviderAWS, kops.CloudProviderHetzner:
return true
}
return false
}
// before relying on metadata: if !localIPMetadataSupported(c.BootConfig.CloudProvider) { configure IP explicitly } Type guard
func supportsMetadataLocalIP(p kops.CloudProviderID) bool {
return p == kops.CloudProviderAWS || p == kops.CloudProviderHetzner
} Try / catch
ip, err := ctx.GetMetadataLocalIP(nodeCtx)
if err != nil {
if strings.Contains(err.Error(), "not supported for cloud provider") {
// fall back to explicitly configured node IP
ip = cfg.NodeIP
} else {
return err
}
} Prevention
- Check provider support before using features that depend on metadata local-IP lookup
- Keep spec.cloudProvider consistent with the actual cloud the node runs on
- Set an explicit node IP in the instance group spec for unsupported providers
- Read kOps release notes for which providers support each bootstrap feature
When it happens
Trigger: nodeup's BootConfig.CloudProvider is something other than 'aws' or 'hetzner' (e.g. gce, azure, openstack, digitalocean, do) while a caller (Build, writeServerCertificate, buildSystemdEnvironmentFile) requests the metadata local IP.
Common situations: Clusters on GCE/Azure/OpenStack where this feature simply is not implemented; misconfigured cluster spec setting the wrong cloud provider; running nodeup built for one provider against a cluster of another.
Related errors
- unsupported cloud provider for authenticator %q
- failed to load AWS config: %w
- failed to get local-ipv4 address from ec2 metadata: %w
- error loading AWS config: %v
- error querying Azure instance metadata: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/8e0114d1e9f5f222.
Report an issue: GitHub.