A RetroSearch Logo

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

Search Query:

Showing content from https://developers.google.com/compute/docs/nodes/create-nodes below:

Provision VMs on sole-tenant nodes | Compute Engine Documentation

Skip to main content Provision VMs on sole-tenant nodes

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

Linux Windows

This page describes how to provision VMs on sole-tenant nodes, which are physical servers that run VMs only from a single project. Before provisioning VMs on sole-tenant nodes, read the sole-tenant node overview.

Provisioning a VM on a sole-tenant node requires the following:

  1. Creating a sole-tenant node template. The sole-tenant node template specifies uniform properties for all of the sole-tenant nodes in a sole-tenant node group.

  2. Creating a sole-tenant node group using the previously created sole-tenant node template.

  3. Creating VMs and provisioning them on a sole-tenant node group.

Before you begin Create a sole-tenant node template

Sole-tenant node templates are regional resources that specify properties for sole-tenant node groups. You must create a node template before you create a node group. However, if you're using the Google Cloud console, you must create node templates during the creation of a sole-tenant node group.

Permissions required for this task

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

Console

You must create a sole-tenant node template before you create a node group. By using the Google Cloud console, you must create the node template during the creation of a sole-tenant node group. The new node template is created in the same region that you specify in the node group properties.

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

    Go to Sole-tenant nodes

  2. Click Create node group.

  3. Specify a Name for the node group.

  4. Specify a Region to create the node template in. You can use the node template to create node groups in any zone of this region.

  5. Specify the Zone and click Continue.

  6. In the Node template list, click Create node template to begin creating a sole-tenant node template.

  7. Specify a Name for the node template.

  8. Specify the Node type for each sole-tenant node in the node group to create based on this node template.

  9. Optional: you can also specify the following properties for the node template.

  10. Click Create to finish creating your node template.

  11. Optional: to add a new sole-tenant node template in a different region, repeat the preceding steps.

To view the node templates, click Node templates in the Sole-tenant nodes page.

gcloud

Use the gcloud compute sole-tenancy node-templates create command to create a node template:

gcloud compute sole-tenancy node-templates create TEMPLATE_NAME \
  --node-type=NODE_TYPE \
  [--region=REGION \]
  [--node-affinity-labels=AFFINITY_LABELS \]
  [--accelerator type=GPU_TYPE,count=GPU_COUNT \]
  [--disk type=local-ssd,count=DISK_COUNT,size=DISK_SIZE \]
  [--cpu-overcommit-type=CPU_OVERCOMMIT_TYPE]

Replace the following:

REST

Use the nodeTemplates.insert method to create a node template:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/nodeTemplates

{
  "name": "TEMPLATE_NAME",
  "nodeType": "NODE_TYPE",
  "nodeAffinityLabels": {
    "KEY": "VALUE",
    ...
  },
  "accelerators": [
    {
      "acceleratorType": "GPU_TYPE",
      "acceleratorCount": GPU_COUNT
    }
  ],
  "disks": [
    {
      "diskType": "local-ssd",
      "diskSizeGb": DISK_SIZE,
      "diskCount": DISK_COUNT
    }
  ],
  "cpuOvercommitType": CPU_OVERCOMMIT_TYPE
}

Replace the following:

Create a sole-tenant node group

With the previously created sole-tenant node template, create a sole-tenant node group. A sole-tenant node group inherits properties specified by the sole-tenant node template and has additional values that you must specify.

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 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:

  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.

  10. You can choose between regular maintenance windows and advanced maintenance control to handle maintenance for your sole-tenant node group, as follows:

    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:

    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:

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:

Provision a sole-tenant VM

After creating a node group based on a previously created node template, you can provision individual VMs on a sole-tenant node group.

To provision a VM on a specific node or node group that has affinity labels that match those you previously assigned to the node template, follow the standard procedure for creating a VM instance, and assign affinity labels to the VM.

Or, you can use the following procedure to provision a VM on a sole-tenant node from the node group details page. Based on the node group that you provision VMs on, Compute Engine assigns affinity labels.

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

    Go to Sole-tenant nodes

  2. Click Node groups.

  3. Click the Name of the node group to provision a VM instance on, and then optionally, to provision a VM on a specific sole-tenant node, click the name of the specific sole-tenant node to provision the VM.

  4. Click Create instance to provision a VM instance on this node group, note the values automatically applied for the Name, Region, and Zone, and modify those values as necessary.

  5. Select a Machine configuration by specifying the Machine family, Series, and Machine type. Choose the Series that corresponds to the sole-tenant node type.

  6. Modify the Boot disk, Firewall, and other settings as necessary.

  7. Click Sole Tenancy, note the automatically assigned Node affinity labels, and use Browse to adjust as necessary.

  8. Click Management, and for On host maintenance, choose one of the following:

  9. Choose one of the following for the Automatic restart:

  10. Click Create to finish creating your sole-tenant VM.

gcloud

Use the gcloud compute instances create command command to provision a VM on a sole-tenant node group:

gcloud compute instances create VM_NAME \
  [--zone=ZONE \]
  --image-family=IMAGE_FAMILY \
  --image-project=IMAGE_PROJECT \
  --node-group=GROUP_NAME \
  --machine-type=MACHINE_TYPE \
  [--maintenance-policy=MAINTENANCE_POLICY \]
  [--accelerator type=GPU_TYPE,count=GPU_COUNT \]
  [--local-ssd interface=SSD_INTERFACE \]
  [--restart-on-failure]

The --restart-on-failure flag indicates whether sole-tenant VMs restart after stopping. This flag is enabled by default. Use --no-restart-on-failure to disable.

Replace the following:

REST

Use the instances.insert method to provision a VM on a sole-tenant node group:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/VM_ZONE/instances
{ "machineType": "zones/MACHINE_TYPE_ZONE/machineTypes/MACHINE_TYPE", "name": "VM_NAME", "scheduling": { "onHostMaintenance": MAINTENANCE_POLICY, "automaticRestart": RESTART_ON_FAILURE, "nodeAffinities": [ { "key": "compute.googleapis.com/node-group-name", "operator": "IN", "values": [ "GROUP_NAME" ] } ] }, "networkInterfaces": [ { "network": "global/networks/NETWORK", "subnetwork": "regions/REGION/subnetworks/SUBNETWORK" } ], "guestAccelerators": [ { "acceleratorType": GPU_TYPE, "acceleratorCount": GPU_COUNT } ], "disks": [ { "boot": true, "initializeParams": { "sourceImage": "projects/IMAGE_PROJECT/global/images/family/IMAGE_FAMILY" } }, { "type":"SCRATCH", "initializeParams":{ "diskType":"zones/LOCAL_SSD_ZONE/diskTypes/local-ssd" }, "autoDelete":true, "interface":"SSD_INTERFACE" } ] }

Replace the following:

Provision a group of sole-tenant VMs

Managed instance groups (MIGs) let you provision a group of identical sole-tenant VMs. Affinity labels let you specify the sole-tenant node or node group on which to provision the group of sole-tenant VMs.

For regional MIGs, you must create node groups in each of the regional MIG's zones and you must specify node affinities for those node groups in the regional MIG's instance template.

Warning: For regional MIGs, you must set the MIG's target distribution shape to EVEN. If you use a different shape, the MIG's VMs might not be created in your sole-tenant nodes. gcloud
  1. Use the gcloud compute instance-templates create command to create a managed instance group template for a group of VMs to create on a sole-tenant node group:

    gcloud compute instance-templates create INSTANCE_TEMPLATE \
      --machine-type=MACHINE_TYPE \
      --image-project=IMAGE_PROJECT \
      --image-family=IMAGE_FAMILY \
      --node-group=GROUP_NAME \
      [--accelerator type=GPU_TYPE,count=GPU_COUNT \]
      [--local-ssd interface=SSD_INTERFACE]
    

    Replace the following:

  2. Use the gcloud compute instance-groups managed create command command to create a managed instance group within your sole-tenant node group:

    gcloud compute instance-groups managed create INSTANCE_GROUP_NAME \
      --size=SIZE \
      --template=INSTANCE_TEMPLATE \
      --zone=ZONE
    

    Replace the following:

REST
  1. Use the instanceTemplates.insert method to create a managed instance group template within your sole-tenant node group:

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/TEMPLATE_ZONE/instance-templates
    { "name": "INSTANCE_TEMPLATE", "properties": { "machineType": "zones/MACHINE_TYPE_ZONE/machineTypes/MACHINE_TYPE", "scheduling": { "nodeAffinities": [ { "key": "compute.googleapis.com/node-group-name", "operator": "IN", "values": [ "GROUP_NAME" ] } ] }, "networkInterfaces": [ { "network": "global/networks/NETWORK", "subnetwork": "regions/REGION/subnetworks/SUBNETWORK" } ], "guestAccelerators": [ { "acceleratorType": GPU_TYPE, "acceleratorCount": GPU_COUNT } ], "disks": [ { "boot": true, "initializeParams": { "sourceImage": "projects/IMAGE_PROJECT/global/images/family/IMAGE_FAMILY" } }, { "type":"SCRATCH", "initializeParams":{ "diskType":"zones/LOCAL_SSD_ZONE/diskTypes/local-ssd" }, "autoDelete":true, "interface":"SSD_INTERFACE" } ] } }

    Replace the following:

  2. Use the instanceGroupManagers.insert method to create a MIG within your sole-tenant node group based on the previously created instance template. Or, if you want to create a regional MIG, use the regionInstanceGroupManagers.insert method and specify the region and zones of all of the node groups as specified in the instance template.

    For example, to create a zonal MIG, use the following request:

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers
    {
      "baseInstanceName": "NAME_PREFIX",
      "name": "INSTANCE_GROUP_NAME",
      "targetSize": SIZE,
      "instanceTemplate": "global/instanceTemplates/INSTANCE_TEMPLATE"
    }
    

    Replace the following:

Configure node affinity labels

Node affinity labels let you logically group node groups and schedule VMs on a specific set of node groups. You can also use node affinity labels to schedule VMs on node groups across different zones, and still keep the node groups in a logical group. The following procedure is an example of using affinity labels to associate VMs with a specific node group that is used for production workloads. This example shows how to schedule a single VM, but you could also use managed instance groups to schedule a group of VMs.

gcloud
  1. Use the gcloud compute sole-tenancy node-templates create command to create a node template with a set of affinity labels for a production workload:

    gcloud compute sole-tenancy node-templates create prod-template \
      --node-type=n1-node-96-624 \
      --node-affinity-labels workload=frontend,environment=prod
    
  2. Use the gcloud compute sole-tenancy node-templates describe command to view the node affinity labels assigned to the node template.

  3. Use the gcloud compute sole-tenancy node-groups create command to create a node group that uses the production template:

    gcloud compute sole-tenancy node-groups create prod-group \
      --node-template=prod-template \
      --target-size=1
    
  4. For your production VMs, create a node-affinity-prod.json file to specify the affinity of your production VMs. For example, you might create a file that specifies that VMs run only on nodes with both the workload=frontend and environment=prod affinities. Create the node affinity file by using Cloud Shell or create it in a location of your choice.

    [
      {
        "key" : "workload",
        "operator" : "IN",
        "values" : ["frontend"]
      },
      {
        "key" : "environment",
        "operator" : "IN",
        "values" : ["prod"]
      }
    ]
    
  5. Use the node-affinity-prod.json file with the gcloud compute instances create command to schedule a VM on the node group with matching affinity labels.

    gcloud compute instances create prod-vm \
      --node-affinity-file node-affinity-prod.json \
      --machine-type=n1-standard-2
    
  6. Use the gcloud compute instances describe command and check the scheduling field to view the node affinities assigned to the VM.

Configure node anti-affinity labels

Node affinity labels can be configured as anti-affinity labels to prevent VMs from running on specific nodes. For example, you can use anti-affinity labels to prevent VMs that you are using for development purposes from being scheduled on the same nodes as your production VM. The following example shows how to use affinity labels to prevent VMs from running on specific node groups. This example shows how to schedule a single VM, but you could also use managed instance groups to schedule a group of VMs.

gcloud
  1. For development VMs, specify the affinity of your development VMs by creating a node-affinity-dev.json with Cloud Shell, or by creating it in a location of your choice. For example, create a file that configures VMs to run on any node group with the workload=frontend affinity as long as it is not environment=prod:

    [
      {
        "key" : "workload",
        "operator" : "IN",
        "values" : ["frontend"]
      },
      {
        "key" : "environment",
        "operator" : "NOT_IN",
        "values" : ["prod"]
      }
    ]
    
  2. Use the node-affinity-dev.json file with the gcloud compute instances create command to create the development VM:

    gcloud compute instances create dev-vm \
      --node-affinity-file=node-affinity-dev.json \
      --machine-type=n1-standard-2
    
  3. Use the gcloud compute instances describe command and check the scheduling field to view the node anti-affinities assigned to the VM.

Delete a node group

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

Delete a node template

You can delete a node template after you've deleted all of the node groups that are using the template.

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

    Go to Sole-tenant nodes

  2. Click Node templates.

  3. Select the name of an unused node template.

  4. Click Delete.

gcloud

Use the gcloud compute sole-tenancy node-templates delete command to delete an unused node template:

gcloud compute sole-tenancy node-templates delete TEMPLATE_NAME \
  --region=REGION

Replace the following:

REST

Use the compute.nodeTemplates.delete method to delete an unused node template:

 DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/nodeTemplates/TEMPLATE_NAME
 

Replace the following:

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Sole-tenant VMs are provisioned on physical servers dedicated to a single project, requiring the creation of a node template and a node group before VM deployment."],["A sole-tenant node template defines uniform properties for a group of sole-tenant nodes, and it must be created before establishing the node group, or during the process of node group creation if using the Google Cloud console."],["Sole-tenant node groups inherit properties from the node template and can be configured for autoscaling, maintenance policies, and sharing settings across projects within an organization."],["Node affinity labels can be used to logically group nodes and node groups and to specify the placement of VMs on specific sets of nodes or node groups, and node anti-affinity labels prevent VMs from running on certain nodes."],["Before deleting a sole-tenant node group or template, all VMs associated with the group must be removed, ensuring no active instances are present on the node group or within the context of the node template."]]],[]]


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