使用 kubectl
CLI 存取 VMM API。
服務端點
VMM API 的 API 端點為 https://MANAGEMENT_API_SERVER_ENDPOINT/apis/virtualmachine.gdc.goog/v1
,其中 MANAGEMENT_API_SERVER_ENDPOINT
是 Management API 伺服器的端點。
探索文件
使用 kubectl proxy
指令在本機電腦上開啟 API 伺服器的 Proxy。您可以在下列網址存取探索文件:http://127.0.0.1:8001/apis/virtualmachine.gdc.goog/v1
。
VM KRM 範例
下列 VirtualMachineImageImport
檔案顯示如何從永久磁碟建立磁碟映像檔。您可以從 VirtualMachineDisk
清單中選擇永久磁碟,然後選取該磁碟來建立映像檔,並取得來源的 size
參數。「建立自訂映像檔」頁面也提供相同範例。
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. Select one of the following four options: ubuntu-2004, windows-2019, rhel-8, or rocky-linux-8.
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.