Deleting a virtual machine (VM) removes the VM and its associated resources from your project. If you don't want to delete an instance, you can temporarily stop it. See Stop and start a VM.
Before you begin
To use gdcloud
command-line interface (CLI) commands, ensure that you have downloaded, installed,
and configured the gdcloud
CLI.
All commands for GDC air-gapped appliance use the gdcloud
or
kubectl
CLI, and require an operating system (OS) environment.
Get the kubeconfig file path
To run commands against the admin cluster, ensure you have the following resources:
Locate the admin cluster name, or ask your Platform Administrator (PA) what the cluster name is.
Sign in and generate the kubeconfig file for the admin cluster if you don't have one.
Use the path to replace
ADMIN_KUBECONFIG
in these instructions.
Delete a VM
Delete a VM by using the GDC console or kubectl
. The VM must not be
in a terminating or unknown state.
Console
In the navigation menu, click Virtual Machines > Instances.
In the list of VMs, select the checkbox for the VM that you want to delete.
Click Delete.
In the confirmation dialog, click Delete.
gdcloud
To delete a VM:
gdcloud compute instances delete VM_NAME --project PROJECT
- Replace
VM_NAME
with the name of the VM. - Replace
PROJECT
with the name of the GDC project in which the VM lives.
kubectl
Delete the VM:
kubectl --kubeconfig ADMIN_KUBECONFIG delete virtualmachines.virtualmachine.gdc.goog VM_NAME -n NAMESPACE_NAME
Replace
VM_NAME
andNAMESPACE_NAME
with the name and namespace, respectively, of the VM.Verify that you've deleted the VM:
kubectl --kubeconfig ADMIN_KUBECONFIG get virtualmachines.virtualmachine.gdc.goog VM_NAME -n PROJECT
Replace
PROJECT
with the VM project name.