Skip to main content

Deploy a Virtual Machine

Create a managed virtual machine, or a stateful cluster of machines. Use a VM for a workload that needs persistent disks, stable network identities or a custom operating-system image. Two manifests work together:

  • A VirtualMachineConfiguration is a blueprint at organization level. It sets the operating-system image, startup script, agents and baseline secrets. The platform team usually owns it.
  • A VirtualMachine is an instance in a project. It names a blueprint and adds machine type, ports, disks and health checks.

Prerequisites​

  • A VirtualMachineConfiguration for the operating-system image that you need. Ask your platform team which ones exist.
  • The names of your organization, organizational-unit, environment and project.

Steps​

  1. Create the VirtualMachine manifest.

    apiVersion: lowops.manifests.v1
    kind: VirtualMachine
    metadata:
    name: data-processor
    project: analytics-platform
    environment: production
    organizational-unit: data-engineering
    organization: fincorp
    spec:
    description: "Batch data processor for ETL pipeline"
    machineType: e2-standard-4
    meshStrategy: DISABLED # SIDECAR | PROXYLESS | DISABLED
    ports:
    8080: http
    9090: grpc
    configuration:
    source: ubuntu-22-base # the VirtualMachineConfiguration blueprint
    variables:
    BATCH_SIZE: "1000" # passed to the startup script
    secrets:
    DB_PASSWORD: db-credentials # environment variable name: Secret manifest name
    volumeMounts:
    /data:
    source: "" # empty for a new disk, or a snapshot self-link
    diskConfig:
    sizeGb: 500
    type: pd-ssd
    health:
    startup:
    protocol: http
    port: 8080
    path: /healthz
    liveness:
    protocol: http
    port: 8080
    path: /healthz
    checkIntervalSec: 30
    unhealthyThreshold: 3
    accessControl:
    additionalRoles:
    - roles/bigquery.dataViewer
    buckets:
    - name: raw-data-lake
    permission: READ_ONLY
  2. For a cluster with stable identities, add a stateful block.

    spec:
    stateful:
    enabled: true
    clusterSize: 3 # number of instances
    allowTcp: [6379, 26379] # intra-cluster ports
    health:
    protocol: tcp
    port: 6379
  3. Commit the manifest in a pull request and merge it.

Verify​

The platform creates the instance template, the persistent disks, the health checks and the IAM bindings. A stateful cluster is a managed instance group of the size that you set.

Next​