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 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.
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
PROJECT
with the name of the GDC project in which the VM lives.
kubectl
Get a list of VMs:
kubectl --kubeconfig ADMIN_KUBECONFIG \
get virtualmachines.virtualmachine.gdc.goog -n PROJECT
- Replace
ADMIN_KUBECONFIG
with the file path for the admin clusterkubeconfig
. - Replace
PROJECT
with 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 ADMIN_KUBECONFIG get virtualmachines.virtualmachine.gdc.goog \
-n PROJECT VM_NAME \
-o jsonpath={.spec.disks[?(@.boot==true)].virtualMachineDiskRef.name}`
To view the source image:
kubectl --kubeconfig ADMIN_KUBECONFIG get virtualmachinedisk.virtualmachine.gdc.goog \
-n PROJECT $DISK -o jsonpath={.spec.source.image.name}
- Replace
ADMIN_KUBECONFIG
with the file path for the admin clusterkubeconfig
. - Replace
PROJECT
with the GDC project in which the VM lives. - Replace
VM_NAME
with the name of the VM.