A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/compute/docs/instance-groups/getting-info-about-migs below:

View info about MIGs and managed instances | Compute Engine Documentation

Use the methods on this page to view information about your managed instance groups (MIGs) and to view information about the virtual machine (VM) instances within each MIG.

Note: Various policies and actions can create, delete, and modify instances that are managed by a MIG. Those operations are returned as DONE after the group has scheduled actions to create, delete, or update those instances. However, this doesn't mean that the instances in the group have been created, deleted, or updated until those underlying actions are complete. You must verify the status of the group, or alternatively verify the status of those instances. Before you begin View info about MIGs

You can retrieve information about groups themselves, for example, to inspect the policies that are attached to the group and to check if the group is stable or undergoing changes. To get info about the VM instances within a MIG, see View info about managed instances.

List MIGs

To get a list of your managed instance groups, use the console, the gcloud CLI, or REST.

Console
  1. In the Google Cloud console, go to the Instance groups page.

    Go to Instance groups.

    If you have existing instance groups, the page lists those groups, including both managed instance groups and unmanaged instance groups.

    The Group type column specifies whether the group is managed, stateful, or unmanaged. The stateful group types are also managed instance groups.

gcloud

List all managed instance groups within a project:

gcloud compute instance-groups managed list
REST

For zonal MIGs, call the instanceGroupManagers.list method method:

GET https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroupManagers

For regional MIGs, call the regionInstanceGroupManagers.list method.

GET https://compute.googleapis.com/compute/v1/projects/project-id/regions/region/instanceGroupManagers
View a MIG's properties

To view information about a specific MIG, including its policies (for example, the group's autohealing and update policies), use the console, the gcloud CLI, or REST.

To view the group's id value, you must use the gcloud CLI or the Compute Engine API.

Permissions required for this task

To perform this task, you must have the following permissions:

Console
  1. In the Google Cloud console, go to the Instance groups page.

    Go to Instance groups.

    If you have existing instance groups, the page lists those groups. The page also lists unmanaged instance groups.

  2. Under the Name column of the list, click the name of the instance group that you want to examine. A page opens with the instance group properties and a list of instances that are included in the group.

  3. Click Details to see the group's configuration.

gcloud

To get information about a specific group:

gcloud compute instance-groups managed describe instance-group \
    [--zone zone | --region region]

The command returns details about the group, including attached policies.

Use the --format flag to limit the output. For example, the following command only returns the group's autoscaler configuration if it exists.

gcloud compute instance-groups managed describe instance-group --format="(autoscaler)"
REST

For zonal MIG, call the instanceGroupManagers.get method. For regional MIGs, call the regionInstanceGroupManagers.get method.

GET https://compute.googleapis.com/compute/v1/projects/project-id/regions/region/instanceGroupManagers/instance-group

The response includes details about the group, including attached policies except for the group's autoscaling policy. Although autoscaling is a feature of MIGs, it is a separate REST resource.

Autoscaling policy

If an autoscaler is attached to the group, the autoscaler resource is listed in the group's status.autoscaler field.

To get information about that autoscaler, call the autoscalers.get method for a zonal MIG or the regionAutoscalers.get method for a regional MIG. The URL of the autoscaler resource includes its name, which, by default, is the name of the group that the autoscaler is attached to. For example, you might make the following request for a regional MIG's autoscaler:

GET https://compute.googleapis.com/compute/v1/projects/project-id/regions/region/regionAutoscalers/mig_name
Check whether a MIG is stable

Several commands and requests create, delete, and modify instances in a managed instance group. Those operations are returned as DONE after the group has scheduled actions to create, delete, or update those instances. However, this doesn't mean that instances in the group have been created, deleted, or updated until those underlying actions are complete. You must verify the status of the group, or alternatively verify the status of those instances.

A managed instance group is stable when all instances in the managed instance group are not undergoing any change, no future changes are scheduled for the instances, and the group itself is not being modified.

You might need to know whether the group is stable when you have dependencies that rely on all instances in the group being healthy and serving. For example, you might want to start scheduling jobs, sending traffic, or assigning key ranges after you have confirmation that all the VMs are running and healthy.

Verify that all instances in a managed instance group are running and healthy by checking the value of the group's status.isStable field.

gcloud

Use the describe command:

gcloud compute instance-groups managed describe instance-group-name \
    [--zone zone | --region region]

The gcloud CLI returns detailed information about the MIG including its status.isStable field.

To pause a script until the MIG is stable, use the wait-until command with the --stable flag. For example:

gcloud compute instance-groups managed wait-until instance-group-name \
    --stable \
    [--zone zone | --region region]
Waiting for group to become stable, current operations: deleting: 4
Waiting for group to become stable, current operations: deleting: 4
...
Group is stable

The command returns after status.isStable is set to true for the MIG.

REST

For a zonal MIG, make a GET request to the instanceGroupManagers.get method:

GET https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroupManagers/instance-group-name/get

For a regional managed instance group, replace zones/zone with regions/region:

GET https://compute.googleapis.com/compute/v1/projects/project-id/regions/region/instanceGroupManagers/instance-group-name/get

These requests returns detailed information about the MIG including its status.isStable field.

status.isStable set to false indicates that changes are active, pending, or that the MIG itself is being modified.

status.isStable set to true indicates the following:

Remember that the stability of a MIG depends on numerous factors because a MIG can be modified in numerous ways. For example:

As soon as all actions are finished, status.isStable is set to true again for that MIG.

For individual VM instances, see Checking the status of managed instances.

Check whether VM repairs are turned off in a MIG

To check whether VM repairs are turned off in a MIG, use the console, the gcloud CLI, or REST.

Permissions required for this task

To perform this task, you must have the following permissions:

Console
  1. In the Google Cloud console, go to the Instance groups page.

    Go to Instance groups

  2. Click the name of the instance group that you want to view. A page opens with the instance group properties and a list of VM instances that are in the group.
  3. Click the Details tab.
  4. In the VM instance lifecycle section, check the values of the following fields:

gcloud

Use the beta describe method as follows:

gcloud beta compute instance-groups managed describe instance-group \
    --format="(instanceLifecyclePolicy)" \
    --zone=zone

Replace the following:

In the output, check the following values:

The following is a sample output when repairs of failed and unhealthy VMs are turned off in a MIG:

  instanceLifecyclePolicy:
    defaultActionOnFailure: DO_NOTHING
    forceUpdateOnRepair: NO
    onFailedHealthCheck: DEFAULT_ACTION
REST

For a zonal MIG, use the beta instanceGroupManagers.get method, or, for a regional MIG, use the beta regionInstanceGroupManagers.get method.

To view the MIG action on VM failures in a zonal MIG, make the following call:

GET https://compute.googleapis.com/compute/beta/projects/project_ID/zones/zone/instanceGroupManagers/instance_group

In the response body, check the values of the following fields:

The following is a sample output when repairs of failed and unhealthy VMs are turned off in a MIG:

...
"instanceLifecyclePolicy": {
  "forceUpdateOnRepair": "NO",
  "defaultActionOnFailure": "DO_NOTHING",
  "onFailedHealthCheck": "DEFAULT_ACTION"
}
...

If the repairs are turned off and you want to turn them back on again, see Turn on repairs or autohealing.

View historical autohealing operations

If you configured autohealing, then you can view past autohealing events.

Monitor rolling updates

If you initiated a rolling update, and want to know when the update is complete, then see Monitoring updates.

View stateful configuration

If you configured a stateful MIG and want to review your configuration, then see Viewing stateful configuration.

View details about the managed VM instances within a MIG

This section explains how to view various details about managed instances in a MIG.

List a MIG's managed instances

To view a list of the managed instances in a group, including their states and templates, use the console, the gcloud CLI, or REST.

Permissions required for this task

To perform this task, you must have the following permissions:

Console
  1. In the Google Cloud console, go to the Instance groups page.

    Go to Instance groups.

    If you have existing instance groups, the page lists those groups. The page also lists unmanaged instance groups.

  2. Under the Name column of the list, click the name of the instance group that you want to examine. A page opens with the instance group properties and a list of instances that are included in the group.

gcloud

Use the gcloud CLI list-instances sub-command.

gcloud compute instance-groups managed list-instances instance-group \
    [--zone zone | --region region]

The command returns a list of instances and their details, including their current status, instance template, and last error.

REST

For a zonal MIG, construct a GET request to the instanceGroupManagers.listManagedInstances method and include the name of a specific managed instance group:

GET https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroupManagers/instance-group

For regional (multiple-zone) managed instance groups, use the regionInstanceGroupManagers resource instead: regionInstanceGroupManagers.list.

GET https://compute.googleapis.com/compute/v1/projects/project-id/regions/region/instanceGroupManagers/instance-group

The response includes a list of instances and their details, including their current status and instance template.

Check the status of managed instances

Several commands and requests create, delete, and modify instances in a managed instance group. Those operations are returned as DONE after the group has scheduled actions to create, delete, or update those instances. However, this doesn't mean that instances in the group have been created, deleted, or updated until those underlying actions are complete. You must verify the status of those instances, or alternatively verify the status of the group itself.

Use the Google Cloud CLI or REST to see details about the instances in a managed instance group. Details include instance status and current actions that the group is performing on its instances.

Permissions required for this task

To perform this task, you must have the following permissions:

gcloud

All managed instances

To check the status and current actions on all instances in the group, use the list-instances command.

gcloud compute instance-groups managed list-instances INSTANCE_GROUP_NAME \
    [--zone=ZONE | --region=REGION]

The command returns a list of instances in the group, including their status, current actions, and other details:

NAME: vm-instances-9pk4
ZONE: us-central1-f
STATUS:
HEALTH_STATE:
ACTION: CREATING
INSTANCE_TEMPLATE: my-new-template
VERSION_NAME:
LAST_ERROR:

NAME: vm-instances-h2r1
ZONE: us-central1-f
STATUS: STOPPING
HEALTH_STATE:
ACTION: DELETING
INSTANCE_TEMPLATE: my-old-template
VERSION_NAME:
LAST_ERROR:

The HEALTH_STATE column appears empty unless you have set up health checking.

A specific managed instance

To check the status and current action for a specific instance in the group, use the describe-instance command.

gcloud compute instance-groups managed describe-instance INSTANCE_GROUP_NAME \
    --instance INSTANCE_NAME \
    [--zone=ZONE | --region=REGION]

The command returns details about the instance, including instance status, current action, and, for stateful MIGs, preserved state:

currentAction: NONE
id: '6789072894767812345'
instance: https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/instances/example-mig-hz41
instanceStatus: RUNNING
name: example-mig-hz41
preservedStateFromConfig:
  metadata:
    example-key: example-value
preservedStateFromPolicy:
  disks:
    persistent-disk-0:
      autoDelete: NEVER
      mode: READ_WRITE
      source: https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/disks/example-mig-hz41
version:
  instanceTemplate: https://www.googleapis.com/compute/v1/projects/example-project/global/instanceTemplates/example-template
REST

Call the listManagedInstances method on a regional or zonal MIG resource. For example, to see details about the instances in a zonal MIG resource, you can make the following request:

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME/listManagedInstances

The call returns a list of instances for the MIG including each instance's instanceStatus and currentAction.

{
  "managedInstances": [
    {
      "instance": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-f/instances/vm-instances-prvp",
      "instanceStatus": "RUNNING",
      "currentAction": "REFRESHING",
      "id": "5317605642920955957",
      "version": {
        instanceTemplate": "https://www.googleapis.com/compute/v1/projects/example-project/global/instanceTemplates/example-template"
      },
      "name": "vm-instances-prvp"
    },
    {
      "instance": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-f/instances/vm-instances-w2t5",
      "instanceStatus": "RUNNING",
      "currentAction": "REFRESHING",
      "id": "2800161036826218547",
      "version": {
        "instanceTemplate": "https://www.googleapis.com/compute/v1/projects/example-project/global/instanceTemplates/example-template"
      },
      "name": "vm-instances-w2t5"
    }
  ]
}

If you set up health checking, then the response also includes the instanceHealth field.

To see a list of valid instanceStatus field values, see VM instance lifecycle.

If an instance is undergoing some type of change, the managed instance group sets the instance's currentAction field to one of the following actions to help you track the progress of the change. Otherwise, the currentAction field is set to NONE.

Possible currentAction values are:

To check if the group as a whole is stable or is undergoing changes, see Checking the status of the group.

Check health states

If you have configured autohealing for your managed instance group, you can review the health state of each VM. See Checking health status.

List instance errors

If your managed instances encountered errors, you can view those errors to diagnose and mitigate the cause.

Use the Google Cloud console, the gcloud CLI, or REST to list errors.

Console
  1. In the Google Cloud console, go to the Instance groups page.

    Go to Instance groups

  2. Under the Name column of the list, click the name of the instance group that you want to examine. A page opens with the instance group properties and a list of instances that are included in the group.

  3. Click Errors.

gcloud

Use the instance-groups managed list-errors command to list the most recent errors in the group

gcloud compute instance-groups managed list-errors instance-group-name \
    [--zone zone | --region region]

For example:

gcloud compute instance-groups managed list-errors example-group \
    --region us-west1
INSTANCE_URL                                                                                        ACTION    ERROR_CODE      ERROR_MESSAGE                                                                                     TIMESTAMP                      INSTANCE_TEMPLATE                                                                                                            VERSION_NAME

https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances/igm-1-v0hl  CREATING  QUOTA_EXCEEDED  Instance 'igm-1-v0hl' creation failed: Quota 'CPUS' exceeded.  Limit: 1.0 in zone us-central1-a.  2019-07-11T07:44:40.156-07:00  https://www.googleapis.com/compute/v1/projects/my-project/global/instanceTemplates/instance-template-1
https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances/igm-1-qp3d  CREATING  QUOTA_EXCEEDED  Instance 'igm-1-qp3d' creation failed: Quota 'CPUS' exceeded.  Limit: 1.0 in zone us-central1-a.  2019-07-11T07:44:40.081-07:00  https://www.googleapis.com/compute/v1/projects/my-project/global/instanceTemplates/instance-template-1
...
REST

Construct a GET request to the listErrors method for a zonal or regional managed instance group.

For example:

GET https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroupManagers/instance-group-name/listErrors&maxResults=100

The request gets a response similar to:

{
 "items": [
  {
   "error": {
    "code": "QUOTA_EXCEEDED",
    "message": "Instance 'example-mig-m1sz' creation failed: Quota 'CPUS' exceeded.  Limit: 50.0 in zone us-central1-c."
   },
   "timestamp": "2019-01-03T18:47:28.457-08:00",
   "instanceDetails" : {
    "instance": "zones/us-central1-c/instances/example-mig-m1sz",
    "action": "CREATING",
    "version": {
     "name": "example-version-name",
     "instanceTemplate": "global/instanceTemplates/example-template",
    }
   }
  }
 ],
 ...
 "nextPageToken": "Ch0yMDE5LTA3LTI5VDExOjA4OjA2LjYxMi0wNzowMBJ5aHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vY29tcHV0ZS9zdGFnaW5nX2FscGhhL3Byb2plY3RzL215cnpha2VyZXltcy1zdGFnaW5nL3pvbmVzL3VzLWNlbnRyYWwxLWlyMS9pbnN0YW5jZXMvaWdtLTEtcXAzZA=="
}

The listErrors API supports list pagination. To get the next page of results, use the nextPageToken field from one response in a subsequent request. For example: GET https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroupManagers/instance-group-name/listErrors&maxResults=100&nextPageToken=next-page-token, replacing next-page-token with the token that was obtained from the previous response.

The list of possible errors includes, but is not limited to, the following examples:

After inspecting such errors, you can mitigate them. For example:

If an action that is triggered by a managed instance group fails (for example, if an autoscaler encounters an error when attempting to increase the group's size), the group might immediately retry that action. If the last immediate retry attempt fails, the MIG records the error, and you can view the error by listing instance errors. After some backoff time, the group again retries the failed action. If the error persists, it might be recorded multiple times.

Compute Engine retains the most recent 500 errors for the last 8 days even if the underlying instances no longer exist or couldn't be created.

Check if a VM instance is part of a MIG

To check if a specific VM is a member of a group, you can use the console or REST.

Console
  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Click an instance to access its VM instance details.
  3. If the VM instance is a member of a managed instance group, the name of that managed instance group appears under the heading In use by. If the VM instance is not a member of a group, the heading In use by doesn't appear on the instance details page.
REST

See Viewing referrers to VM instances.

Alternatively, to identify whether a VM is or was a member of a managed instance group, look for these two metadata keys in the instance's metadata:

Even if you abandon the instance, the VM will still have these metadata entries, unless you manually remove them.

For example, if there was an VM named random-instance-biy and you wanted to know whether the VM was created by a managed instance group, you can describe the instance and look for the metadata keys. For example:

gcloud compute instances describe random-instance-biy \
    --zone us-central1-f

gcloud CLI returns a response similar to:

canIpForward: false
cpuPlatform: Intel Ivy Bridge
creationTimestamp: '2016-08-24T14:11:38.012-07:00'
...
metadata:
  items:
  - key: instance-template
    value: projects/123456789012/global/instanceTemplates/example-it
  - key: created-by
    value: projects/123456789012/zones/us-central1-f/instanceGroupManagers/igm-metadata
View the preserved state of a managed instance

If you configured a stateful MIG and want to view the preserved state of each managed instance, see Viewing stateful configuration and preserved state.

What's next

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4