Share sole-tenant node groups

Linux Windows

Shared sole-tenant node groups are similar tolocal sole-tenant nodegroups.For example, shared node groups cost the same, consume the same quota, andreside under a parent project in theresource hierarchy.

The difference between shared node groups and local node groups is that otherprojects in your organization can provision virtual machine (VM) instances inthe shared node groups.

Sharing a node group across multiple projects or an organization can help you dothe following:

  • Consolidate node groups that you manage into a single project and then sharethose nodes with other projects or the entire organization

  • Decrease costs by deleting nodes after consolidating VMs from various projectsinto underutilized node groups

  • Manage sole-tenant nodes with a single team

  • Share sole-tenant nodes with smaller projects and retain security and accesscontrol boundaries between those projects

  • Perform a live migration between node groups within the same project

  • Improve the utilization of your node groups and reduce the number of reservedmaintenance nodes when using theMigrate within node group maintenance policy

The following diagram shows a node group that is shared with other projects sothat other departments that manage VMs in those projects can provision VMs in ashared node group.

Diagram of a node group that's shared across projects. Departments            that manage VMs in different projects can provision VMs in a shared            node group.

Utilization benefits of shared node groups

The following table compares projects that use local node groups with projectsthat use shared node groups. Notice that vCPU underutilization decreases inprojects that use shared node groups.

Project configurationLocal node groupsShared node groups
Projects1010
vCPU / project2424
Node groups101
Nodes / node group13
vCPU / node8080
Utilization / node group2480
Underutilization / node group560
Total underutilization10 x 56 = 560 vCPUs1 x 0 = 0 vCPUs

Settings for sharing node groups

Compute Engine uses the following settings for sharing node groups andprovisioning VMs in the shared node groups:

  • A share setting that you configure when you create or update the sole-tenantnode group. To specify whether to share the node group with other projects orwith the entire organization, use the gcloud CLI settings(--share-setting,--share-with) or REST settings(shareSetting,shareWith).

  • A defaultcompute.googleapis.com/project node affinity label that you usewhen you provision a VM in a shared node group by using node affinity labels.For information about the other default node affinity labels, seeDefault affinity labels.

Maintenance policy considerations

When a node group uses theMigrate within node group maintenance policy,Compute Engine reserves at least 1 node for live migration events, sothe node group must have at least 2 nodes. You can't schedule VMs on thereserved node, so node groups with this maintenance policy often have loweroverall utilization. This makes workloads that require theMigrate within nodegroup maintenance policy good candidates for node group sharing, as they oftensee the greatest benefit from improved utilization.

IAM roles and permissions

Keep in mind the following information about IAM roles and permissions when youshare a node group:

  • If a node group is shared with a project, any user that can create VMs in thelisted projects or in the organization can provision VMs from those projectsonto the shared node group without any changes to IAM roles or permissions.

  • Thecompute.soleTenantViewer IAM role lets you list and view node groups(gcloud CLI/REST).You cannot modify node groups with this role. Any user with this role or withpermissions to list node groups, regardless of the IAM permissions on the VM,can view the project ID, name, machine type, and information about local SSDsand GPUs for all VMs in the node group.

Limitations

  • Compliance regime limitations:

    • Regardless of the IAM permissions on the VM, any user with permissions tolist node groups can view the project ID, name, and machine type for all VMsin the node group. Thus, due to risk of cross-project informationdisclosure, projects that have VMs provisioned in shared node groups shouldbe under the samecompliance regime.
  • Google Cloud console limitations:

    • If you don't have permission to view VMs on the shared node group, those VMswon't appear on the VM list on theSole-tenant nodes page in theGoogle Cloud console.
    • After modifying the sharing settings on theSole-tenant node groupspage, theShared with setting is not updated in the UI. To see theupdatedShared with setting, go to theSole-tenant nodes page.
    • After sharing a node group with all projects within an organization or withselected projects within an organization, you can only see the shared nodegroup from its owning project; you can't see the shared node group from theprojects it has been shared with. To provision a VM on the shared nodegroup, from the project that the node group is shared with, go to theVMinstances page, and then modify the sole tenancy node affinity labels.
  • Sharing limitations:

    • You must update the sharing settings from the project that owns the nodegroup.
    • You can specify a maximum of 100 projects when you use theprojects sharesetting.
    • You cannot share node groups between organizations. For example, if youmigrate a project that containsa shared node group from one organization to another, you must also migrateall projects that have VMs running in that shared node group.
    • You cannot perform live migration between projects while using sharedsole-tenant node groups. For more information, seeManually live migrate VMs.

Pricing

VMs in shared node groups don't incur additional charges, and there are noadditional charges for sharing node groups. For more information aboutsole-tenant node pricing, seeSole-tenant node pricing.

Before you begin

Create a new node group and share it

To create a new node group and share it with other projects or with the entireorganization, use the Google Cloud console, gcloud CLI, orREST.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • compute.nodeGroups.create permissions on the project

Console

  1. Create a sole-tenant node group. For more information, seeCreate asole-tenant node group.

  2. Configure the share settings by specifying one of the following inConfigure share settings:

    • To share the node group with all projects in your organization, chooseShare this node group with all projects within the organization.
    • To share the node group with specific projects within yourorganization, chooseShare this node group with selected projectswithin the organization.

    If you don't want to share the node group, chooseDo not share thisnode group with other projects.

gcloud

To create a shared node group, use the followinggcloud computesole-tenancy node-groups createcommand.

gcloud compute sole-tenancy node-groups createNODE_GROUP \    --zone=ZONE \    --node-template=NODE_TEMPLATE \    --target-size=SIZE \    --share-setting=SHARE_SETTING \    --share-with=PROJECTS

Replace the following:

  • NODE_GROUP: the name of the node group.

  • ZONE: the zone to create the node group in.

  • NODE_TEMPLATE: the name of the previously creatednode template.

  • SIZE: the number of nodes in the node group.

  • SHARE_SETTING: the share setting for the nodegroup. Set toprojects to share with specific projects, or set toorganization to share with the entire organization.

  • PROJECTS: a list of project IDs or projectnumbers to share the node group with. Only required if you setSHARE_SETTING toprojects.

REST

To create a shared node group, use the followingnodeGroups.insertmethod.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/nodeGroups{  ...  "name":NODE_GROUP,  "nodeTemplate":NODE_TEMPLATE,  "size":SIZE,  "shareSettings": {    "shareType":SHARE_TYPE,    "projectMap": {      string: {        "projectId":PROJECTS      },    }  }  ...}

Replace the following:

  • PROJECT: the name of project to create the nodegroup in.

  • ZONE: the zone to create the node group in.

  • NODE_GROUP: the name of the node group.

  • NODE_TEMPLATE: the name of the previously creatednode template.

  • SIZE: the number of nodes in the node group.

  • SHARE_TYPE: the share setting for the nodegroup. Set toSPECIFIC_PROJECTS to share with specific projects, or settoORGANIZATION to share with the entire organization.

  • PROJECTS: a list of project IDs or projectnumbers to share the node group with. Only required if you setSHARE_TYPE toSPECIFIC_PROJECTS.

Provision a sole-tenant VM in a shared node group

To provision a sole-tenant VM in a shared node group, use theGoogle Cloud console, gcloud CLI, orREST.

Console

  1. In the Google Cloud console, switch to a project that you've shared a nodegroup with.

  2. Go to theVM instances page.

    Go to VM instances

  3. ClickCreate instance.

  4. InZone, choose the zone of the shared node group.

  5. InMachine configuration>Series, choose the samemachine type that the shared sole-tenant node group template specifies.

  6. Expand theAdvanced options section.

  7. Expand theSole-tenancy section.

  8. ClickBrowse.

  9. ChooseSelect project and specify the project that contains theshared node group.

  10. Choose the sole-tenant node group or a specific sole-tenant node in thatgroup to provision the VM on.

gcloud

Provision a VM in a shared node group by using the node group name

To provision a sole-tenant VM in a shared node group by using the nodegroup name, use the followinggcloud compute instances createcommand.

gcloud compute instances createVM_NAME \    --machine-type=MACHINE_TYPE \    --node-group=NODE_GROUP \    --node-project=NODE_PROJECT

Replace the following:

  • VM_NAME: the name of the new sole-tenant VM tocreate in a shared node group

  • MACHINE_TYPE: the machine type for the newsole-tenant VM

  • NODE_GROUP: the name of the shared node group tocreate the sole-tenant VM in

  • NODE_PROJECT: the project containing the nodegroup to provision the VM in

Provision a VM in a shared node group by using a node affinity file

To provision a sole-tenant VM in a shared node group by using a nodeaffinity file, use the followinggcloud compute instances createcommand.

gcloud compute instances createVM_NAME \    --machine-type=MACHINE_TYPE \    --node-affinity-file=NODE_AFFINITY_FILE

Replace the following:

  • VM_NAME: the name of the sole-tenant VM to createin a shared node group by using an affinity label.

  • MACHINE_TYPE: the machine type of the sole-tenantVM to create in a shared node group.

  • NODE_AFFINITY_FILE: the name of the.json filecontaining the node affinity information. In the node affinity file, setthe affinity label key to"compute.googleapis.com/project", the operatorequal to"IN", and the value equal to the project containing the nodegroup. For more information about how to configure node affinity, seeConfigure node affinity labels.

REST

To provision a sole-tenant VM in a shared node group by using a nodeaffinity file, use the followingnodeGroups.insertmethod.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/instances{  ...  "name":VM_NAME,  "machineType":MACHINE_TYPE,  "scheduling": {    ...    "nodeAffinities": [      {        "key":KEY,        "operator":OPERATOR,        "values": [VALUE        ]      }    ],    ...  },  ...}

Replace the following:

  • PROJECT: the name of the project that owns thenode group.

  • ZONE: the zone of the node group.

  • VM_NAME: the name of the sole-tenant VM to createin a shared node group by using an affinity label.

  • MACHINE_TYPE: the machine type of the sole-tenantVM to create in a shared node group.

  • KEY: the affinity label. Set to"compute.googleapis.com/project".

  • OPERATOR: the affinity label operator. Set to"IN".

  • VALUE: the project containing the nodegroup to provision the VM in. Specify one project by using either theproject name or project ID.

For more information about how to configure node affinity, seeConfigurenode affinity labels.

View the sharing settings of a node group

To view the sharing settings of a node group, use the Google Cloud console,gcloud CLI, or REST.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • compute.nodeGroups.list permissions on the project

Console

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

    Go to Sole-tenant nodes

  2. To view the properties of the node group, in theName column, clickthe name of the node group.

gcloud

To view the sharing settings of a node group, use the followinggcloudcompute sole-tenancy node-groups describecommand.

gcloud compute sole-tenancy node-groups describeNODE_GROUP

ReplaceNODE_GROUP with the name of the node groupto view the sharing settings of.

REST

To view the sharing settings of a node group, use the followingnodeGroups.getmethod.

GET https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/nodeGroups

Replace the following:

  • PROJECT: the name of project with the node groupto view the sharing settings of

  • ZONE: the zone containing the node group to viewthe sharing settings of

Share an existing node group

To share an existing node group with other projects or the entire organization,use the Google Cloud console, gcloud CLI, orREST.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • compute.nodeGroups.update permissions on the project in which you created the node group

Console

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

    Go to Sole-tenant nodes

  2. In theName column, click the name of the node group.

  3. To share the node group with all projects within the organization or withselected projects within the organization, inOverview>Shared with, clickEdit.

gcloud

To update the sharing settings of a node group, use the followinggcloudcompute sole-tenancy node-groups updatecommand.

gcloud compute sole-tenancy node-groups updateNODE_GROUP \    --zone=ZONE \    --share-setting=SHARE_SETTING \    --share-with=PROJECTS

Replace the following:

  • NODE_GROUP: the name of the node group to updatethe sharing settings of.

  • SHARE_SETTING: the share setting for the nodegroup. Set toprojects to share with specific projects, or set toorganization to share with the entire organization.

  • PROJECTS: a list of project IDs or projectnumbers to share the node group with. Only required if you setSHARE_SETTING toprojects.

REST

To update the sharing settings of a node group, use the followingnodeGroups.patchmethod.

PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/nodeGroups/NODE_GROUP{  "shareSettings": {    "shareType":SHARE_TYPE,    "projectMap": {      string: {        "projectId":PROJECTS      },    }  }}

Replace the following:

  • PROJECT: the name of the project with the nodegroups to update the sharing settings of.

  • ZONE: the zone containing the node groups toupdate the sharing settings of.

  • NODE_GROUP: the name of the node group to updatethe sharing settings of.

  • SHARE_TYPE: the share setting for the nodegroup. Set toprojects to share with specific projects, or set toorganization to share with the entire organization.

  • PROJECTS: a list of project IDs or projectnumbers to share the node group with. Only required if you setSHARE_SETTING toSPECIFIC_PROJECTS.

Stop sharing a node group

To stop sharing a node group with other projects or the entire organization, usethe gcloud CLI or REST.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • compute.nodeGroups.update permissions on the project in which you created the node group

Console

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

    Go to Sole-tenant nodes

  2. Click theName of the node group.

  3. InOverview>Shared with, clickEdit.

  4. To stop sharing, chooseDo not share this node group with otherprojects.

gcloud

To stop sharing a node group with other projects or the entire organization,use the followinggcloud compute sole-tenancy node-groups updatecommand.

gcloud compute sole-tenancy node-groups updateNODE_GROUP \    --zone=ZONE \    --share-setting=local

Replace theNODE_GROUP with the name of the nodegroup to stop sharing.

REST

To stop sharing a node group with other projects or the entire organization,use the followingnodeGroups.patchmethod.

PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/nodeGroups/NODE_GROUP{  "shareSettings": {    "shareType":LOCAL  }}

Replace the following:

  • PROJECT: the name of the project with the nodegroup to stop sharing

  • ZONE: the zone containing the node group to stopsharing

  • NODE_GROUP: the name of the node group to stopsharing

Delete a shared node group from the owning project

To delete a shared node group from the owning project, use theGoogle Cloud console, gcloud CLI, orREST. Before deleting a node group, stop all VMs that arerunning in the node group.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • compute.nodeGroups.delete permissions on the project in which you created the node group

Console

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

    Go to Sole-tenant nodes

  2. In theName column, click the name of the node group.

  3. ClickDelete.

gcloud

To delete a shared node group from the owning project, use the followinggcloud compute sole-tenancy node-groups deletecommand.

gcloud compute sole-tenancy node-groups deleteNODE_GROUP

ReplaceNODE_GROUP with the name of the nodegroup to delete.

REST

To delete a shared node group from the owning project, use the followingnodeGroups.deletemethod.

DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/nodeGroups/NODE_GROUP

Replace the following:

  • PROJECT: the name of the project with the nodegroup to delete

  • ZONE: the zone containing the node group todelete

  • NODE_GROUP: the name of the node group to delete

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

Last updated 2025-12-15 UTC.