<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Panchal Dhairya</title>
    <description>The latest articles on DEV Community by Panchal Dhairya (@panchaldhairya16).</description>
    <link>https://dev.to/panchaldhairya16</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4222500%2Fbed2c60d-9a1d-4e0f-9dbd-a6b0f9b5e0e9.png</url>
      <title>DEV Community: Panchal Dhairya</title>
      <link>https://dev.to/panchaldhairya16</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/panchaldhairya16"/>
    <language>en</language>
    <item>
      <title>KubeVirt: Running Virtual Machines on Kubernetes – A Practical Hands-On Guide by Dhairya Panchal</title>
      <dc:creator>Panchal Dhairya</dc:creator>
      <pubDate>Wed, 04 Nov 2026 07:39:35 +0000</pubDate>
      <link>https://dev.to/panchaldhairya16/kubevirt-running-virtual-machines-on-kubernetes-a-practical-hands-on-guide-by-dhairya-panchal-1ifp</link>
      <guid>https://dev.to/panchaldhairya16/kubevirt-running-virtual-machines-on-kubernetes-a-practical-hands-on-guide-by-dhairya-panchal-1ifp</guid>
      <description>&lt;p&gt;What if you could manage traditional Virtual Machines and modern containerized applications on the same Kubernetes platform?&lt;/p&gt;

&lt;p&gt;When we talk about Kubernetes, the first thing that usually comes to mind is containers, Pods, Deployments, and Services.&lt;/p&gt;

&lt;p&gt;But infrastructure is not always that simple.&lt;/p&gt;

&lt;p&gt;Many organizations still depend on traditional Virtual Machines. Some applications cannot easily be containerized, while others rely on existing virtualized environments that are already working well.&lt;/p&gt;

&lt;p&gt;So, does adopting Kubernetes mean leaving all those virtual machines behind?&lt;/p&gt;

&lt;p&gt;Not at all.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;KubeVirt&lt;/strong&gt; becomes interesting.&lt;/p&gt;

&lt;p&gt;In this article, we'll understand why KubeVirt exists, what we can do with it, and most importantly, how to create, start, access, stop, and delete a virtual machine using a practical Kubernetes lab.&lt;/p&gt;

&lt;p&gt;Let's explore!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. What is KubeVirt&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;KubeVirt is an open-source technology that extends Kubernetes to support virtual machine workloads.&lt;/p&gt;

&lt;p&gt;Its main idea is simple: allow development teams to manage both traditional virtual machines and containerized applications within a common Kubernetes environment.&lt;/p&gt;

&lt;p&gt;Instead of treating virtual machines and containers as two completely separate worlds, KubeVirt makes it possible to bring them together.&lt;/p&gt;

&lt;p&gt;This is particularly useful for teams that have already adopted Kubernetes but still have applications running inside virtual machines.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why KubeVirt?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's understand the problem KubeVirt addresses.&lt;/p&gt;

&lt;p&gt;Imagine a development team that has:&lt;/p&gt;

&lt;p&gt;Existing applications running inside virtual machines.&lt;/p&gt;

&lt;p&gt;New applications being developed using containers.&lt;/p&gt;

&lt;p&gt;Some legacy applications that cannot easily be containerized.&lt;/p&gt;

&lt;p&gt;A requirement to manage everything through a common platform.&lt;/p&gt;

&lt;p&gt;Managing these workloads separately can introduce additional complexity.&lt;/p&gt;

&lt;p&gt;KubeVirt provides a unified development platform where teams can build, modify, and deploy applications residing in both application containers and virtual machines.&lt;/p&gt;

&lt;p&gt;One of the most interesting benefits is that teams don't have to migrate everything at once.&lt;/p&gt;

&lt;p&gt;They can gradually containerize applications, break larger workloads into smaller services, and continue using existing virtualized components wherever necessary.&lt;/p&gt;

&lt;p&gt;In my opinion, this gradual modernization approach is one of the most practical reasons to explore KubeVirt.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What Can We Do with KubeVirt?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are three important capabilities worth understanding.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;KubeVirt and Kubernetes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;KubeVirt allows teams to use Kubernetes to manage virtual machines for applications that are impractical to containerize.&lt;/p&gt;

&lt;p&gt;This brings VM workloads into the Kubernetes environment.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;KubeVirt and Virtual Machines&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can combine existing virtualized workloads with newly developed container workloads on a single platform.&lt;/p&gt;

&lt;p&gt;This makes it easier to work with both types of applications without immediately replacing existing infrastructure.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Containerized Applications&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;KubeVirt also supports the development of new microservice applications in containers that interact with existing virtualized applications.&lt;/p&gt;

&lt;p&gt;This is particularly useful when an organization is modernizing its application architecture step by step.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Let's Get Hands-On with KubeVirt!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Enough theory. Let's work with an actual virtual machine.&lt;/p&gt;

&lt;p&gt;For this practical exercise, we'll use the KubeVirt interactive lab available on Killercoda.&lt;/p&gt;

&lt;p&gt;Lab environment: KubeVirt 101 – Killercoda&lt;/p&gt;

&lt;p&gt;You can experiment with the commands directly in your browser without setting up your own Kubernetes environment.&lt;/p&gt;

&lt;p&gt;Step 1: Create a Virtual Machine&lt;/p&gt;

&lt;p&gt;First, download the sample VM manifest provided by KubeVirt.&lt;/p&gt;

&lt;p&gt;Run:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;wget &lt;a href="https://kubevirt.io/labs/manifests/vm.yaml" rel="noopener noreferrer"&gt;https://kubevirt.io/labs/manifests/vm.yaml&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, explore the downloaded YAML file:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;less vm.yaml&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Take a moment to understand the manifest. It defines the configuration required to create the virtual machine.&lt;/p&gt;

&lt;p&gt;One important detail: this example uses a ContainerDisk.&lt;/p&gt;

&lt;p&gt;A ContainerDisk allows a container image to be used as a virtual machine disk.&lt;/p&gt;

&lt;p&gt;However, the example disk does not persist data. Any changes made inside this VM should not be treated as permanent storage.&lt;/p&gt;

&lt;p&gt;The provided example uses a Cirros virtual machine.&lt;/p&gt;

&lt;p&gt;Step 2: Apply the VM Manifest&lt;/p&gt;

&lt;p&gt;Now let's create our first virtual machine.&lt;/p&gt;

&lt;p&gt;Run:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl apply -f &lt;a href="https://kubevirt.io/labs/manifests/vm.yaml" rel="noopener noreferrer"&gt;https://kubevirt.io/labs/manifests/vm.yaml&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You should receive an output similar to:&lt;/p&gt;

&lt;p&gt;virtualmachine.kubevirt.io *&lt;em&gt;"testvm" *&lt;/em&gt; created&lt;/p&gt;

&lt;p&gt;Congratulations! Your VirtualMachine resource has been created.&lt;/p&gt;

&lt;p&gt;But there is something important to understand here.&lt;/p&gt;

&lt;p&gt;Creating a VirtualMachine resource does not necessarily mean that its virtual machine instance is already running.&lt;/p&gt;

&lt;p&gt;Let's explore that difference.&lt;/p&gt;

&lt;p&gt;Step 3: List Existing Virtual Machines&lt;/p&gt;

&lt;p&gt;To see the available virtual machines, execute:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl get vms&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can also inspect the complete YAML configuration:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl get vms -o yaml testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This helps you understand the current configuration and state of the VM.&lt;/p&gt;

&lt;p&gt;Step 4: Start the Virtual Machine&lt;/p&gt;

&lt;p&gt;Now it's time to start our VM.&lt;/p&gt;

&lt;p&gt;Use the following command:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;virtctl start testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here, virtctl is the command-line tool used to interact with KubeVirt resources.&lt;/p&gt;

&lt;p&gt;If you have installed virtctl through Krew, you can also use the Kubernetes plugin command:&lt;br&gt;
**&lt;br&gt;
kubectl virt start testvm**&lt;/p&gt;

&lt;p&gt;After executing the command, check the VM status:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl get vms&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You should now see the VM in the Running state.&lt;/p&gt;

&lt;p&gt;That's our virtual machine running through KubeVirt!&lt;/p&gt;

&lt;p&gt;Step 5: Understand VM and VMI&lt;/p&gt;

&lt;p&gt;This is one of the most important concepts in KubeVirt.&lt;/p&gt;

&lt;p&gt;You might have noticed two different resource names:&lt;/p&gt;

&lt;p&gt;VM – VirtualMachine&lt;/p&gt;

&lt;p&gt;VMI – VirtualMachineInstance&lt;/p&gt;

&lt;p&gt;They are related, but they are not the same thing.&lt;/p&gt;

&lt;p&gt;VirtualMachine (VM) represents the virtual machine configuration and its desired lifecycle.&lt;/p&gt;

&lt;p&gt;VirtualMachineInstance (VMI) represents an actual running instance of that virtual machine.&lt;/p&gt;

&lt;p&gt;Let's check the running instances:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl get vmis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To inspect the complete VMI configuration:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl get vmis -o yaml testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is the interesting part:&lt;/p&gt;

&lt;p&gt;Before starting the VM, its VMI does not exist.&lt;/p&gt;

&lt;p&gt;When you start the VM, KubeVirt creates a VMI to represent the running instance.&lt;/p&gt;

&lt;p&gt;When you stop the VM, that VMI is deleted.&lt;/p&gt;

&lt;p&gt;The VirtualMachine resource can still remain available.&lt;/p&gt;

&lt;p&gt;This distinction is important when working with VM lifecycle management.&lt;/p&gt;

&lt;p&gt;Another thing to remember: changing the VM configuration does not automatically update an already-running VMI. If you modify properties that require a new instance, the existing VMI needs to be replaced by restarting the VM.&lt;/p&gt;

&lt;p&gt;Step 6: Access the Virtual Machine Using Serial Console&lt;/p&gt;

&lt;p&gt;Now that our VM is running, let's access it.&lt;/p&gt;

&lt;p&gt;Execute:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;virtctl console testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This connects you to the virtual machine's serial console.&lt;/p&gt;

&lt;p&gt;For the Cirros VM:&lt;/p&gt;

&lt;p&gt;Press Enter a few times.&lt;/p&gt;

&lt;p&gt;Wait for the login prompt.&lt;/p&gt;

&lt;p&gt;Use the username and password displayed by the lab.&lt;/p&gt;

&lt;p&gt;You should now be inside the virtual machine.&lt;/p&gt;

&lt;p&gt;You can interact with the guest operating system through this console.&lt;/p&gt;

&lt;p&gt;To disconnect from the serial console, press:&lt;/p&gt;

&lt;p&gt;Ctrl + ]&lt;/p&gt;

&lt;p&gt;A useful tip: If you want to observe the complete boot sequence through the serial console, connect immediately after starting the VM. You can test this by stopping and starting it again.&lt;/p&gt;

&lt;p&gt;Step 7: Stop the Virtual Machine&lt;/p&gt;

&lt;p&gt;Once you have finished experimenting, you can shut down the virtual machine.&lt;/p&gt;

&lt;p&gt;Run:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;virtctl stop testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Step 8: Delete the Virtual Machine&lt;/p&gt;

&lt;p&gt;Finally, let's clean up our lab environment.&lt;/p&gt;

&lt;p&gt;To delete the virtual machine, execute:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl delete vm testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This removes the VirtualMachine resource.&lt;/p&gt;

&lt;p&gt;And that's it!&lt;/p&gt;

&lt;p&gt;You've successfully explored the basic KubeVirt workflow, from creating a VM to accessing and managing its lifecycle.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What Did We Learn?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's quickly recap what we covered in this practical exercise.&lt;/p&gt;

&lt;p&gt;Task&lt;/p&gt;

&lt;p&gt;Command&lt;/p&gt;

&lt;p&gt;Download VM manifest&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;wget &lt;a href="https://kubevirt.io/labs/manifests/vm.yaml" rel="noopener noreferrer"&gt;https://kubevirt.io/labs/manifests/vm.yaml&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create VM&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl apply -f vm.yaml&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;List VMs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl get vms&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Start VM&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;virtctl start testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;List VM instances&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl get vmis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Access VM&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;virtctl console testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Stop VM&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;virtctl stop testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Delete VM&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;kubectl delete vm testvm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The most important concepts from this lab are:&lt;/p&gt;

&lt;p&gt;KubeVirt brings virtual machine workloads into Kubernetes.&lt;/p&gt;

&lt;p&gt;A VM and a VMI represent different things.&lt;/p&gt;

&lt;p&gt;Starting a VM creates its running instance.&lt;/p&gt;

&lt;p&gt;The serial console provides access to the guest operating system.&lt;/p&gt;

&lt;p&gt;VM lifecycle operations can be performed using virtctl and Kubernetes commands.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Final Thoughts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What I find interesting about KubeVirt is its approach to infrastructure modernization.&lt;/p&gt;

&lt;p&gt;We often hear that containers are the future and that applications should move away from traditional virtual machines.&lt;/p&gt;

&lt;p&gt;But real infrastructure doesn't change overnight.&lt;/p&gt;

&lt;p&gt;Organizations have existing workloads, applications, dependencies, and systems that cannot always be migrated immediately.&lt;/p&gt;

&lt;p&gt;KubeVirt offers an interesting way to bring these workloads into the Kubernetes ecosystem while allowing teams to adopt containerization gradually.&lt;/p&gt;

&lt;p&gt;If you're learning Kubernetes, DevOps, or cloud infrastructure, I would definitely recommend exploring this project.&lt;/p&gt;

&lt;p&gt;Start with a simple virtual machine, understand the difference between VM and VMI, experiment with lifecycle operations, and gradually explore more advanced features.&lt;/p&gt;

&lt;p&gt;Sometimes, learning a new technology becomes much easier when you stop reading about it and actually start experimenting.&lt;/p&gt;

&lt;p&gt;Have you tried KubeVirt yet? I'd love to hear about your experience in the comments!&lt;/p&gt;

</description>
      <category>kubevirt</category>
      <category>tutorial</category>
      <category>opensource</category>
      <category>kubernetes</category>
    </item>
  </channel>
</rss>
