Skip to content

Virtual Machine

This guide demonstrates how to create and provision a Virtual Machine (VM) within the OtterScale cluster for running workloads.

Before creating a Virtual Machine, you need to create a Data Volume (Persistent Volume Claim) that will serve as the bootable OS disk for the VM.

  1. Navigate to the Data Volume section:

    • Open your browser and go to:
    <url>/scope/<scope-name>/service/data-volume
  2. Create a new Data Volume for the VM boot disk:

    • Click the Create button (plus icon) at the top of the Data Volume page
    • A modal window titled “Create Data Volume” will appear
  3. Configure the boot image Data Volume (PVC):

    • Name: Enter a unique name for the boot disk (e.g., ubuntu-20.04-vm-boot)
    • Namespace: Specify the Kubernetes namespace (defaults to kubevirt)
    • Size: Set the capacity of the volume (e.g., 20 GB for a typical VM)
    • Boot Image: Toggle this option to enable the boot image mode (this will display the source input field)
    • Source: Enter the URL of the bootable OS image:
      • Example: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
      • You can use the “Cloud Image” button to browse common Ubuntu cloud images
  4. Click Confirm to create the boot image Data Volume:

    • The PVC will begin importing the OS image from the specified source
    • Monitor the progress in the Data Volume list
    • Wait until the Phase changes to Succeeded before proceeding to create the VM
  1. Navigate to the Compute section:

    Open your browser and go to:

    <url>/scope/<scope-name>/compute
  2. Create a new Virtual Machine:

    • Click the Create button (plus icon) at the top of the Compute page
    • A modal window titled “Create Virtual Machine” will appear
  3. Configure Basic Settings:

    • Name: Enter a unique name for the VM (e.g., my-demo-vm)
    • Namespace: Specify the Kubernetes namespace (defaults to kubevirt)
    • Instance Type: Select a hardware profile from the dropdown list (displays CPU cores and Memory size)
    • Data Volume: Select the bootable Data Volume (PVC) to use as the OS disk
  4. Configure Advanced Settings (Optional):

    • Expand the “Advanced” section to configure a Startup Script (Cloud-Init user data)
    • This allows you to bootstrap the instance with custom initialization commands
    • Example configuration for user setup and SSH access:
    #cloud-config
    users:
    - name: phison
    sudo: ['ALL=(ALL) NOPASSWD:ALL']
    groups: sudo
    shell: /bin/bash
    chpasswd:
    list: |
    phison:phison_8299
    expire: false
    ssh_pwauth: true
  5. Review and Confirm:

    • Review all the configuration settings
    • Click Confirm to launch the Virtual Machine
  6. Wait for VM Initialization:

    • The VM will begin provisioning and cloning a Data Volume for its use
    • Monitor the Status column to track the initialization progress
    • Wait until the status changes to Running

Once the VM is created, you can monitor its status in the Compute page:

  1. View the VM in the Compute list:

    • Locate your newly created VM by name in the table
    • Check the Status column to see the current state (e.g., Running, Stopped)
  2. Access VM resources:

    • Machine: Click to view which physical node is hosting your VM
    • Disk: Expand to view and manage attached storage volumes
    • Ports: Expand to view and manage network port configurations
    • Metrics: Monitor real-time CPU, Memory, and Storage usage
    • VNC: Access the VM console directly through VNC

To enable external access to your Virtual Machine, configure a service to expose its ports:

  1. Add a service port for SSH access:

    • In the Compute page, locate your VM in the table
    • Click on the Ports column to expand the port management section
    • Click Add Port to create a new service port
    • Configure the port settings:
      • Protocol: tcp
      • Port: 22 (SSH service port on the VM)
      • NodePort: (leave empty for automatic assignment or specify a fixed port)
    • The system will automatically assign a NodePort (e.g., 30022) for external access
  2. Note the NodePort:

    • Record the assigned NodePort from the Ports section
    • This is the port you’ll use to connect to the VM from outside the cluster

Once the VM is running, fully initialized, and the service port is configured:

  1. Wait for cloud-init initialization:

    • The VM will automatically execute the cloud-init configuration
    • The system user phison will be created with sudo privileges
    • The password will be set as configured in the cloud-config
  2. Connect to the VM:

    • Use SSH to connect to your VM from external hosts
    • Connection example:
      ssh -p <NodePort> phison@<cluster-host>
    • Or use VNC to connect directly through the web interface
    • Login credentials:
      • Username: phison
      • Password: phison_8299
  3. Start using your VM:

    • You now have full access to configure and use the Virtual Machine
    • The user has sudo privileges for system administration tasks

Explore other demo applications and services to enhance your infrastructure: