[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eMinimizing VM start time is a preview feature not recommended for production, and doing so increases resource consumption and the security surface.\u003c/p\u003e\n"],["\u003cp\u003eTo speed up VM start times, enable disk connection keep-alive, which involves running a command that creates a dummy pod to maintain the VM's disk connections.\u003c/p\u003e\n"],["\u003cp\u003eConfigure inter-VM affinity between the VM and the keep-alive pod to increase the likelihood the VM restarts on the same node.\u003c/p\u003e\n"],["\u003cp\u003eFor faster start times, use BIOS firmware instead of UEFI, though this means secure boot will not be supported.\u003c/p\u003e\n"],["\u003cp\u003eUsing a boot disk of 500 GB or greater can help minimize the VM start time.\u003c/p\u003e\n"]]],[],null,["# Minimize the VM start time\n\n| **Preview:** Minimize the VM start time is a Preview feature that is available as-is and is not recommended for production environments. Google provides no Service-Level agreements (SLA) or technical support commitments for Preview features. For more information, see Google Distributed Cloud (GDC) air-gapped [feature stages](/distributed-cloud/hosted/docs/latest/gdch/resources/feature-stages).\n\nIf you require your VMs to boot as quickly as possible, minimize your virtual\nmachine (VM) start time with the instructions on this page. Minimizing the start\ntime comes at the cost of resource efficiency---your project consumes additional\nresources, and has an increased security surface.\n\nBefore you begin\n----------------\n\nTo use `gdcloud` command-line interface (CLI) commands, ensure that you have downloaded, installed,\nand configured the [`gdcloud` CLI](/distributed-cloud/hosted/docs/latest/gdch/resources/gdcloud-overview).\nAll commands for Distributed Cloud use the `gdcloud` or\n`kubectl` CLI, and require an operating system (OS) environment.\n\n### Get the kubeconfig file path\n\nTo run commands against the Management API server, ensure you have the following\nresources:\n\n1. [Sign in and generate](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/iam/sign-in#cli) the\n kubeconfig file for the Management API server if you don't have one.\n\n2. Use the path to the kubeconfig file of the Management API server to replace\n \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER\u003c/var\u003e in these instructions.\n\n### Request permissions and access\n\nTo perform the tasks listed in this page, you must have the Project\nVirtualMachine Admin role. Follow the steps to\n[verify](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/vms/preparation#verify-user-access)\nthat you have the Project VirtualMachine Admin (`project-vm-admin`) role in the namespace\nof the project where the VM resides.\n\nKeep disk connections alive\n---------------------------\n\nWhen a VM starts, initiating a connection from the VM's node to the VM's disk\ntakes a few seconds. To make the VM start up faster, the disk connection must be\nkept alive when the VM is shut down so that the disk connection doesn't\nreinitiate on subsequent VM starts. To achieve this, when you [run the command](#enable-keep-alive)\nto enable disk connection keep-alive the system automatically creates a dummy pod\nthat mounts all the VM's disks.\n\n### Enable disk connection keep-alive\n\nTo keep disk connections alive for a VM called \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e\nin the project \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e, run\nthe following command. When you do, the system automatically creates the dummy\npod: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER\u003c/var\u003e patch virtualmachines.virtualmachine.gdc.goog \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e --type merge --patch $'\n metadata:\n annotations:\n disk.virtualmachine.gdc.goog/enable-connection-keep-alive: \"true\"\n '\n\nReplace the variables throughout these instructions, using the following\ndefinitions.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nWhen the disk connection keep-alive is enabled, a pod named\n`disk-connection-keep-alive-`\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e is created in the same\nproject as the VM. The next VM restart is faster, as are subsequent start times,\nbecause the VM's disk connections are kept alive by the pod.\n\n### Set up disk connection keep-alive affinity\n\nThe Kubernetes scheduler might select a different node for the VM when it restarts.\nTo reduce the chances of that happening, configure an\ninter-VM affinity rule between the VM and the keep-alive pod. Configure this to happen automatically: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER\u003c/var\u003e patch virtualmachines.virtualmachine.gdc.goog \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e --type merge --patch $'\n metadata:\n annotations:\n disk.virtualmachine.gdc.goog/add-connection-keep-alive-affinity: \"true\"\n '\n\nThis adds a preferred-affinity setting on the VM to the keep-alive pod.\n\n### Caveats\n\nThere are two caveats to keeping disk connections alive:\n\n- The keep-alive pod incurs additional resource usage:\n - It counts towards the limit of the number of pods per node.\n - It uses an additional IP address that is assigned by Kubernetes.\n - It uses a negligible additional amount of CPU and memory.\n- The security surface increases, because the node where the keep-alive pod is present always has the VM's disks attached, even when the VM is shut down.\n\nUse BIOS firmware\n-----------------\n\nIn GDC, starting a VM with Unified Extensible\nFirmware Interface (UEFI) firmware is slower than starting a VM with BIOS\nfirmware.\n\n1. To ensure that the start time is minimal, set the VM's firmware type to\n BIOS:\n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER\u003c/var\u003e patch virtualmachines.virtualmachine.gdc.goog \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e --type merge --patch $'\n spec:\n firmware:\n type: bios\n enableSecureBoot:\n '\n\n2. If the VM is running, restart it using the instructions to\n [restart the VM](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/vms/manage-vms/operations-and-lifecycle/start-and-stop-vm#restart-a-vm).\n\n### Caveats\n\nThe caveat to using BIOS firmware is that it doesn't support [secure boot](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/vms/manage-vms/secure-vms/secure-boot).\n\nUse a large boot disk\n---------------------\n\nTo minimize the VM start time, attach a boot disk with a size of 500 GB or\ngreater to the VM."]]