View virtual machines (VMs) that have been created within a project and see
details associated with each, such as the ingress IP address, the egress IP
address, and the VM's status, such as Running.
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 Management API server, ensure you have the following resources:
- Locate the Management API server name, or ask your Platform Administrator (PA) what the server name is. 
- Sign in and generate the kubeconfig file for the Management API server if you don't have one. 
- Use the path to replace - MANAGEMENT_API_SERVER{"</var>"}}in these instructions.
Request permissions and access
To perform the tasks listed in this page, you must have the Project
VirtualMachine Admin role. Follow the steps to either
verify
or have your Project IAM Admin
assign
you the Project VirtualMachine Admin (project-vm-admin) role in the namespace
of the project where the VM resides.
For VM operations using the GDC console or the gdcloud CLI,
request your Project IAM Admin to assign you both the
Project VirtualMachine Admin role and the Project Viewer (project-viewer)
role.
Get a list of VMs
You can list the VMs available in a project by using the GDC console
or kubectl.
Console
- In the navigation menu, click Virtual Machines > Instances. 
- The VM instances page shows a list of VMs. 
- Click the name of a VM instance to view its details. 
gdcloud
To list VM instances:
gdcloud compute instances list --project PROJECT
- Replace PROJECTwith the name of the GDC project in which the VM lives.
kubectl
Get a list of VMs:
kubectl --kubeconfig MANAGEMENT_API_SERVER \
    get virtualmachines.virtualmachine.gdc.goog -n PROJECT
- Replace MANAGEMENT_API_SERVERwith the kubeconfig file for the Management API server.
- Replace PROJECTwith the name of the GDC project in which the VM lives.
Locate IP addresses for a VM
See the IP addresses page for instructions on viewing the IP address information for a given VM.
View a VM source image
You can view the source image of a VM.
kubectl
To get the VM boot disk:
  DISK=`kubectl --kubeconfig MANAGEMENT_API_SERVER get virtualmachines.virtualmachine.gdc.goog \
    -n PROJECT VM_NAME \
    -o jsonpath={.spec.disks[?(@.boot==true)].virtualMachineDiskRef.name}`
To view the source image:
  kubectl --kubeconfig MANAGEMENT_API_SERVER get virtualmachinedisk.virtualmachine.gdc.goog \
    -n PROJECT $DISK -o jsonpath={.spec.source.image.name}
- Replace MANAGEMENT_API_SERVERwith the kubeconfig file for the Management API server.
- Replace PROJECTwith the GDC project in which the VM lives.
- Replace VM_NAMEwith the name of the VM.