Fix Virtual Machine is not starting

Scenario

The user tried to start the VM, but the process failed to execute successfully.

01 step2
The primary goal in this scenario is to investigate the cause of the failure and take corrective action to get exercise1 virtual machine back into the Running state. The amount of memory available for the virtual machine in this lab is 8GB.

The steps to fix the exercise1 are:

Console

  1. Login to OpenShift console using the assigned user account.

Username
userx
Password
{password}
  1. Go to Virtualization - Virtual Machines and check the VM status.

01 step2
  1. Check the Virtual Machine is failing with error ErrorUnschedulable.

02 step3
  1. Go to tab YAML and check the status of the Virtual Machine. It is failing with error message:

message: '0/6 nodes are available: 3 Insufficient memory, 3 node(s) had untolerated taint {node-role.kubernetes.io/master: }. preemption: 0/6 nodes are available: 3 No preemption victims found for incoming pod, 3 Preemption is not helpful for scheduling.'
  1. Check the memory assigned for the Virtual Machine in the field spec.domain.memory.guest.

        memory:
          guest: 128Gi
  1. Edit the yaml file to change the assigned value to 8Gi.

        memory:
          guest: 8Gi
  1. Save the updated configuration file and restart the virtual machine.

03 step7
  1. Wait for the virtual machine to start and check that now the virtual machine is in Running state.

04 step8
Run grade to validate the exercise
lab grade exercise1

Command line (CLI)

  1. Login to Openshift server API using the assigned user account with oc command if not logged in.

OpenShift login command
{login_command}
  1. Go to the assigned namespace-userx

oc project namespace-userx
  1. Check there is a virtual machine running in this namespace and it’s status. The output should be similar to the following one:

oc get pod,vm
NAME                                READY   STATUS    RESTARTS   AGE
pod/virt-launcher-exercise1         0/1     Pending   0          2m16s

NAME                                   AGE   STATUS               READY
virtualmachine.kubevirt.io/exercise1   85m   ErrorUnschedulable   False
  1. Check which the the Virtual Machine status to get more details about the error:

oc describe vm exercise1
status:
  Conditions:
    Last Probe Time:       2024-11-26T16:08:54Z
    Last Transition Time:  2024-11-26T16:08:54Z
    Message:               Guest VM is not reported as running
    Reason:                GuestNotRunning
    Status:                False
    Type:                  Ready
    Last Probe Time:       <nil>
    Last Transition Time:  <nil>
    Message:               All of the VMI's DVs are bound and not running
    Reason:                AllDVsReady
    Status:                True
    Type:                  DataVolumesReady
    Last Probe Time:       <nil>
    Last Transition Time:  2024-11-26T16:08:54Z
    Message:               0/6 nodes are available: 3 Insufficient memory, 3 node(s) had untolerated taint {node-role.kubernetes.io/master: }. preemption: 0/6 nodes are available: 3 No preemption victims found for incoming pod, 3 Preemption is not helpful for scheduling.
    Reason:                Unschedulable
    Status:                False
    Type:                  PodScheduled
  Created:                 true
  Desired Generation:      3
  Observed Generation:     3
  Printable Status:        ErrorUnschedulable
  Run Strategy:            Always
  1. Inspect the virtual machine and check the memory assigned to it in the field spec.domain.memory.guest.

oc get vm exercise1 -oyaml
        memory:
          guest: 128Gi
  1. Edit the virtual machine to assign 8Gi memory.

oc edit vm exercise1
        memory:
          guest: 8Gi
  1. Restart the virtual machine

virtctl restart exercise1
  1. Wait until the virtual machine is started and make sure it is in running state

oc get pod,vm
NAME                                READY   STATUS    RESTARTS   AGE
pod/virt-launcher-exercise1         1/1     Running   0          55s

NAME                                   AGE   STATUS    READY
virtualmachine.kubevirt.io/exercise1   96m   Running   True

What you learned

In this exercise, you learned that virtual machines running on OpenShift Virtualization operate similarly to pods. Specifically, when configuring resource requests for CPU or memory, you cannot allocate more resources to a virtual machine than are available on a single node.