Elenca e visualizza le informazioni sulle VM utilizzando il runtime VM su GDC
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questo documento è rivolto ai proprietari di applicazioni che eseguono Google Distributed Cloud.
Questo documento mostra come elencare le VM in esecuzione su Google Distributed Cloud utilizzando il runtime VM su GDC. Puoi anche visualizzare informazioni aggiuntive per ogni VM.
Prima di iniziare
Per completare questo documento, devi disporre dell'accesso alle seguenti risorse:
Per visualizzare un elenco di VM in uno spazio dei nomi specifico, utilizza il parametro --namespace con il comando kubectl.
Visualizza un elenco di VM in uno spazio dei nomi utilizzando kubectl get gvm:
kubectlgetgvm--namespaceNAMESPACE_NAME
Sostituisci NAMESPACE_NAME con lo spazio dei nomi che vuoi visualizzare.
L'esempio di output seguente mostra le informazioni sulla VM:
NAMESTATUSAGEIP
vm1Running7m192.168.2.72
Visualizza le informazioni sulla VM
Se vuoi visualizzare informazioni su una VM specifica nel cluster, utilizza
kubectl. Questa opzione è utile per visualizzare informazioni di configurazione aggiuntive per una VM, ad esempio spazio di archiviazione o rete.
Visualizza informazioni dettagliate su una VM utilizzando kubectl describe gvm:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-01 UTC."],[],[],null,["This document is intended for application owners that run Google Distributed Cloud.\nThis document shows you how to list VMs that run on Google Distributed Cloud using\nVM Runtime on GDC. You can also view additional information for each\nVM.\n\nBefore you begin\n\nTo complete this document, you need access to the following resources:\n\n- A VM that runs in one of your clusters. If needed, [create a VM in Google Distributed Cloud](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/quickstart).\n- The `virtctl` client tool installed as a plugin for `kubectl`. If needed, [install the virtctl client tool](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/quickstart#install_the_virtctl_client_tool).\n\nList VMs\n\nYou can list VMs and their status across all namespaces, or only VMs in a\nspecific namespace.\n\nAll namespaces\n\nTo view a list of VMs in your cluster, use the `kubectl` command.\n\n- View a list of all VMs using `kubectl get gvm`:\n\n kubectl get gvm --all-namespaces\n\n The following example output shows the VM information: \n\n NAME STATUS AGE IP\n vm1 Running 7m 192.168.2.72\n vm2 Running 4m 192.168.2.73\n\nSingle namespace\n\nTo view a list of VMs in a specific namespace, use the `--namespace` parameter\nwith the `kubectl` command.\n\n- View a list of VMs in a namespace using `kubectl get gvm`:\n\n kubectl get gvm --namespace \u003cvar label=\"namespace_name\" translate=\"no\"\u003eNAMESPACE_NAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eNAMESPACE_NAME\u003c/var\u003e with the namespace you want to\n view.\n\n The following example output shows the VM information: \n\n NAME STATUS AGE IP\n vm1 Running 7m 192.168.2.72\n\nView VM information\n\nIf you want to view information about a specific VM in your cluster, use\n`kubectl`. This option is useful to view additional configuration information\nfor a VM, such as storage or networking.\n\n- View detailed information about a VM using `kubectl describe gvm`:\n\n kubectl describe gvm \u003cvar label=\"vm_name\" translate=\"no\"\u003eVM_NAME\u003c/var\u003e --namespace \u003cvar label=\"namespace_name\" translate=\"no\"\u003eNAMESPACE_NAME\u003c/var\u003e\n\n Replace the following values:\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of your VM.\n - \u003cvar translate=\"no\"\u003eNAMESPACE_NAME\u003c/var\u003e: the namespace for your VM.\n\n The following example output snippet shows the detailed information for the VM\n that you specify: \n\n Name: vm1\n Namespace: default\n Labels: \u003cnone\u003e\n Annotations: \u003cnone\u003e\n API Version: vm.cluster.gke.io/v1\n Kind: VirtualMachine\n Metadata:\n Creation Timestamp: 2022-04-25T23:36:24Z\n Finalizers:\n vm.cluster.gke.io/vm-finalizer\n Generation: 1\n Managed Fields:\n API Version: vm.cluster.gke.io/v1\n Fields Type: FieldsV1\n fieldsV1:\n ...\n Spec:\n Compute:\n Interfaces:\n Name: eth0\n Network Name: pod-network\n Virt Spec:\n Template:\n Metadata:\n Creation Timestamp: \u003cnil\u003e\n Labels:\n kubevirt.io/vm: vm1\n Spec:\n Domain:\n Cpu:\n Cores: 2\n Devices:\n Disks:\n Boot Order: 1\n Disk:\n Bus: virtio\n Name: vm1-boot-dv\n Resources:\n Requests:\n Memory: 4Gi\n Volumes:\n Data Volume:\n Name: vm1-boot-dv\n Name: vm1-boot-dv\n Status:\n ...\n Interfaces:\n Dns Config:\n Nameservers:\n 172.26.232.10\n Ip Addresses:\n 192.168.4.118\n Mac Address: f8:8f:ca:00:00:01\n Name: eth0\n Resource Name: vm1-eth0-f8b63\n Routes:\n To: 192.168.0.0/16\n To: 172.26.232.0/24\n State: Running\n Events: \u003cnone\u003e\n\nWhat's next\n\n- [Manage the power state of VMs in Google Distributed Cloud](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/manage-power-state).\n- [Edit a VM in Google Distributed Cloud in Google Distributed Cloud](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/edit-vm)."]]