{"record":{"id":"1002e1d1a36b268e","repo":"kubernetes/kops","slug":"error-querying-instance-metadata-s","errorCode":null,"errorMessage":"error querying instance metadata: %s","messagePattern":"error querying instance metadata: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/azure/client.go","lineNumber":43,"sourceCode":"\t\"github.com/Azure/azure-sdk-for-go/sdk/azidentity\"\n\tcompute \"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute\"\n\t\"k8s.io/kops/upup/pkg/fi/cloudup/azure/azuremetadata\"\n)\n\n// client is an Azure client.\ntype client struct {\n\tsubscriptionID string\n\tvmClient       *compute.VirtualMachinesClient\n\tvmssClient     *compute.VirtualMachineScaleSetVMsClient\n}\n\n// newClient returns a new Client.\nfunc newClient() (*client, error) {\n\t// nodeidentity.Identifier.New does not propagate a context; the IMDS HTTP client's own timeout\n\t// bounds this call.\n\tmetadata, err := azuremetadata.QueryComputeInstanceMetadata(context.TODO())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error querying instance metadata: %s\", err)\n\t}\n\tif metadata.SubscriptionID == \"\" {\n\t\treturn nil, fmt.Errorf(\"empty subscription ID\")\n\t}\n\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating identity: %w\", err)\n\t}\n\n\tvmClient, err := compute.NewVirtualMachinesClient(metadata.SubscriptionID, cred, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating VMs client: %w\", err)\n\t}\n\n\tvmssClient, err := compute.NewVirtualMachineScaleSetVMsClient(metadata.SubscriptionID, cred, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating VMSS VMs client: %w\", err)","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/azure/client.go#L25-L61","documentation":"The Azure node-identity client could not fetch instance metadata from IMDS during construction. This runs on the node at startup; failures are typically transient (metadata service not yet reachable) or caused by IMDS access restrictions.","triggerScenarios":"Thrown at pkg/nodeidentity/azure/client.go:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the Azure IMDS endpoint (169.254.169.254) is reachable from the node","Retry node startup/registration once metadata service is available","Check that the VM's managed identity and network allow metadata queries"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}