Skip to content

Commit d142c57

Browse files
committed
Update Blog “management-paradigms-for-virtual-machines-running-on-kubernetes”
1 parent 07d5a74 commit d142c57

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

content/blog/management-paradigms-for-virtual-machines-running-on-kubernetes.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ But first, a brief introduction to KubeVirt.
2121

2222
KubeVirt provide abstractions to Kubernetes users for Linux Kernel Virtual Machines (KVM). KVM has been around for about two decades now with several successful commercial hypervisors built around the implementation and is at this point considered mature.
2323

24-
KubeVirt itself does not have a user interface which most VM administrators are used to. The point of abstraction is through standard Kubernetes tools by manipulating API resources of different Kinds provided by \`CustomResourceDefinitions\` (CRDs).
24+
KubeVirt itself does not have a user interface which most VM administrators are used to. The point of abstraction is through standard Kubernetes tools by manipulating API resources of different Kinds provided by `CustomResourceDefinitions` (CRDs).
2525

26-
The \`CRDs\` allows users to manage VM resources through a set of KubeVirt’s controllers.
26+
The `CRDs` allows users to manage VM resources through a set of KubeVirt’s controllers.
2727

2828
![](/img/kubevirt.png)
2929

@@ -107,13 +107,13 @@ It is entirely possible to use `kubectl` out-of-the-box to deploy and manage VM
107107

108108
Installing `virtctl` varies by platform and KubeVirt distribution. It’s advised at this point to have the same client and server version which at the time of writing is 1.4.0. If using a Mac with Brew installed, it’s simply:
109109

110-
```bash
110+
```shell
111111
brew install virtctl
112112
```
113113

114114
First we need to inform ourselves what `DataSources` are available on the cluster. Building new `DataSources` or importing new ones is out of scope for this blog post. VMs are cloned into new `PersistentVolumeClaims` (PVCs) from `DataSources`. List the existing the `DataSources` on the cluster:
115115

116-
```bash
116+
```shell
117117
$ kubectl get datasources -A
118118
NAMESPACE NAME AGE
119119
kubevirt-os-images centos-stream8 13h
@@ -135,7 +135,7 @@ kubevirt-os-images win2k22 13h
135135

136136
Not all `DataSources` are populated by default. On OKD, only “fedora” and “centos-stream9” are available. It can be checked by examining `DataImportCrons`.
137137

138-
```bash
138+
```shell
139139
$ kubectl get dataimportcrons -A
140140
NAMESPACE NAME FORMAT
141141
kubevirt-os-images centos-stream9-image-cron pvc
@@ -162,7 +162,7 @@ spec:
162162

163163
Now, create the VM and attach it to the network:
164164

165-
```bash
165+
```shell
166166
virtctl create vm --name my-vm-0 \
167167
--access-cred type:ssh,src:desktop,user:fedora \
168168
--volume-import=type:ds,src:kubevirt-os-images/fedora,size:64Gi \
@@ -172,7 +172,7 @@ kubectl patch vm/my-vm-0 -n hpe-vmi --type=merge --patch-file my-network.yaml
172172

173173
Monitor the progress of the VM:
174174

175-
```bash
175+
```shell
176176
$ kubectl get vm -n hpe-vmi -w
177177
NAME AGE STATUS READY
178178
my-vm-0 13s Provisioning False
@@ -183,14 +183,14 @@ my-vm-0 42s Running True
183183

184184
Once the VM is running, it’s possible to login with the SSH identity and hostname given to the VM (assuming DHCP registers the hostname in DNS on the management network).
185185

186-
```bash
186+
```shell
187187
$ ssh fedora@my-vm-0
188188
[fedora@my-vm-0 ~]$
189189
```
190190

191191
So, what does the VM instance actually look like? Let’s install some tools and inspect.
192192

193-
```bash
193+
```shell
194194
$ sudo dnf install -yq fastfetch virt-what
195195
$ sudo virt-what
196196
redhat
@@ -221,7 +221,7 @@ Except for the “Host” hint, this looks like any VM instance on a KVM hypervi
221221

222222
With `virtctl` it’s possible to live migrate, pause/unpause, stop/start and restart the VM. Deleting the VM requires `kubectl`.
223223

224-
```bash
224+
```shell
225225
kubectl delete -n hpe-vmi vm/my-vm-0
226226
```
227227

@@ -253,7 +253,7 @@ Ansible has historically been well integrated with other KVM-based hypervisors s
253253

254254
Ansible can be installed on your desktop computer in a multitude of ways and will not be covered in this blog. Once Ansible is in place, install the KubeVirt collection:
255255

256-
```bash
256+
```shell
257257
ansible-galaxy collection install kubevirt.core
258258
```
259259

@@ -335,7 +335,7 @@ Many attributes have been hardcoded in this example but it illustrates the simil
335335

336336
Use the playbook to create a VM:
337337

338-
```bash
338+
```shell
339339
ansible-playbook -e vm=my-vm-0 create_vm.yaml
340340
```
341341

@@ -354,7 +354,7 @@ compose:
354354

355355
It’s now possible to use the KubeVirt inventory plugin to manage the OS and apps in the VM. Let’s see if it connects:
356356

357-
```bash
357+
```shell
358358
ansible -i hosts.kubevirt.yaml -m ping my-vm-0
359359
my-vm-0 | SUCCESS => {
360360
"ansible_facts": {
@@ -371,4 +371,4 @@ At this point it’s possible to manage the VM like any other host provisioned o
371371

372372
It doesn’t matter what your distinct VM management workflow looks like, KubeVirt serves all popular patterns. That said, current tools and processes will require an overhaul and why not switch to idempotent VM management through GitOps while transitioning from your legacy hypervisor? That's a topic for another day.
373373

374-
Connect with the HPE Developer Community via [Slack](https://developer.hpe.com/slack-signup/) or sign up for the [Munch & Learn Technology Talks](https://developer.hpe.com/campaign/munch-and-learn/) to immerse yourself in the latest breakthrough technologies from HPE, customers, and partners.
374+
Connect with the HPE Developer Community via [Slack](https://developer.hpe.com/slack-signup/) or sign up for the [Munch & Learn Technology Talks](https://developer.hpe.com/campaign/munch-and-learn/) to immerse yourself in the latest breakthrough technologies from HPE, customers, and partners.

0 commit comments

Comments
 (0)