-
Notifications
You must be signed in to change notification settings - Fork 0
/
05_ocpv_customization.html
495 lines (445 loc) · 19.9 KB
/
05_ocpv_customization.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
<!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 active"><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"><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/04_thanks';" 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/06_windows_vm';" 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: Customize Virtual Machines</h1>
<!-- Content -->
<div id="toc" class="toc">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="05_ocpv_customization.html#_customizing_a_virtual_machine_at_creation">1. Customizing a virtual machine at creation</a></li>
</ul>
</div>
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>In this lab, we will customize a virtual machine at creation, including using a customized template disk hosted on an external web server, setting resource properties, and specifying the password configured by <code>cloud-init</code>.</p>
</div>
<div class="ulist">
<div class="title">Goals</div>
<ul>
<li>
<p>Create VM from a QCOW2 image</p>
</li>
<li>
<p>Customize a VM using the Create Virtual Machine wizard</p>
</li>
</ul>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<div class="title">Important</div>
</td>
<td class="content">
<div class="paragraph">
<p>This section will customize a virtual machine at creation time, however if you’re interested in modifying virtual machine configuration after creation, the same procedure and dialogs apply to existing virtual machines.</p>
</div>
<div class="paragraph">
<p>However, not all resources can be modified while the VM is powered on, i.e. "hot add/remove". Refer to the documentation for details about each resource type and whether it can be modified while the VM is running. Alternatively, the user interface will notify you if the VM needs to be restarted for a change to take effect.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_customizing_a_virtual_machine_at_creation">1. Customizing a virtual machine at creation</h2>
<div class="sectionbody">
<div class="paragraph">
<p>You have already created a Fedora VM in the previous lab. This time you will customize the VM with a few different settings - for example, you will set a custom password for the <code>fedora</code> user.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
The <code>fedora</code> user is the default user configured by the <a href="https://fedoraproject.org/cloud/">Fedora Cloud image</a> used in this workshop. Templates created and used by your organization may use a different username or might use cloud-init or SysPrep to automatically join the guest operating system to an identity provider.
</td>
</tr>
</table>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>In the left menu, go back to <strong>Virtualization</strong> → <strong>VirtualMachines</strong>:</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/00_VMs.png" alt="00 VMs">
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
If you do not see the VMs created on the previous page, double-check to make sure you’re looking at the <code>vmexamples</code> project in the upper left corner of the panel.
</td>
</tr>
</table>
</div>
</li>
<li>
<p>In the top right dropdown, select <strong>Create</strong> → <strong>From template</strong>:</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/00_Create.png" alt="00 Create">
</div>
</div>
</li>
<li>
<p>From the pre-defined templates, select the <strong>Fedora VM</strong> tile:</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/00_Catalog.png" alt="00 Catalog">
</div>
</div>
</li>
<li>
<p>In the dialog that opens, click <strong>Customize VirtualMachine</strong>.</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/00_Fedora.png" alt="00 Fedora">
</div>
</div>
</li>
<li>
<p>Customize Virtual Machine</p>
<div class="paragraph">
<p>Even though this template has a disk already available, we want to import a different disk from the external web server. This is one option for deploying VMs from a library of disks, though it may be slower than relying on the storage provider to offload a PVC clone for the disk. The QCOW2 disk image used here could also be imported to a PVC and used as a source disk for VM clones. See <a href="https://docs.openshift.com/container-platform/4.13/virt/virtual_machines/importing_vms/virt-importing-virtual-machine-images-datavolumes.html">the documentation</a> for more details on how to do this.</p>
</div>
<div class="olist loweralpha">
<ol class="loweralpha" type="a">
<li>
<p>Specify the name <code>fedora02</code></p>
</li>
<li>
<p>Under <strong>Storage</strong> section</p>
<div class="olist lowerroman">
<ol class="lowerroman" type="i">
<li>
<p><strong>Disk source</strong>: <code>URL (creates PVC)</code></p>
</li>
<li>
<p><strong>URL</strong>: <code><a href="http://192.168.123.100:81/Fedora35.qcow2" class="bare">http://192.168.123.100:81/Fedora35.qcow2</a></code></p>
</li>
<li>
<p><strong>Disk size</strong>: 30 GiB</p>
</li>
</ol>
</div>
</li>
</ol>
</div>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/01_Create_VM_Boot_Source.png" alt="01 Create VM Boot Source">
</div>
</div>
<div class="paragraph">
<p>+
Press <strong>Next</strong></p>
</div>
</li>
<li>
<p>Review the <strong>Overview</strong> tab with the default configuration from the template</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/02_Wizard_General.png" alt="02 Wizard General">
</div>
</div>
</li>
<li>
<p>Click the link under <strong>CPU | Memory</strong> to adjust the resource allocation for the virtual machine. Change the number of CPUs to 2 and the memory to 4 GiB.</p>
</li>
<li>
<p>Navigate to the <strong>Scheduling</strong> tab and review the options available without modifying them</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/02_Wizard_Scheduling.png" alt="02 Wizard Scheduling">
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>A <strong>node selector</strong> is used to specify one or more cluster nodes that the VM is allowed to run on. These can be selected by name, label, or annotation.</p>
</li>
<li>
<p><strong>Tolerations</strong> are used when a cluster node has a <a href="https://docs.openshift.com/container-platform/4.13/nodes/scheduling/nodes-scheduler-taints-tolerations.html">taint</a> applied. Taints are an indicator that only specific workloads, those with a toleration for the taint, should be allowed to run on the node. They are helpful when you have, for example, some nodes that have GPUs where you only want VMs that use a GPU to run on those nodes.</p>
</li>
<li>
<p>An <strong>affinity rule</strong> is used to indicate that a VM should be scheduled with, or not with in the case of an anti-affinity rule, other workloads.</p>
</li>
<li>
<p>The <strong>dedicated resources</strong> function is used when you want to, for example, assign a PCIe device to the virtual machine or allocate specific CPU cores to the VM.</p>
</li>
<li>
<p>By default, all VMs will use the <em>Live Migrate</em> <strong>eviction strategy</strong>, which means that when a node is cordoned and drained for maintenance purposes, such as applying updates, the VM will be non-disruptively migrated to a different node. Alternatively, VMs can be configured to shutdown and do a cold migration or simply not migrate at all.</p>
</li>
<li>
<p>The <strong>descheduler</strong> is a feature of OpenShift that will periodically evaluate the VM and the host it’s running on to determine if it should be migrated to another host. This could be for resource optimization reasons or because an affinity rule is being violated.</p>
</li>
</ul>
</div>
</li>
<li>
<p>Navigate to the <strong>Network interfaces</strong> tab and notice by default, a Virtual Machine is connected to the <code>Pod networking</code> (which is just OpenShift internal networking).</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/03_Wizard_Networking.png" alt="03 Wizard Networking">
</div>
</div>
</li>
<li>
<p>Click the three vertical dots icon to edit <code>default</code>, and review the default options:</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/03_Wizard_Networking_Options.png" alt="03 Wizard Networking Options">
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>The <strong>model</strong> indicates the type of network adapter that will be used. VirtIO is the paravirtual NIC, whereas e1000 and others are emulated devices.</p>
</li>
<li>
<p><strong>Network</strong> is greyed out because there are no other networks available. In a future module of this workshop, we’ll add an additional network for the VMs and use it.</p>
</li>
<li>
<p><strong>Type</strong> indicates how the VM should be connected to the network. For the SDN, or <em>Pod networking</em>, this is set to <code>Masquerade</code>. For a VLAN network the <code>Bridge</code> setting is used.</p>
</li>
<li>
<p>For a newly created NIC, you have the option of customizing the <strong>MAC address</strong> assigned to it. It’s greyed out here because we’re editing an already created NIC.</p>
<div class="paragraph">
<p>Since there are no other networks avaialble at this time, press <strong>Cancel</strong> to exit the dialog.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
If you would like to add/manage networks for virtual machines and see how to connect a virtual machine to a layer 2 (VLAN) network, choose the optional Network Management module from the workshop navigation menu.
</td>
</tr>
</table>
</div>
</li>
</ul>
</div>
</li>
<li>
<p>Navigate to the <strong>Disks</strong> tab to see the devices allocated to the VM.</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/04_Wizard_Storage.png" alt="04 Wizard Storage">
</div>
</div>
<div class="paragraph">
<p>It is possible to add new and modify the default disks before creating the VM. You can also modify the storage class and the boot source — for example, to boot from an ISO — and you can define the disk interface instead of using the default <code>virtio</code> interface.</p>
</div>
</li>
<li>
<p>Click the three vertical dots icon to edit <code>rootdisk</code>, and review the default options:</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/04_Wizard_Storage_settings.png" alt="04 Wizard Storage settings">
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>The <strong>PersistentVolumeClaim Size</strong> will be the size of the disk attached to the VM. If the source of the disk is another PVC, it cannot be smaller than the source, otherwise, you want to make sure it is at least large enough to hold the QCOW2 or ISO that is being imported.</p>
</li>
<li>
<p>The <strong>type</strong> of the disk can be changed to be, for example, a CD-ROM device.</p>
</li>
<li>
<p>Each disk connects to the VM using an <strong>interface</strong>. The <code>VirtIO</code> interface is the KVM paravirtualized interface type.</p>
</li>
<li>
<p>The <strong>StorageClass</strong> indicates the type of storage that is backing the VM disk. This will be different for each storage provider, and some storage providers can have multiple storage classes representing different features, performance, and other capabilities.</p>
</li>
<li>
<p><strong>Optimized StorageProfile Settings</strong> indicate to use the clone strategy and volume mode indicated for the storage type. These are provided by Red Hat for many CSI providers, but can also be customized for your use cases.</p>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
If you would like to learn more about virtual machine storage, choose the optional Storage Management module from the workshop navigation menu.
</td>
</tr>
</table>
</div>
</li>
</ul>
</div>
</li>
<li>
<p>Navigate to the <strong>Scripts</strong> tab. This tab is used to apply guest OS customization, such as cloud-init or Sysprep, at deployment time.</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/05_Wizard_Scripts.png" alt="05 Wizard Scripts">
</div>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>cloud-init</strong> can be configured using the GUI dialog or using a standard YAML script for more advanced configuration. In the next step, we’ll customize this information</p>
</li>
<li>
<p>An <strong>Authorized SSH key</strong> may, optionally, be provided to allow one or more users to connect to the VM without a password. This SSH key can be stored as a <code>Secret</code> and automatically applied to new Linux VMs if desired.</p>
</li>
<li>
<p><strong>Sysprep</strong> is the Microsoft Windows tool for automatically configuring new OS deployments, including setting configurations like hostname, default <code>Administrator</code> passwords, and joining an Active Directory domain.</p>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
If you want to learn more about how to customize and deploy Windows virtual machines, choose the optional Windows Virtual Machines module from the workshop navigation menu.
</td>
</tr>
</table>
</div>
</li>
</ul>
</div>
</li>
<li>
<p>Since this is a Fedora VM, press <strong>Edit</strong> in the <strong>Cloud-init</strong> section to specify the password <code>ocpVirtIsGre@t</code> for the user <code>fedora</code>. Click <strong>Apply</strong> when done.</p>
<div class="paragraph">
<p>Notice that we can also specify network configuration information here by checking the appropriate box. This is useful when, for example, you’re connecting the VM directly to a VLAN network and want to configure a static IP address.</p>
</div>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/05_Wizard_Scripts_Password.png" alt="05 Wizard Scripts Password">
</div>
</div>
</li>
<li>
<p>Press <strong>Create VirtualMachine</strong> ensuring the option <strong>Start this VirtualMachine after creation</strong> is checked.</p>
<div class="imageblock">
<div class="content">
<img src="images/Create_VM_URL/06_Wizard_Review.png" alt="06 Wizard Review">
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
If you forget to check the <em>Start this VirtualMachine after creation</em> box, after the VM has been created and is in the <code>Stopped</code> status, click the <strong>Actions</strong> drop-down in the upper right of the panel and select <strong>Start</strong>.
</td>
</tr>
</table>
</div>
</li>
<li>
<p>Once the Virtual Machine is running feel free to connect to it using the <strong>Console</strong> tab. Remember that the user is <code>fedora</code> and the password is now the one that you specified before (for example <code>ocpVirtIsGre@t</code>).</p>
</li>
</ol>
</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/06_windows_vm';" 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>