mirror of
https://github.com/imjasonh/gcloud-help
synced 2026-07-08 18:45:13 +00:00
313 lines
14 KiB
Text
313 lines
14 KiB
Text
NAME
|
|
gcloud compute instance-groups managed create - create a Compute Engine
|
|
managed instance group
|
|
|
|
SYNOPSIS
|
|
gcloud compute instance-groups managed create NAME --size=SIZE
|
|
--template=TEMPLATE [--base-instance-name=BASE_INSTANCE_NAME]
|
|
[--description=DESCRIPTION] [--initial-delay=INITIAL_DELAY]
|
|
[--instance-redistribution-type=TYPE]
|
|
[--list-managed-instances-results=MODE]
|
|
[--stateful-disk=[auto-delete=AUTO-DELETE],[device-name=DEVICE-NAME]]
|
|
[--target-distribution-shape=SHAPE] [--target-pool=[TARGET_POOL,...]]
|
|
[--zones=ZONE,[ZONE,...]]
|
|
[--health-check=HEALTH_CHECK | --http-health-check=HTTP_HEALTH_CHECK
|
|
| --https-health-check=HTTPS_HEALTH_CHECK]
|
|
[--region=REGION | --zone=ZONE]
|
|
[--update-policy-max-surge=MAX_SURGE
|
|
--update-policy-max-unavailable=MAX_UNAVAILABLE
|
|
--update-policy-minimal-action=UPDATE_POLICY_MINIMAL_ACTION
|
|
--update-policy-most-disruptive-action=UPDATE_POLICY_MOST_DISRUPTIVE_ACTION --update-policy-replacement-method=UPDATE_POLICY_REPLACEMENT_METHOD --update-policy-type=UPDATE_TYPE]
|
|
[GCLOUD_WIDE_FLAG ...]
|
|
|
|
DESCRIPTION
|
|
gcloud compute instance-groups managed create creates a Compute Engine
|
|
managed instance group.
|
|
|
|
EXAMPLES
|
|
Running:
|
|
|
|
$ gcloud compute instance-groups managed create \
|
|
example-managed-instance-group --zone=us-central1-a \
|
|
--template=example-global-instance-template --size=1
|
|
|
|
will create a managed instance group called
|
|
'example-managed-instance-group' in the us-central1-a zone with a global
|
|
instance template resource 'example-global-instance-template'.
|
|
|
|
To use a regional instance template, specify the full or partial URL of the
|
|
template.
|
|
|
|
Running:
|
|
|
|
$ gcloud compute instance-groups managed create \
|
|
example-managed-instance-group --zone=us-central1-a \
|
|
--template=projects/example-project/regions/us-central1/\
|
|
instanceTemplates/example-regional-instance-template --size=1
|
|
|
|
will create a managed instance group called
|
|
'example-managed-instance-group' in the us-central1-a zone with a regional
|
|
instance template resource 'example-regional-instance-template'.
|
|
|
|
POSITIONAL ARGUMENTS
|
|
NAME
|
|
Name of the managed instance group to create.
|
|
|
|
REQUIRED FLAGS
|
|
--size=SIZE
|
|
Initial number of instances you want in this group.
|
|
|
|
--template=TEMPLATE
|
|
Specifies the instance template to use when creating new instances. An
|
|
instance template is either a global or regional resource.
|
|
|
|
OPTIONAL FLAGS
|
|
--base-instance-name=BASE_INSTANCE_NAME
|
|
Base name to use for the Compute Engine instances that will be created
|
|
with the managed instance group. If not provided base instance name
|
|
will be the prefix of instance group name.
|
|
|
|
--description=DESCRIPTION
|
|
An optional description for this group.
|
|
|
|
--initial-delay=INITIAL_DELAY
|
|
Specifies the number of seconds that a new VM takes to initialize and
|
|
run its startup script. During a VM's initial delay period, the MIG
|
|
ignores unsuccessful health checks because the VM might be in the
|
|
startup process. This prevents the MIG from prematurely recreating a
|
|
VM. If the health check receives a healthy response during the initial
|
|
delay, it indicates that the startup process is complete and the VM is
|
|
ready. The value of initial delay must be between 0 and 3600 seconds.
|
|
The default value is 0. See $ gcloud topic datetimes for information on
|
|
duration formats.
|
|
|
|
--instance-redistribution-type=TYPE
|
|
Specifies the type of the instance redistribution policy. An instance
|
|
redistribution type lets you enable or disable automatic instance
|
|
redistribution across zones to meet the group's target distribution
|
|
shape.
|
|
|
|
An instance redistribution type can be specified only for a
|
|
non-autoscaled regional managed instance group. By default it is set to
|
|
proactive.
|
|
|
|
TYPE must be one of:
|
|
|
|
none
|
|
The managed instance group does not redistribute instances across
|
|
zones.
|
|
proactive
|
|
The managed instance group proactively redistributes instances to
|
|
meet its target distribution.
|
|
|
|
--list-managed-instances-results=MODE
|
|
Pagination behavior for the group's listManagedInstances API method.
|
|
This flag does not affect the group's gcloud or console list-instances
|
|
behavior. By default it is set to pageless. MODE must be one of:
|
|
|
|
pageless
|
|
Pagination is disabled for the group's listManagedInstances API
|
|
method. maxResults and pageToken query parameters are ignored and
|
|
all instances are returned in a single response.
|
|
paginated
|
|
Pagination is enabled for the group's listManagedInstances API
|
|
method. maxResults and pageToken query parameters are respected.
|
|
|
|
--stateful-disk=[auto-delete=AUTO-DELETE],[device-name=DEVICE-NAME]
|
|
Disks considered stateful by the instance group. Managed instance
|
|
groups preserve and reattach stateful disks on VM autohealing, update,
|
|
and recreate events.
|
|
|
|
Use this argument multiple times to attach more disks.
|
|
|
|
device-name
|
|
(Required) Device name of the disk to mark stateful.
|
|
|
|
auto-delete
|
|
(Optional) Specifies the auto deletion policy of the stateful disk.
|
|
The following options are available:
|
|
▸ never: (Default) Never delete this disk. Instead, detach the
|
|
disk when its instance is deleted.
|
|
▸ on-permanent-instance-deletion: Delete the stateful disk when
|
|
the instance that it's attached to is permanently deleted from
|
|
the group; for example, when the instance is deleted manually or
|
|
when the group size is decreased.
|
|
|
|
--target-distribution-shape=SHAPE
|
|
Specifies how a regional managed instance group distributes its
|
|
instances across zones within the region. The default shape is even.
|
|
SHAPE must be one of:
|
|
|
|
any
|
|
The group picks zones for creating VM instances to fulfill the
|
|
requested number of VMs within present resource constraints and to
|
|
maximize utilization of unused zonal reservations. Recommended for
|
|
batch workloads that do not require high availability.
|
|
balanced
|
|
The group prioritizes acquisition of resources, scheduling VMs in
|
|
zones where resources are available while distributing VMs as
|
|
evenly as possible across selected zones to minimize the impact of
|
|
zonal failure. Recommended for highly available serving or batch
|
|
workloads that do not require autoscaling.
|
|
even
|
|
The group schedules VM instance creation and deletion to achieve
|
|
and maintain an even number of managed instances across the
|
|
selected zones. The distribution is even when the number of managed
|
|
instances does not differ by more than 1 between any two zones.
|
|
Recommended for highly available serving workloads.
|
|
|
|
--target-pool=[TARGET_POOL,...]
|
|
Specifies any target pools you want the instances of this managed
|
|
instance group to be part of.
|
|
|
|
--zones=ZONE,[ZONE,...]
|
|
If this flag is specified a regional managed instance group will be
|
|
created. The managed instance group will be in the same region as
|
|
specified zones and will spread instances in it between specified
|
|
zones.
|
|
|
|
All zones must belong to the same region. You may specify --region flag
|
|
but it must be the region to which zones belong. This flag is mutually
|
|
exclusive with --zone flag.
|
|
|
|
At most one of these can be specified:
|
|
|
|
--health-check=HEALTH_CHECK
|
|
Name of the health check to operate on.
|
|
|
|
--http-health-check=HTTP_HEALTH_CHECK
|
|
(DEPRECATED) HTTP health check object used for autohealing instances
|
|
in this group.
|
|
|
|
HttpHealthCheck is deprecated. Use --health-check instead.
|
|
|
|
--https-health-check=HTTPS_HEALTH_CHECK
|
|
(DEPRECATED) HTTPS health check object used for autohealing instances
|
|
in this group.
|
|
|
|
HttpsHealthCheck is deprecated. Use --health-check instead.
|
|
|
|
At most one of these can be specified:
|
|
|
|
--region=REGION
|
|
Region of the managed instance group to create. If not specified, you
|
|
might be prompted to select a region (interactive mode only).
|
|
|
|
A list of regions can be fetched by running:
|
|
|
|
$ gcloud compute regions list
|
|
|
|
If you specify --zones flag this flag must be unspecified or specify
|
|
the region to which the zones you listed belong.
|
|
|
|
Overrides the default compute/region property value for this command
|
|
invocation.
|
|
|
|
--zone=ZONE
|
|
Zone of the managed instance group to create. If not specified, you
|
|
might be prompted to select a zone (interactive mode only).
|
|
|
|
A list of zones can be fetched by running:
|
|
|
|
$ gcloud compute zones list
|
|
|
|
Overrides the default compute/zone property value for this command
|
|
invocation.
|
|
|
|
Parameters for setting update policy for this managed instance group.
|
|
|
|
--update-policy-max-surge=MAX_SURGE
|
|
Maximum additional number of VMs that can be created during the
|
|
update process. This can be a fixed number (e.g. 5) or a percentage
|
|
of size to the managed instance group (e.g. 10%).
|
|
|
|
--update-policy-max-unavailable=MAX_UNAVAILABLE
|
|
Maximum number of VMs that can be unavailable during the update
|
|
process. This can be a fixed number (e.g. 5) or a percentage of size
|
|
to the managed instance group (e.g. 10%). Defaults to the number of
|
|
zones in which the managed instance group operates.
|
|
|
|
--update-policy-minimal-action=UPDATE_POLICY_MINIMAL_ACTION
|
|
Use this flag to minimize disruption as much as possible or to apply
|
|
a more disruptive action than is strictly necessary. The MIG performs
|
|
at least this action on each VM while updating. If the update
|
|
requires a more disruptive action than the one specified here, then
|
|
the more disruptive action is performed. UPDATE_POLICY_MINIMAL_ACTION
|
|
must be one of:
|
|
|
|
none
|
|
No action
|
|
refresh
|
|
Apply the new configuration without stopping VMs, if possible.
|
|
For example, use ``refresh`` to apply changes that only affect
|
|
metadata or additional disks.
|
|
restart
|
|
Apply the new configuration without replacing VMs, if possible.
|
|
For example, stopping VMs and starting them again is sufficient
|
|
to apply changes to machine type.
|
|
replace
|
|
Replace old VMs according to the
|
|
--update-policy-replacement-method flag.
|
|
|
|
--update-policy-most-disruptive-action=UPDATE_POLICY_MOST_DISRUPTIVE_ACTION
|
|
Use this flag to prevent an update if it requires more disruption
|
|
than you can afford. At most, the MIG performs the specified action
|
|
on each VM while updating. If the update requires a more disruptive
|
|
action than the one specified here, then the update fails and no
|
|
changes are made. UPDATE_POLICY_MOST_DISRUPTIVE_ACTION must be one
|
|
of:
|
|
|
|
none
|
|
No action
|
|
refresh
|
|
Apply the new configuration without stopping VMs, if possible.
|
|
For example, use ``refresh`` to apply changes that only affect
|
|
metadata or additional disks.
|
|
restart
|
|
Apply the new configuration without replacing VMs, if possible.
|
|
For example, stopping VMs and starting them again is sufficient
|
|
to apply changes to machine type.
|
|
replace
|
|
Replace old VMs according to the
|
|
--update-policy-replacement-method flag.
|
|
|
|
--update-policy-replacement-method=UPDATE_POLICY_REPLACEMENT_METHOD
|
|
Type of replacement method. Specifies what action will be taken to
|
|
update VMs. UPDATE_POLICY_REPLACEMENT_METHOD must be one of:
|
|
|
|
recreate
|
|
Recreate VMs and preserve the VM names. The VM IDs and creation
|
|
timestamps might change.
|
|
substitute
|
|
Delete old VMs and create VMs with new names.
|
|
|
|
--update-policy-type=UPDATE_TYPE
|
|
Specifies the type of update process. You can specify either
|
|
``proactive`` so that the managed instance group proactively executes
|
|
actions in order to bring VMs to their target versions or
|
|
``opportunistic`` so that no action is proactively executed but the
|
|
update will be performed as part of other actions. UPDATE_TYPE must
|
|
be one of:
|
|
|
|
opportunistic
|
|
Do not proactively replace VMs. Create new VMs and delete old
|
|
ones on resizes of the group and when you target specific VMs to
|
|
be updated or recreated.
|
|
proactive
|
|
Replace VMs proactively.
|
|
|
|
GCLOUD WIDE FLAGS
|
|
These flags are available to all commands: --access-token-file, --account,
|
|
--billing-project, --configuration, --flags-file, --flatten, --format,
|
|
--help, --impersonate-service-account, --log-http, --project, --quiet,
|
|
--trace-token, --user-output-enabled, --verbosity.
|
|
|
|
Run $ gcloud help for details.
|
|
|
|
NOTES
|
|
These variants are also available:
|
|
|
|
$ gcloud alpha compute instance-groups managed create
|
|
|
|
$ gcloud beta compute instance-groups managed create
|
|
|