Virtual Machine
This guide demonstrates how to create and provision a Virtual Machine (VM) within the OtterScale cluster for running workloads.
Prepare Data Volume (Boot Image)
Section titled “Prepare Data Volume (Boot Image)”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.
-
Navigate to the Data Volume section:
- Open your browser and go to:
<url>/scope/<scope-name>/service/data-volume -
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
-
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
- Example:
- Name: Enter a unique name for the boot disk (e.g.,
-
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
Create a Virtual Machine
Section titled “Create a Virtual Machine”-
Navigate to the Compute section:
Open your browser and go to:
<url>/scope/<scope-name>/compute -
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
-
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
- Name: Enter a unique name for the VM (e.g.,
-
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-configusers:- name: phisonsudo: ['ALL=(ALL) NOPASSWD:ALL']groups: sudoshell: /bin/bashchpasswd:list: |phison:phison_8299expire: falsessh_pwauth: true -
Review and Confirm:
- Review all the configuration settings
- Click Confirm to launch the Virtual Machine
-
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
Monitor the Virtual Machine
Section titled “Monitor the Virtual Machine”Once the VM is created, you can monitor its status in the Compute page:
-
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)
-
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
Configure Service for VM Access
Section titled “Configure Service for VM Access”To enable external access to your Virtual Machine, configure a service to expose its ports:
-
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)
- Protocol:
- The system will automatically assign a NodePort (e.g.,
30022) for external access
-
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
Access Your Virtual Machine
Section titled “Access Your Virtual Machine”Once the VM is running, fully initialized, and the service port is configured:
-
Wait for cloud-init initialization:
- The VM will automatically execute the cloud-init configuration
- The system user
phisonwill be created with sudo privileges - The password will be set as configured in the cloud-config
-
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
- Username:
-
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
Next Steps
Section titled “Next Steps”Explore other demo applications and services to enhance your infrastructure: