Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Dokumen ini ditujukan untuk pemilik aplikasi yang menjalankan Google Distributed Cloud.
Dokumen ini menunjukkan cara menghapus virtual machine (VM) yang menggunakan VM Runtime di GDC. Anda dapat memilih untuk menghapus VM dan
resource disk terkait, hanya resource VM, atau hanya resource disk.
Sebelum memulai
Untuk menyelesaikan dokumen ini, Anda memerlukan akses ke resource berikut:
Alat klien virtctl yang diinstal sebagai plugin untuk kubectl. Jika diperlukan,
instal alat klien virtctl.
Menghapus resource VM dan disk
Opsi ini akan menghapus resource VM dan disk virtual terkait.
Gunakan kubectl untuk menghapus VM dan resource disk terkait:
kubectlvirtdeletevmVM_NAME--all
Ganti VM_NAME dengan nama VM yang ingin Anda
hapus.
Jika Anda ingin memeriksa resource yang digunakan oleh VM yang akan dihapus,
tentukan flag --dry-run bersama dengan --all.
Jika Anda ingin menghapus VM tanpa menghapus resource disk, jangan
sertakan tanda --all, seperti yang ditunjukkan di bagian berikutnya.
Menghapus resource VM
Opsi ini hanya menghapus resource VM. Setiap disk virtual terkait tetap
sebagai bagian dari cluster. Opsi ini memungkinkan Anda membuat VM lain dan menggunakan kembali
resource disk. Siklus proses VM dapat dikelola secara terpisah dari
siklus proses resource disk.
Gunakan kubectl untuk hanya menghapus VM:
kubectlvirtdeletevmVM_NAME
Ganti VM_NAME dengan nama VM yang ingin Anda
hapus.
Menghapus resource disk VM
Opsi ini menghapus resource disk virtual. Jika VM terkait masih berjalan di cluster, resource VM tidak akan dihapus. Pendekatan ini memungkinkan Anda menghapus resource
disk yang tersisa jika sebelumnya Anda menghapus VM tanpa menggunakan parameter
--all.
Gunakan kubectl untuk hanya menghapus resource disk VM:
kubectlvirtdeletediskDISK_NAME
Ganti DISK_NAME dengan nama disk yang ingin Anda hapus. Misalnya, boot disk default untuk VM diberi nama
DISK_NAME-boot-dv. Anda dapat mencantumkan semua disk yang ada menggunakan
kubectl get datavolume.
Jika Anda mencoba menghapus disk VM sebelum menghapus VM, disk tersebut akan ditandai untuk dihapus. Disk hanya dihapus jika Anda juga menghapus VM.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-01 UTC."],[],[],null,["This document is intended for application owners that run Google Distributed Cloud.\nThis document shows you how to delete virtual machines (VMs) that use\nVM Runtime on GDC. You can choose to delete both the VM and\nassociated disk resources, only the VM resource, or only the disk resources.\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\nDelete the VM and disk resources\n\nThis option deletes the VM resource and any associated virtual disks.\n\n- Use `kubectl` to delete both the VM and it's associated disk resources:\n\n kubectl virt delete vm \u003cvar label=\"name\" translate=\"no\"\u003eVM_NAME\u003c/var\u003e --all\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the VM that you want to\n delete.\n\n If you want to check the resources used by the VM that would be deleted,\n specify the `--dry-run` flag together with `--all`.\n\n If you want to delete the VM without also deleting the disk resource, don't\n include the `--all` flag, as shown in the next section.\n\nDelete the VM resource\n\nThis option only deletes the VM resource. Any associated virtual disks remain\nas part of the cluster. This option lets you create another VM and resuse the\ndisk resource. The lifecycle of the VM can be managed separately to the\nlifecycle of the disk resource.\n\n- Use `kubectl` to delete only the VM:\n\n kubectl virt delete vm \u003cvar label=\"name\" translate=\"no\"\u003eVM_NAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the VM that you want to\n delete.\n\nDelete the VM disk resource\n\nThis option deletes a virtual disk resource. If the associated VM still runs in\nthe cluster, the VM resource isn't deleted. This approach lets you delete a disk\nresource that remains if you previously deleted a VM without using the `--all`\nparameter.\n\n- Use `kubectl` to delete only the VM's disk resources:\n\n kubectl virt delete disk \u003cvar label=\"diskname\" translate=\"no\"\u003eDISK_NAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e with the name of the disk that you want\n to delete. For example, the default boot disk for a VM is named\n \u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e`-boot-dv`. You can list all existing disks using\n `kubectl get datavolume`.\n\n If you try to delete a VM's disk before deleting the VM, the disk\n is marked for deletion. The disk is only deleted when you also delete the VM.\n\nWhat's next\n\n- [Create and manage disks in Google Distributed Cloud](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/create-manage-disks)."]]