Troubleshooting managed instance groups

Stay organized with collections Save and categorize content based on your preferences.

There are several issues that can prevent a managed instance group (MIG) from successfully creating or recreating a VM instance.

If your MIG cannot create or recreate instances

The problem might be related to the following situations.

The boot disk already exists

By default, a new boot persistent disk is created when you create an instance. The name of the boot disk matches the name of the VM. If you name a VM my-instance, the disk is also named my-instance. If a persistent disk already exists with that name, the request fails. To resolve this issue, you can optionally take a snapshot, and then delete the existing persistent disk.

The instance template is not valid

If you updated your instance template recently, there could be an invalid property that causes the MIG to fail VM creation. Examine the properties for these common errors:

  • You specified a resource that doesn't exist, such as a source image.
  • You misspelled a resource name.
  • You tried to attach an existing non-boot persistent disk in read/write mode but your group contains more than one VM. For groups with more than one VM, any additional disks you want to share between all of the VMs in the group can be attached only in read-only mode.

Limit exceeded for resource type

The following error occurs when you try to create more than 2000 VMs in a regional MIG or more than 1000 VMs in a zonal MIG. You have reached the size limit for your instance group.

Error message:

ERROR: (gcloud.compute.<INSTANCE_GROUP_TYPE>.<METHOD>) Could not
fetch resource:

 - Exceeded limit 'MAX_INSTANCES_IN_INSTANCE_GROUP' on resource 'PROJECT_ID'.
 Limit: NUMBER

Resolution:

To resolve this issue, try one of the following:

  • If you are using a zonal MIG, use a regional MIG instead.
  • Create multiple MIGs and split your workload across them—for example by adjusting your load balancing configuration.
  • If you still need a bigger group, contact support to make a request.

If you cannot delete your MIG or its instances

The problem might be related to the following situation.

Resource not found in zone or region

The following error occurs when you try to delete a regional MIG and you specify the --zone flag, specify no region, or specify the wrong region. A similar error can occur if you try to delete a zonal MIG and you specify the --region flag.

Error message:

  • ERROR: (gcloud.compute.instance-groups.managed.delete) Some requests did not succeed:
    ‐ The resource 'projects/PROJECT/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME' was not found
    
  • ERROR: (gcloud.compute.instance-groups.managed.delete) Some requests did not succeed:
    ‐ The resource 'projects/PROJECT/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME' was not found
    

Resolution:

To resolve this issue, try one of the following:

Resource is used by a backend service

You cannot remove an instance group when it is used by a load balancer's backend service. You must remove the instance from the backend service before you can delete the instance group.

Error message:

  • ERROR: (gcloud.compute.instance-groups.managed.delete) Some requests did not succeed:
    ‐ The instance_group_manager resource 'projects/PROJECT/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME is already being used by 'projects/PROJECT/global/backendServices/BACKEND_SERVICE
  • ERROR: (gcloud.compute.instance-groups.managed.delete) Some requests did not succeed:
    ‐ The instance_group_manager resource 'projects/PROJECT/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME is already being used by 'projects/PROJECT/global/backendServices/BACKEND_SERVICE

Resolution:

  1. Optional: Drain the backend instance group.

  2. Remove the MIG from the regional or global backend service.

    • For a zonal MIG, run the following command:

      gcloud compute backend-services remove-backend BACKEND_SERVICE \
          --instance-group=INSTANCE_GROUP_NAME \
          --instance-group-zone=ZONE \
          [--region=REGION | --global]
      
    • For a regional MIG, run the following command:

      gcloud compute backend-services remove-backend BACKEND_SERVICE  \
          --instance-group=INSTANCE_GROUP_NAME \
          --instance-group-region=REGION \
          [--region=REGION | --global]
      
  3. Delete the MIG:

    gcloud compute instance-groups managed delete INSTANCE_GROUP_NAME
    

If your MIG continually tries to recreate instances

The problem might be related to the following situation.

Health check probes cannot reach the instance

If you configured an autohealing policy but you did not configure—or misconfigured—the firewall rule that lets the health check probes reach your application, then your VMs appear unhealthy, and the MIG continuously tries to recreate them. For information about how to configure a health check firewall rule, see Example health check set up.