Create sole-tenant node groups

This document describes how to create and delete sole-tenant node groups. If you haven't created a sole-tenant node template yet, you must do so before you can create a node group.

Node groups are zonal resources that inherit properties from the node template they are based on. When you create a node group, you must specify configuration such as the number of nodes and maintenance settings.

Create a sole-tenant node group

To create a sole-tenant node group, use one of the following methods:

Console

  1. In the Google Cloud console, go to the Sole-tenant nodes page.

    Go to Sole-tenant nodes

  2. Click Create node group to begin creating a node group.

  3. Specify a Name for the node group.

  4. Specify the Region for the node group to display the available node templates in that region.

  5. Specify the Zone within the region to create the node group in.

  6. Specify the Node template to create the node group or click Create node template to create a new sole-tenant node template. The selected node template is applied to the node group.

  7. Choose one of the following for the Autoscaling mode for the node group autoscaler:

    • Off: Manually manage the size of the node group.

    • On: Have nodes automatically added to or removed from the node group.

    • Only scale out: Add nodes to the node group when extra capacity is required.

  8. Specify the Number of nodes for the group. If you enable the node group autoscaler, specify a range for the size of the node group. You can manually change the values later.

  9. Set the Maintenance policy of the sole-tenant node group in the Configure Maintenance Settings section to one of the following values. The maintenance policy lets you configure the behavior of VMs on the node group during host maintenance events. For more information, see Maintenance policies:

    • Default
    • Restart in place
    • Migrate within node group
  10. You can choose between regular maintenance windows and advanced maintenance control to handle maintenance for your sole-tenant node group, as follows:

    • Maintenance Window: Select the time period during which you want planned maintenance events to happen for the nodes in the sole-tenant node groups.

    • Opt-in for advanced maintenance control for sole-tenancy: Advanced maintenance control for sole-tenancy lets you control planned maintenance events for sole-tenant node groups and minimize maintenance-related disruptions. To opt-in for advanced maintenance control, click the Opt-in for advanced maintenance control for sole-tenancy toggle to the on position. If you choose to use this option for node maintenance, the Maintenance window field is disabled, and maintenance occurs as configured in advanced maintenance control.

    Note that advanced maintenance control only supports the Default maintenance policy.

  11. Configure the share settings by specifying one of the following in Configure share settings:

    • To share the node group with all projects in your organization, choose Share this node group with all projects within the organization.
    • To share the node group with specific projects within your organization, choose Share this node group with selected projects within the organization.

    If you don't want to share the node group, choose Do not share this node group with other projects. For more information about sharing node groups, see Share sole-tenant node groups.

  12. Click Create to finish creating the node group.

gcloud

Run the gcloud compute sole-tenancy node-groups create command command to create a node group based on a previously created node template:

gcloud compute sole-tenancy node-groups create GROUP_NAME \
  --node-template=TEMPLATE_NAME \
  --target-size=TARGET_SIZE \
  [--zone=ZONE \]
  [--maintenance-policy=MAINTENANCE_POLICY \]
  [--maintenance-window-start-time=START_TIME \]
  [--autoscaler-mode=AUTOSCALER_MODE \
  --min-nodes=MIN_NODES \
  --max-nodes=MAX_NODES]

Replace the following:

  • GROUP_NAME: the name for the new node group.
  • TEMPLATE_NAME: the name of the node template to use to create this group.
  • TARGET_SIZE: the number of nodes to create in the group.
  • ZONE: the zone to create the node group in. This must be the same region as the node template on which you are basing the node group.
  • MAINTENANCE_POLICY: the maintenance policy for the node group. For more information, see Maintenance policies. This must be one of the following values:

    • default
    • restart-in-place
    • migrate-within-node-group

    Alternately, you can opt in for advanced maintenance control for the sole-tenant node group, using the --maintenance-interval flag. For more information, see Enable advanced maintenance control on a sole-tenant node.

  • START_TIME: the start time in GMT for the maintenance window for the VMs in this node group. Set to one of: 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. If not set, the node group does not have a set maintenance window.

  • AUTOSCALER_MODE: the autoscaler policy for the node group. This must be one of:

    • off: manually manage the size of the node group.
    • on: have nodes automatically added to or removed from the node group.
    • only-scale-out: add nodes to the node group when extra capacity is required.
  • MIN_NODES: the minimim size of the node group. The default value is 0 and must be an integer value less than or equal to MAX_NODES.

  • MAX_NODES: the maximum size of the node group. This must be less than or equal to 100 and greater than or equal to MIN_NODES. Required if AUTOSCALER_MODE is not set to off.

REST

Use the nodeGroups.insert method to create a node group based on a previously created node template:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/nodeGroups?initialNodeCount=TARGET_SIZE
{
  "nodeTemplate": "regions/REGION/nodeTemplates/TEMPLATE_NAME",
  "name": "GROUP_NAME",
  "maintenancePolicy": MAINTENANCE_POLICY,
  "maintenanceWindow": {
      "startTime": "START_TIME"
  },
  "autoscalingPolicy": {
      "mode": AUTOSCALER_MODE,
      "minNodes": MIN_NODES,
      "maxNodes": MAX_NODES
  },
}

Replace the following:

  • PROJECT_ID: the project ID.

  • ZONE: the zone to create the node group in. This must be in the same region as the node template on which you are basing the node group.

  • TARGET_SIZE: the number of nodes to create in the group.

  • REGION: the region to create the node group in. You must have a node template in the selected region.

  • TEMPLATE_NAME: the name of the node template to use to create this group.

  • GROUP_NAME: the name for the new node group.

  • MAINTENANCE_POLICY: the maintenance policy for the node group. This must be one of the following values:

    • DEFAULT
    • RESTART_IN_PLACE
    • MIGRATE_WITHIN_NODE_GROUP

    Alternately, you can opt-in for advanced maintenance control for the sole-tenant node group, using the maintenanceInterval field. For more information, see Enable advanced maintenance control on a sole-tenant node.

  • START_TIME: the start time in GMT for the maintenance window for the VMs in this node group. Set to one of: 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. If not set, the node group does not have a set maintenance window.

  • AUTOSCALER_MODE: the autoscaler policy for the node group. This must be one of the following values:

    • OFF: manually manage the size of the node group.
    • ON: have nodes automatically added to or removed from the node group.
    • ONLY_SCALE_OUT: add nodes to the node group when extra capacity is required.
  • MIN_NODES: the minimim size of the node group. The default is 0 and must be an integer value less than or equal to MAX_NODES.

  • MAX_NODES: the maximum size of the node group. This must be less than or equal to 100 and greater than or equal to MIN_NODES. Required if AUTOSCALER_MODE is not set to OFF.

Delete a node group

If you need to delete a sole-tenant node group, first remove any VMs from the node group.

Console

  1. Go to the Sole-tenant nodes page.

    Go to Sole-tenant nodes

  2. Click the Name of the node group to delete.

  3. For each node in the node group, click the node's name and delete individual VM instances on the node details page, or follow the standard procedure to delete an individual VM. To delete VMs in a managed instance group, delete the managed instance group.

  4. After deleting all VM instances running on all nodes of the node group, return to the Sole-tenant nodes page.

    Go to Sole-tenant nodes

  5. Click Node groups.

  6. Select the name of the node group you need to delete.

  7. Click Delete.

gcloud

  1. List running VM instances on nodes in the node group by using the gcloud compute sole-tenancy node-groups list-nodes command:

    gcloud compute sole-tenancy node-groups list-nodes GROUP_NAME \
      --zone=ZONE

    Replace the following:

    • GROUP_NAME: name of the node group
    • ZONE: zone of the node group
  2. If there are any VMs running on the node group, follow the procedure to delete an individual VM or the procedure to delete a managed instance group.

  3. After deleting all VMs running on all nodes of the node group, delete the node group by using the gcloud compute sole-tenancy node-groups delete command:

    gcloud compute sole-tenancy node-groups delete GROUP_NAME \
        --zone=ZONE

    Replace the following:

    • GROUP_NAME: the name of the node group
    • ZONE: the zone of the node group

REST

  1. List running VM instances on nodes in the node group by using the nodeGroups.listNodes method:

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/nodeGroups/GROUP_NAME/listNodes

    Replace the following:

    • PROJECT_ID: the project ID
    • ZONE: the zone of the node group
    • GROUP_NAME: the group for which to list the VMs
  2. If there are any VMs running on the node group, follow the procedure to delete an individual VM or the procedure to delete a managed instance group.

  3. After deleting all VMs running on all nodes of the node group, delete the node group by using the nodeGroups.delete method:

    DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/nodeGroups/GROUP_NAME
    

    Replace the following:

    • PROJECT_ID: the project ID
    • ZONE: the zone of the node group
    • GROUP_NAME: the name of the node group to delete

What's next