{"record":{"id":"5934e5daf1739bc0","repo":"kubernetes/kops","slug":"error-fetching-gce-managed-instance-group-q-v","errorCode":null,"errorMessage":"error fetching GCE managed instance group %q: %v","messagePattern":"error fetching GCE managed instance group %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/gce/identify.go","lineNumber":237,"sourceCode":"\n\treturn instance, nil\n}\n\n// getInstanceTemplate queries GCE for the IG Template with the specified name, returning an error if not found\nfunc (i *nodeIdentifier) getInstanceTemplate(name string) (*compute.InstanceTemplate, error) {\n\tt, err := i.computeService.InstanceTemplates.Get(i.project, name).Do()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error fetching GCE instance group template %q: %v\", name, err)\n\t}\n\n\treturn t, nil\n}\n\n// getMIG queries GCE for the MIG with the specified name, returning an error if not found\nfunc (i *nodeIdentifier) getMIG(zone string, migName string) (*compute.InstanceGroupManager, error) {\n\tmig, err := i.computeService.InstanceGroupManagers.Get(i.project, zone, migName).Do()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error fetching GCE managed instance group %q: %v\", migName, err)\n\t}\n\n\treturn mig, nil\n}\n\n// getManagedInstance queries GCE for the instance from the MIG\nfunc (i *nodeIdentifier) getManagedInstance(ctx context.Context, mig *compute.InstanceGroupManager, instanceID uint64) (*compute.ManagedInstance, error) {\n\tvar matches []*compute.ManagedInstance\n\n\tfilter := \"id=\" + strconv.FormatUint(instanceID, 10)\n\tzone := lastComponent(mig.Zone)\n\tif err := i.computeService.InstanceGroupManagers.ListManagedInstances(i.project, zone, mig.Name).Filter(filter).Pages(ctx, func(page *compute.InstanceGroupManagersListManagedInstancesResponse) error {\n\t\t// Post-filter... filters aren't implemented (b/27605549)\n\t\tfor _, instance := range page.ManagedInstances {\n\t\t\tif instance.Id != instanceID {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmatches = append(matches, instance)","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/gce/identify.go#L219-L255","documentation":"The GCE managed instance group (MIG) named by the node's identity could not be fetched from the Compute Engine API during node identity resolution. kops needs the MIG to walk its instances and map the kubelet instance ID to a GCE instance. It wraps the underlying googleapi error with the MIG name.","triggerScenarios":"i.computeService.InstanceGroupManagers.Get(project, zone, migName).Do() fails: MIG deleted/renamed, wrong zone, missing compute.instanceGroupManagers.get permission, or API error (403/404/429/5xx).","commonSituations":"Node outlived its MIG after cluster teardown or migration; zone moved (kops renames instance groups across zones); controller service account IAM stripped; MIG name in providerID/instance metadata stale.","solutions":["Confirm the MIG exists in that zone: gcloud compute instance-groups managed describe <name> --zone <zone> --project <project>","Grant the controller's service account compute.instanceGroupManagers.get (roles/compute.viewer)","Recreate/replace the node so it belongs to a live MIG (kops rolling-update)","Retry on transient API failures (429/5xx)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"migExists, err := computeService.InstanceGroupManagers.Get(project, zone, migName).Do(); migExists != nil // precheck","typeGuard":"func migValid(m *compute.InstanceGroupManager, err error) bool { return err == nil && m != nil }","tryCatchPattern":"mig, err := getMIG(zone, name)\nif err != nil {\n  if isNotFound(err) { /* node outlived MIG: delete stale Node */ }\n  return err\n}","preventionTips":["Never delete MIGs while their Nodes are still registered","Use kops rolling-update instead of manual MIG deletion","Verify IAM on the kops-controller service account after IAM changes"],"tags":["gce","node-identity","mig","api-error"],"backgroundTag":"gcp-api-fetch-failed","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"}