-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path09_storage_management.html
538 lines (488 loc) · 21.9 KB
/
09_storage_management.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<script src="jquery/jquery.min.js"></script>
<script src="popper/popper.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="requirejs/require.js"></script>
<script>var workshop_base_url = "/workshop";</script>
<link rel="stylesheet" href="asciidoctor/css/asciidoctor.css">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="fontawesome/css/all.min.css">
<link rel="stylesheet" href="css/workshop.css">
<link rel="stylesheet" href="css/workshop-asciidoc.css">
</head>
</body>
<!-- Header -->
<header class="header">
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<a href="index.html" class="logo">Red Hat OpenShift Virtualization Roadshow</a>
</div>
</div>
</div>
</header>
<!-- Main -->
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 d-sm-block d-none">
<!-- Table of Contents -->
<ul class="menu">
<li class="category">
<ul class="modules">
<h5 class="category-title">Workshop Modules</h5>
<li class="page"><a href="index.html">Welcome</a></li>
<li class="page"><a href="02_migrate_vms.html">Migrating Virtual Machines</a></li>
<li class="page"><a href="03_ocpv_basics.html">OpenShift Virtualization Basics</a></li>
<li class="page"><a href="04_thanks.html">Thank you and next steps</a></li>
<li class="page"><a href="05_ocpv_customization.html">Optional: Customize Virtual Machines</a></li>
<li class="page"><a href="06_windows_vm.html">Optional: Windows Virtual Machines</a></li>
<li class="page"><a href="07_bare_metal.html">Optional: Bare Metal OpenShift Overview</a></li>
<li class="page"><a href="08_network_management.html">Optional: Network Management</a></li>
<li class="page active"><a href="09_storage_management.html">Optional: Storage Management</a></li>
<li class="page"><a href="10_backup_restore.html">Optional: Backup and Restore</a></li>
<li class="page"><a href="11_metallb.html">Optional: Exposing apps using MetalLB</a></li>
<li class="page"><a href="12_service_route.html">Optional: Exposing apps using a Route</a></li>
</ul>
</li>
</ul>
</div>
<div class="col-sm-9">
<section class="page-content">
<!-- Top Navigation -->
<div class="btn-group btn-group-xs float-right">
<button type="button" onclick="location.href='/workshop/08_network_management';" class="btn btn-xs btn-transparent" aria-label="Prev">
<span class="fas fa-arrow-left" aria-hidden="true"></span>
</button>
<button type="button" onclick="location.href='/workshop/';" class="btn btn-xs btn-transparent" aria-label="Home">
<span class="fas fa-home" aria-hidden="true"></span>
</button>
<button type="button" onclick="location.href='/workshop/10_backup_restore';" class="btn btn-xs btn-transparent" aria-label="Next">
<span class="fas fa-arrow-right" aria-hidden="true"></span>
</button>
</div>
<!-- Title -->
<h1 class="title">Optional: Storage Management</h1>
<!-- Content -->
<div id="toc" class="toc">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="09_storage_management.html#_introduction_to_storage_management">1. Introduction to Storage Management</a></li>
<li><a href="09_storage_management.html#_openshift_virtualization_default_boot_sources">2. OpenShift Virtualization Default Boot Sources</a></li>
<li><a href="09_storage_management.html#_snapshots">3. Snapshots</a>
<ul class="sectlevel2">
<li><a href="09_storage_management.html#_introduction">3.1. Introduction</a></li>
<li><a href="09_storage_management.html#_creating_and_using_snapshots">3.2. Creating and using Snapshots</a></li>
</ul>
</li>
<li><a href="09_storage_management.html#_clone_a_virtual_machine">4. Clone a Virtual Machine</a>
<ul class="sectlevel2">
<li><a href="09_storage_management.html#_glossary_of_terms">4.1. Glossary of terms</a></li>
</ul>
</li>
</ul>
</div>
<div class="sect1">
<h2 id="_introduction_to_storage_management">1. Introduction to Storage Management</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Red Hat OpenShift supports multiple types of storage, both for on-premises and cloud providers. OpenShift Virtualization can use any supported container storage interface (CSI) provisioner in the environment you’re running on. For example, OpenShift Data Foundation, NetApp, Dell/EMC, Fujitsu, Hitachi, Pure Storage, Portworx, and many others support on-premises, CSI provisioned, ReadWriteMany (RWX) volumes with OpenShift Virtualization.</p>
</div>
<div class="paragraph">
<p>This workshop segment will explore Persistent Volume Claims (PVCs), which are used to request storage from the provider and store a VM disk. Many storage providers also support snapshots and clones of their devices, be sure to check with your vendor to verify the features supported by the CSI driver and storage device.</p>
</div>
<div class="paragraph">
<p>Notably, there are no restrictions on storage protocol (e.g. NFS, iSCSI, FC, etc.) specific to OpenShift Virtualization. The only requirement is that the RWX access mode is available for live migration. Otherwise, the storage that best meets the needs of your VMs and applications is always the right choice.</p>
</div>
<div class="imageblock">
<div class="content">
<img src="images/Storage/00_disk_concepts.png" alt="00 disk concepts">
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_openshift_virtualization_default_boot_sources">2. OpenShift Virtualization Default Boot Sources</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Persistent virtual machines require persistent storage. This lab environment has OpenShift Data Foundation deployed to provide access to shared persistent volumes to host application data and virtual machine disks. During the installation of the OpenShift Virtualization Operator, some <code>PersistentVolumeClaims</code> were automatically created to hold template disks for various Linux distributions. These include:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Red Hat Enterprise Linux 8</p>
</li>
<li>
<p>Red Hat Enterprise Linux 9</p>
</li>
<li>
<p>Fedora</p>
</li>
<li>
<p>CentOS 7</p>
</li>
<li>
<p>CentOS Stream 8</p>
</li>
<li>
<p>CentOS Stream 9</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Using these OS images is optional, and the creation + download can be disabled via the appropriate setting in the Operator. However, they are a quick and convenient way to get started provisioning virtual machines with OpenShift Virtualization since they use the "cloud" image for each of the respective distributions. This image includes cloud-init and, often, is a reduced OS footprint optimized for virtualization. Additionally, Red Hat provided boot images are automatically updated when new templates are released.</p>
</div>
<div class="paragraph">
<p>In this section, we will examine the PVCs created by the Operator along with PVCs used by a virtual machine.</p>
</div>
<div class="paragraph">
<p>The project <code>openshift-virtualization-os-images</code> contains all available boot sources and is automatically enabled when <strong>OpenShift Virtualization</strong> is installed.</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Navigate to <strong>Storage</strong> → <strong>PersistentVolumeClaims</strong>:</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/00_Left_Menu.png" alt="00 Left Menu">
</div>
</div>
</li>
<li>
<p>Press in the dropdown for the projects, enable <code>Show default projects</code>, and select the project <code>openshift-virtualization-os-images</code></p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/01_Select_Project.png" alt="01 Select Project">
</div>
</div>
</li>
<li>
<p>List the boot sources that OpenShift Virtualization automatically created.</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/02_List_PVCs.png" alt="02 List PVCs">
</div>
</div>
</li>
<li>
<p>Select one from the list, for example, <code>fedora-XX</code>, to obtain detailed information.</p>
<div class="paragraph">
<p>In this lab, each of the PVCs will come from the <code>ocs-storagecluster-ceph-rbd</code> storage class provided by OpenShift Data Foundation. The details of the PVC show that it is a <code>ReadWriteMany</code> PVC, which is required for live migration and is using <code>block</code> mode. The mode can be <code>block</code> or <code>file</code>, depending on the storage vendor, and either will work equally well so long as <code>RWX</code> mode is available.</p>
</div>
<div class="paragraph">
<p>The capacity should be large enough to hold the base operating system and any packages/software installed that will be used by any VMs created from this template disk. VMs created by cloning the disk can increase the size of the disk but cannot shrink it.</p>
</div>
<div class="imageblock">
<div class="content">
<img src="images/Storage/03_PVC_Info.png" alt="03 PVC Info">
</div>
</div>
</li>
<li>
<p>When a VM is created, the <em>Boot Source</em> image is cloned, and a new disk is created. Switch to the project <code>vmexamples</code> and review the list of the <em>PVCs</em> (disks). You will see a PVC for each of the disks for VMs in this project and a PVC for the Microsoft Windows Server 2019 disk image created in an earlier section of this workshop. This PVC, with the Microsoft Windows ISO, can be reused by other virtual machines to install the operating system if desired.</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/04_List_PVCs_VMs.png" alt="04 List PVCs VMs">
</div>
</div>
</li>
<li>
<p>Select the <code>fedora02</code> to obtain information</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/05_PVC_VM_Info.png" alt="05 PVC VM Info">
</div>
</div>
</li>
<li>
<p>A <em>Persistent Volume Claim</em> will claim to a specific <em>storage class</em> or to the default one to provision a <em>volume</em>. Navigate to <strong>Storage</strong> → <strong>PersistentVolumes</strong> to obtain a list. Sort by <strong>Claim</strong>.</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/07_PV_List.png" alt="07 PV List">
</div>
</div>
</li>
<li>
<p>Now navigate to <strong>Virtualization</strong> → <strong>Bootable volumes</strong> to obtain a list of the available volumes</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/08_List_Bootable_Volumes.png" alt="08 List Bootable Volumes">
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_snapshots">3. Snapshots</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_introduction">3.1. Introduction</h3>
<div class="paragraph">
<p>OpenShift Virtualization relies on the CSI storage provider’s snapshot capability to create disk snapshots for the virtual machine, which can be taken "online" while the VM is running or "offline" while the VM is powered off. If the KVM integrations are installed to the VM, you will also have the option of quiescing the guest operating system (quiescing ensures that the snapshot of the disk represents a consistent state of the guest file systems, e.g., buffers are flushed and the journal is consistent).</p>
</div>
<div class="paragraph">
<p>Since disk snapshots are dependent on the storage implementation, abstracted by CSI, performance impact and capacity used will depend on the storage provider. Work with your storage vendor to determine how the system will manage PVC snapshots and the impact they may or may not have.</p>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<div class="title">Important</div>
</td>
<td class="content">
<div class="paragraph">
<p>Snapshots, by themselves, are not a backup or disaster recovery capability. The data needs to be protected in other ways, such as one or more copies stored in a different location, to recover from the storage system failing.</p>
</div>
<div class="paragraph">
<p>In addition to the OpenShift API for Data Protection (OADP), partners such as Kasten by Veeam, Trilio, and Storware support the ability to backup and restore virtual machines to the same cluster or other clusters as needed.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>With the VM snapshots feature, cluster administrators and application developers can:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Create a new snapshot</p>
</li>
<li>
<p>List all snapshots attached to a specific VM</p>
</li>
<li>
<p>Revert a VM to a snapshot</p>
</li>
<li>
<p>Delete an existing VM snapshot</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="_creating_and_using_snapshots">3.2. Creating and using Snapshots</h3>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Navigate back to <strong>Virtualization</strong> → <strong>VirtualMachines</strong> and select a virtual machine, for example <code>fedora02</code> in the project <code>vmexamples</code>.</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/09_VM_Overview.png" alt="09 VM Overview">
</div>
</div>
</li>
<li>
<p>Navigate to the <strong>Snapshots</strong> tab</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/10_VM_Snapshots_Tab.png" alt="10 VM Snapshots Tab">
</div>
</div>
</li>
<li>
<p>Press <strong>Take snapshot</strong> and a dialog will open</p>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
There is a warning about the <code>cloudinitdisk</code> not being included in the snapshot. This is expected and happens because it is an ephemeral disk.
</td>
</tr>
</table>
</div>
<div class="imageblock">
<div class="content">
<img src="images/Storage/11_VM_Snapshot_Dialog.png" alt="11 VM Snapshot Dialog">
</div>
</div>
</li>
<li>
<p>Press <strong>Save</strong> and wait till the <em>Snapshot</em> has been created and the <strong>status</strong> shows as <code>Succeeded</code></p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/12_VM_Snapshot_Taken.png" alt="12 VM Snapshot Taken">
</div>
</div>
</li>
<li>
<p>Press the three dots and check that the <strong>Restore</strong> option is greyed out because the VM is running</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/13_VM_Restore_Disabled.png" alt="13 VM Restore Disabled">
</div>
</div>
</li>
<li>
<p>Switch to the <strong>Console</strong> tab to perform a modification to your running VM. This small modification will break your VM, and it won’t be able to boot anymore.</p>
<div class="paragraph">
<p>Log in with the user <code>fedora</code> and password <code>ocpVirtIsGre@t</code> (or whatever you used in the previous module). Execute the command:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sh" data-lang="sh">[fedora@fedora02 ~]$ sudo rm -rf /boot/grub2; sudo shutdown -r now</code></pre>
</div>
</div>
</li>
<li>
<p>The <em>Virtual Machine</em> will not be able to boot.</p>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<div class="title">Important</div>
</td>
<td class="content">
In the previous step, the operating system was shutdown from within the guest. However, OpenShift Virtualization will restart it automatically by default. This behavior can be changed globally or on a per-VM basis.
</td>
</tr>
</table>
</div>
<div class="imageblock">
<div class="content">
<img src="images/Storage/14_VM_Crashed.png" alt="14 VM Crashed">
</div>
</div>
</li>
<li>
<p>Using the <strong>Actions</strong> dropdown menu, stop the <em>Virtual Machine</em>. Wait until the VM is stopped.</p>
</li>
<li>
<p>Navigate back to the <strong>Snapshots</strong> tab and press <strong>Restore</strong> on the previously created snapshot.</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/15_VM_Restore.png" alt="15 VM Restore">
</div>
</div>
</li>
<li>
<p>In the dialog shown, press <strong>Restore</strong></p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/16_VM_Restore_Dialog.png" alt="16 VM Restore Dialog">
</div>
</div>
</li>
<li>
<p>Wait until the VM is restored, and then start the VM</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/17_VM_Restored.png" alt="17 VM Restored">
</div>
</div>
</li>
<li>
<p>Verify that the VM is booting correctly again.</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/18_VM_Running.png" alt="18 VM Running">
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_clone_a_virtual_machine">4. Clone a Virtual Machine</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Cloning creates a new VM that uses its disk image for storage, but most of the clone’s configuration and stored data is identical to the source VM.</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Press <strong>Clone</strong> from the <strong>Actions</strong> menu, and a dialog will open</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/19_VM_Clone_Dialog.png" alt="19 VM Clone Dialog">
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
Notice the VM, if is powered on, it will be stopped to perform the clone. If you have a snapshot of the VM, you can also create a clone from the snapshot without powering off the VM.
</td>
</tr>
</table>
</div>
</li>
<li>
<p>A new VM is created, the disks are cloned and automatically the portal will redirect you to the new VM.</p>
<div class="imageblock">
<div class="content">
<img src="images/Storage/20_VM_Cloned.png" alt="20 VM Cloned">
</div>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<div class="title">Important</div>
</td>
<td class="content">
The cloned VM will have the same identity as the source VM, which may cause conflicts with applications and other clients interacting with the VM. Use caution when cloning a VM connected to an external network or in the same project.
</td>
</tr>
</table>
</div>
</li>
</ol>
</div>
<div class="sect2">
<h3 id="_glossary_of_terms">4.1. Glossary of terms</h3>
<div class="paragraph">
<p><strong>Container Storage Interface (CSI)</strong>: An API specification for the management of container storage across different container orchestration (CO) systems. An OpenShift cluster can have many CSI provisioners from different vendors, and each VM can use storage from multiple vendors without conflicts.</p>
</div>
<div class="paragraph">
<p><strong>Dynamic Provisioning</strong>: The storage framework allows you to create volumes on-demand, eliminating the need for cluster administrators to pre-provision persistent storage. Each VM disk is stored in a dynamically created storage volume at a 1:1 ratio.</p>
</div>
<div class="paragraph">
<p><strong>Persistent volumes (PV)</strong>: OpenShift Virtualization uses the Kubernetes persistent volume (PV) framework to allow cluster administrators to provision persistent storage for a cluster. VMs use a <em>PVC</em> to request PV resources without having specific knowledge of the underlying storage infrastructure.</p>
</div>
<div class="paragraph">
<p><strong>Persistent volume claims (PVCs)</strong>: A <em>PVC</em> is a request for storage capacity and, when bound to a PV, how the system knows which storage volume to mount for the VM. As a VM user, you’re able to use the storage without knowing the details of the underlying infrastructure environment.</p>
</div>
<div class="paragraph">
<p><strong>Storage class</strong>: A <em>storage class</em> provides a way for administrators to describe the classes of storage they offer, for example, "gold," "silver," and "bronze". Different classes might map to quality of service levels, backup policies, and arbitrary policies determined by the cluster administrators. These will be specific to your storage vendor.</p>
</div>
</div>
</div>
</div>
<!-- Bottom Navigation -->
<div class="page-meta clearfix">
<input type="button" class="btn btn-lg btn-primary float-right" onclick="location.href='/workshop/10_backup_restore';" value="Continue" />
</div>
</section>
</div>
</div>
</div>
<!-- Footer -->
<footer class="footer">
</footer>
<!-- Javascript-->
<script src="js/workshop.js"></script>
<script src="js/workshop-asciidoc.js"></script>
</body>
</html>