Use the kubectl
CLI for the VMM APIs.
Service endpoint
The VMM KRM APIs are provided in two packages depending on zonal deployment or global deployment.
The API endpoints for the zonal and global VMM APIs are the following, respectively:
https://MANAGEMENT_API_SERVER_ENDPOINT/apis/virtualmachine.gdc.goog/v1
https://MANAGEMENT_API_SERVER_ENDPOINT/apis/virtualmachine.global.gdc.goog/v1
The MANAGEMENT_API_SERVER_ENDPOINT
variable is the
endpoint of the Management API server.
Discovery document
Use the kubectl proxy
command to open a proxy to the API server on your local
machine. From there, you can access the discovery document at one of the
following URLs:
http://127.0.0.1:8001/apis/virtualmachine.gdc.goog/v1
http://127.0.0.1:8001/apis/virtualmachine.global.gdc.goog/v1
Example of VM KRM
The following VirtualMachineImageImport
file shows the creation of a disk
image from a persistent disk. You choose the persistent
disk from a VirtualMachineDisk
list and select it to create the image and get
the size
parameter of the source. The same example is on the
Create custom images
page.
apiVersion: virtualmachine.gdc.goog/v1
kind: VirtualMachineImageImport
metadata:
name: VM_IMAGE_IMPORT_NAME
# Name of the VM image you want to import.
spec:
source:
diskRef:
name: DISK_NAME
# Name of the source disk that you will use to create your image.
imageMetadata:
name: IMAGE_NAME
# Name of your created VM image.
operatingSystem: OS_NAME
# Name of the image OS.
minimumDiskSize: MINIMUM_DISK_SIZE
# Disk size in the VM image. It must be greater than or equal to the source disk size. An example value is 20G.