VM 執行個體在生命週期中,可能會經歷許多狀態。建立 VM 時,Google Distributed Cloud (GDC) 實體隔離設備會佈建資源來啟動 VM。接著,VM 會進入啟動狀態,準備初次啟動。啟動期間和啟動後,系統會將 VM 視為正在執行。在整個運作生命週期中,執行中的 VM 可以多次停止及重新啟動,或暫停及繼續。
VM 狀態定義
狀態
定義
Pending
系統已接受 VM,正在等待分配。
Provisioning
系統正在佈建及準備與 VM 相關聯的資源,例如 VirtualMachineDisk。
Starting
正在準備執行 VM。
Running
VM 正在執行。
Stopping
VM 正在停止。
Stopped
VM 已停止,且預計不會啟動。
Paused
VM 會暫停並處於凍結狀態,且會保留該狀態。無法存取 VM。
Terminating
系統正在刪除 VM 和相關資源。
ErrorConfiguration
虛擬機發生設定錯誤。無效的設定狀態可能由下列原因造成:
MachineTypeNotFound - 系統找不到 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-09-04 (世界標準時間)。"],[[["\u003cp\u003eVM instances transition through various states, including \u003ccode\u003ePending\u003c/code\u003e, \u003ccode\u003eProvisioning\u003c/code\u003e, \u003ccode\u003eStarting\u003c/code\u003e, \u003ccode\u003eRunning\u003c/code\u003e, \u003ccode\u003eStopping\u003c/code\u003e, \u003ccode\u003eStopped\u003c/code\u003e, and others, throughout their lifecycle.\u003c/p\u003e\n"],["\u003cp\u003eA VM's status can be checked to identify issues, confirm it's running, or verify it's in a \u003ccode\u003ePaused\u003c/code\u003e or \u003ccode\u003eStopped\u003c/code\u003e state.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ekubectl\u003c/code\u003e CLI with \u003ccode\u003eADMIN_KUBECONFIG\u003c/code\u003e can be used to list VMs and their status, as well as to get additional details about a specific VM's status, including its \u003ccode\u003eReason\u003c/code\u003e and \u003ccode\u003eMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eVMs can be stopped and restarted, or deleted, to respond to status changes or manage the VM's lifecycle, using steps provided in the documentation.\u003c/p\u003e\n"],["\u003cp\u003eThere are error state definitions such as \u003ccode\u003eErrorConfiguration\u003c/code\u003e, \u003ccode\u003eErrorUnschedulable\u003c/code\u003e, and \u003ccode\u003eDiskError\u003c/code\u003e which can provide more details on problems that the VM has.\u003c/p\u003e\n"]]],[],null,["# Manage the VM instance lifecycle\n\nA VM instance can transition through many states throughout its lifecycle. When\nyou create a VM, Google Distributed Cloud (GDC) air-gapped appliance provisions\nresources to start the VM. Next, the VM moves into the start state, where it\nprepares for a first boot. During and after start-up, a VM is considered\nto be running. During its lifetime, a running VM can be repeatedly stopped and\nrestarted, or suspended and resumed.\n\nVM status definitions\n---------------------\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/appliance/resources/gdcloud-overview).\nAll commands for GDC air-gapped appliance 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. Locate the Management API server name, or ask your Platform Administrator (PA)\n what the server name is.\n\n2. [Sign in and generate](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/iam/sign-in#cli) the\n kubeconfig file for the Management API server if you don't have one.\n\n3. Use the path to replace \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER{\"</var>\"}}\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 either\n[verify](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/vms/preparation)\nor have your Project IAM Admin\n[assign](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/vms/preparation#grant-user-access-vm-resources)\nyou the Project VirtualMachine Admin (`project-vm-admin`) role in the namespace\nof the project where the VM resides.\n\nFor VM operations using the GDC console or the gdcloud CLI,\nrequest your Project IAM Admin to assign you both the\nProject VirtualMachine Admin role and the Project Viewer (`project-viewer`)\nrole.\n\nCheck VM status\n---------------\n\nEvery VM reports its status as part of the VM's properties. Check a VM's status\nfor any of the following reasons:\n\n- If there are issues with the VM.\n- To confirm the VM is running after it has started.\n- To verify the VM is in the `Paused` or `Stopped` state.\n\n### List VMs to check status\n\nThe following procedure shows how to list VMs, view their status, and get\nadditional status information.\n\n1. List all VMs and view the status of each:\n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER\u003c/var\u003e \\\n get virtualmachines.virtualmachine.gdc.goog -n \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\n\n Replace the variables in the code examples with your own values\n according to the following table.\n\n Example output: \n\n NAME STATUS AGE\n vm-1 Running 1d\n vm-2 Stopped 8d\n vm-3 ErrorConfiguration 1d\n\n2. Get additional details about a particular VM's status:\n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER\u003c/var\u003e \\\n get virtualmachines.virtualmachine.gdc.goog \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e -o \\\n jsonpath='{\"State:\"}{.status.state}{\"\\n\"}{\"Reason:\"}{.status.reason}{\"\\n\"}{\"Message:\"}{.status.message}{\"\\n\"}'\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER\u003c/var\u003e with the `kubeconfig` file for the Management API server you obtained from the `gdcloud auth login` command.\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the new VM.\n - \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e with the GDC project in which the VM resides.\n\n Example output showing `Reason` and `Message` values: \n\n State: ErrorConfiguration\n Reason: MachineDiskNotFound\n Message: VirtualMachineDisk disk-1 in namespace project-1 does not exist.\n\n You might also get empty fields for `Reason` and `Message`. This indicates\n there was nothing for the system to report regarding them.\n\n Example output with `Reason` and `Message` empty: \n\n State: Running\n Reason:\n Message:\n\nStop, or restart a VM\n---------------------\n\nDuring the VM lifecycle you might need to stop and restart a VM,\nor delete a VM to respond to a status change or generally manage the VM. See\nthese pages to stop, reset, or delete a VM:\n\n- [Stop a VM](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/vms/manage-vms/operations-and-lifecycle/start-and-stop-vm#stop-a-vm)\n- [Restart a VM](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/vms/manage-vms/operations-and-lifecycle/start-and-stop-vm#restart-a-vm)\n- [Delete a VM](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/vms/manage-vms/operations-and-lifecycle/delete-vms)"]]