VMM API には kubectl CLI を使用します。
サービス エンドポイント
VMM API の API エンドポイントは https://MANAGEMENT_API_SERVER_ENDPOINT/apis/virtualmachine.gdc.goog/v1 です。ここで、MANAGEMENT_API_SERVER_ENDPOINT は Management API サーバーのエンドポイントです。
ディスカバリ ドキュメント
kubectl proxy コマンドを使用して、ローカル マシン上の API サーバーへのプロキシを開きます。ディスカバリ ドキュメントには、次の URL(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.