Virtual Machine Manager API 概览

Google Distributed Cloud (GDC) 气隙式设备的虚拟机管理器 (VMM) 在其虚拟机 (VM) 操作和生命周期管理中使用 Kubernetes 资源模型 (KRM) API。

使用 kubectl CLI 调用 VMM API。

服务端点

VMM API 的 API 端点为 https://MANAGEMENT_API_SERVER_ENDPOINT/apis/virtualmachine.gdc.goog/v1,其中 MANAGEMENT_API_SERVER_ENDPOINT 是管理 API 服务器的端点。

发现文档

使用 kubectl proxy 命令打开本地机器上 API 服务器的代理。然后,您可以通过以下网址访问发现文档:http://127.0.0.1:8001/apis/virtualmachine.gdc.goog/v1

虚拟机 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.