Set up virtctl
The virtctl command-line interface (CLI) tool facilitates some of the virtual machine (VM) operations you will perform by providing convenient commands for copying and pasting into the virtual console, starting and stopping VMs, live migrating VMs, and uploading VM disk images.
The virtctl CLI also provides a lightweight Secure Copy Protocol (SCP) client with the virtctl scp
command, which you can use to transfer files to and from a VM. Its usage is similar to the ssh command.
Prerequisites
- An active virtual cluster with Palette Virtual Machine Orchestrator (VMO).
- Access to the virtual cluster.
Download and Connect virtctl
- Download the most recent virtctl artifact based on your machine type from the official KubeVirt Assets. Scroll down to the Assets section.
- Assign the execute permission to the virtctl command.
chmod +x virtctl
- Next, log in to Palette to connect your host cluster with the virtctl CLI.
- Navigate to the left Main Menu and select Clusters.
- Select the cluster you want to connect to.
- From the cluster overview page, navigate to the middle column containing cluster details and locate the Kubernetes Config File row.
- Click on the kubeconfig link to download the file.
Open a terminal window and set the KUBECONFIG environment variable to the file path of the kubeconfig file.
Example:
export KUBECONFIG=~/Downloads/dev-cluster.kubeconfig
Issue the
virtctl ssh <virtual_machinename>
orvirtctl vnc <virtual_machinename>
command to display the login screen.Example:
virtctl ssh ubuntu
You can now issue virtctl commands against the VM in your Kubernetes cluster.
Validate
Verify you have access to your virtual machine by issuing virtctl commands against it, as shown in the example below.
virtctl guestosinfo