Accessing Virtual Machine via NodePort¶
This page explains how to access a virtual machine using NodePort.
Limitations of Existing Access Methods¶
-  
Virtual machines support access via VNC or console, but both methods have a limitation: they do not allow multiple terminals to be simultaneously online.
 -  
Using a NodePort-formatted Service can help solve this problem.
 
Create a Service¶
-  
Using the Container Management Page
- Select the cluster page where the target virtual machine is located and create a Service.
 - Select the access type as NodePort.
 - Choose the namespace (the namespace where the virtual machine resides).
 - Fill in the label selector as 
vm.kubevirt.io/name: your-vm-name. - Port Configuration: Choose TCP for the protocol, provide a custom port name, and set the service port and container port to 22.
 
 -  
After successful creation, you can access the virtual machine by using
ssh username@nodeip -p port. 
Create the Service via kubectl¶
-  
Write the YAML file as follows:
 -  
Run the following command:
 -  
After successful creation, you can access the virtual machine by using
ssh username@nodeip -p 32090.