次のページでは、ネストされた仮想化をサポートするノードを使用して Google Kubernetes Engine(GKE)Standard クラスタを作成する方法について説明します。Compute Engine VM は Intel VT-x 命令を使用しているため、ネストされた VM は GKE ノードの基盤となる VM で実行できます。その後、QEMU などのツールを使用して、ネストされた VM を作成する Pod をデプロイできます。ネストされた VM を使用すると、Android エミュレータなどの特殊なワークロードや、VM を分離境界として利用するワークロードを実行できます。
パフォーマンス低下の可能性
ハードウェア支援のネストされた仮想化では、ネストされていない仮想化構成と比べると、ネストされた VM で実行されるワークロードのパフォーマンスが低下する場合があります。パフォーマンスへの影響の程度は、I/O やメモリ使用率などの特性など、特定のワークロード プロファイルによって異なります。
また、GKE ノードの基盤となる VM にネストされた VM を作成すると、そのノードで実行されている他のワークロードのパフォーマンスに影響する可能性があります。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-05-08 UTC。"],[],[],null,["# Use nested VMs with GKE Standard clusters\n\n[Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThe following page explains how you can create Google Kubernetes Engine (GKE)\nStandard clusters with nodes that support [nested\nvirtualization](/compute/docs/instances/nested-virtualization/overview#restrictions).\nCompute Engine VMs use [Intel\nVT-x](https://www.intel.com/content/dam/www/central-libraries/us/en/documents/intel-virtualization-technologies-white-paper.pdf)\ninstructions so that nested VMs can run on a [GKE node's\nunderlying VM](/kubernetes-engine/docs/concepts/cluster-architecture#nodes).\nThen, you can deploy Pods that use tools such as [QEMU](https://www.qemu.org/)\nto create nested VMs. You can use nested VMs to run specialized workloads such\nas Android emulators, or workloads that benefit from the VM as an isolation\nboundary.\n\nReduced performance implications\n--------------------------------\n\nWith hardware-assisted nested virtualization, workloads running on the nested\nVMs might experience [reduced\nperformance](/compute/docs/instances/nested-virtualization/overview#performance_considerations)\nwhen compared to non-nested virtualization configurations. The amount of\nperformance impact will depend on the specific workload profile, including its\nI/O and memory usage characteristics.\n\nAdditionally, creating nested VMs on the GKE nodes' underlying\nVMs might affect the performance of other workloads running on those nodes.\n\nBefore you begin\n----------------\n\nBefore you start, make sure that you have performed the following tasks:\n\n- Enable the Google Kubernetes Engine API.\n[Enable Google Kubernetes Engine API](https://console.cloud.google.com/flows/enableapi?apiid=container.googleapis.com)\n- If you want to use the Google Cloud CLI for this task, [install](/sdk/docs/install) and then [initialize](/sdk/docs/initializing) the gcloud CLI. If you previously installed the gcloud CLI, get the latest version by running `gcloud components update`. **Note:** For existing gcloud CLI installations, make sure to set the `compute/region` [property](/sdk/docs/properties#setting_properties). If you use primarily zonal clusters, set the `compute/zone` instead. By setting a default location, you can avoid errors in the gcloud CLI like the following: `One of [--zone, --region] must be supplied: Please specify location`. You might need to specify the location in certain commands if the location of your cluster differs from the default that you set.\n\n\u003c!-- --\u003e\n\n- [Ensure that your organization policy supports creating nested VMs](/compute/docs/instances/nested-virtualization/managing-constraint#check_whether_nested_virtualization_is_allowed).\n- Review the nested VM [restrictions](/compute/docs/instances/nested-virtualization/overview#restrictions).\n\n### Requirements and limitations\n\nConsider the following information before enabling nested virtualization with\nGKE and allowing your Pods to create nested VMs:\n\n- You can only configure node pools with nested VMs with a limited number of VM machine series. See the **Nested virtualization** row of the [Machine\n series comparison](/compute/docs/machine-resource#machine_type_comparison) to confirm supported machine series.\n- You must use the `UBUNTU_CONTAINERD` image type, or the `COS_CONTAINERD`image type with nodes running version 1.28.4-gke.1083000 or later.\n- You can only use nested virtualization with Standard clusters, not Autopilot clusters.\n- You can't use [node\n auto-provisioning](/kubernetes-engine/docs/concepts/node-auto-provisioning) with nested virtualization-enabled node pools.\n- You can't use nested virtualization if the [*Disable VM nested virtualization*\n constraint](/compute/docs/instances/nested-virtualization/managing-constraint#console) is enforced for your organization policy.\n- You must set `securityContext.privileged:true` for Pods to interact with nested VMs.\n\nEnable nested virtualization\n----------------------------\n\nYou can enable nested virtualization when you create a cluster---by enabling it\nfor the default node pool---or when you create a node pool. You can't enable or\ndisable the feature for an existing node pool.\n\nThe instructions in the following sections create node pools with nodes with the\nlabel `nested-virtualization=enabled`. After GKE creates the\nnodes, you can schedule Pods that created nested VMs on the node's underlying\nVM.\n\n### Enable nested virtualization with a new Standard cluster\n\nCreate a new Standard cluster with nested virtualization enabled for\nthe default node pool. GKE only creates the default node pool\nwith nested virtualization enabled. GKE doesn't automatically\nenable the feature for all new node pools created for the cluster: \n\n gcloud container clusters create \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e \\\n --enable-nested-virtualization \\\n --node-labels=nested-virtualization=enabled \\\n --machine-type=\u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: The name of the cluster.\n- \u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e: A [supported machine type (see the\n **Nested virtualization row**)](/compute/docs/machine-resource#machine_type_comparison).\n\nOptionally, [check that nested virtualization is\nenabled](/compute/docs/instances/nested-virtualization/enabling#confirm_that_nested_virtualization_is_enabled_on_the_vm)\nfor a node in the node pool.\n\nYou can now [schedule Pods](#schedule-pod) that create nested VMs on the\nunderlying VM of the node.\n\n### Enable nested virtualization with a new node pool\n\nCreate a new node pool with nested virtualization enabled for an existing\nStandard cluster: \n\n gcloud container node-pools create \u003cvar translate=\"no\"\u003eNODEPOOL_NAME\u003c/var\u003e \\\n --enable-nested-virtualization \\\n --node-labels=nested-virtualization=enabled \\\n --cluster=\u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e \\\n --machine-type=\u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eNODEPOOL_NAME\u003c/var\u003e: The name of the node pool where nested virtualization is enabled.\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: The name of the cluster.\n- \u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e: A [support machine type (see the\n **Nested virtualization row**)](/compute/docs/machine-resource#machine_type_comparison).\n\nOptionally, [check that nested virtualization is\nenabled](/compute/docs/instances/nested-virtualization/enabling#confirm_that_nested_virtualization_is_enabled_on_the_vm)\nfor a node in the node pool.\n\nYou can now [schedule Pods](#schedule-pod) that create nested VMs on the\nunderlying VM of the node.\n\nSchedule a Pod to a node that supports nested virtualization\n------------------------------------------------------------\n\nTo schedule a Pod on a node with nested virtualization enabled, add the\nfollowing node selector to the specification: \n\n nodeSelector:\n nested-virtualization: enabled\n\nAdditionally, for the Pod to connect with a nested VM, you must set the Pod as\nprivileged by configuring `securityContext.privileged:true`.\n\nWhat's next\n-----------\n\n- [About nested virtualization](/compute/docs/instances/nested-virtualization/overview)"]]