Mastering KVM Virtualization: Design expert data center virtualization solutions with the power of Linux KVM

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Kernel-based Virtual Machine (KVM) enables you to virtualize your data center by transforming your Linux operating system into a powerful hypervisor that allows you to manage multiple operating systems with minimal fuss. With this book, you'll gain insights into configuring, troubleshooting, and fixing bugs in KVM virtualization and related software. This second edition of Mastering KVM Virtualization is updated to cover the latest developments in the core KVM components - libvirt and QEMU. Starting with the basics of Linux virtualization, you'll explore VM lifecycle management and migration techniques. You'll then learn how to use SPICE and VNC protocols while creating VMs and discover best practices for using snapshots. As you progress, you'll integrate third-party tools with Ansible for automation and orchestration. You'll also learn to scale out and monitor your environments, and will cover oVirt, OpenStack, Eucalyptus, AWS, and ELK stack. Throughout the book, you'll find out more about tools such as Cloud-Init and Cloudbase-Init. Finally, you'll be taken through the performance tuning and troubleshooting guidelines for KVM-based virtual machines and a hypervisor. By the end of this book, you'll be well-versed with KVM virtualization and the tools and technologies needed to build and manage diverse virtualization environments.

Author(s): Vedran Dakic; Humble Devassy Chirammal; Prasad Mukhedkar; Anil Vettathu
Edition: 2
Publisher: Packt Publishing
Year: 2020

Language: English
Pages: 686

Cover
Copyright
About PACKT
Contributors
Table of Contents
Preface
Section 1: KVM Virtualization Basics
Chapter 1: Understanding Linux Virtualization
Linux virtualization and how it all started
Types of virtualization
Using the hypervisor/virtual machine manager
Type 1 and type 2 hypervisors
Open source virtualization projects
Xen
KVM
What Linux virtualization offers you in the cloud
Summary
Questions
Further reading
Chapter 2: KVM as a Virtualization Solution
Virtualization as a concept
Virtualized versus physical environments
Why is virtualization so important?
Hardware requirements for virtualization
Software requirements for virtualization
The internal workings of libvirt, QEMU, and KVM
libvirt
QEMU
QEMU – KVM internals
Data structures
Threading models in QEMU
KVM
Data structures
Execution flow of vCPU
Summary
Questions
Further reading
Section 2: libvirt and ovirt for Virtual Machine Management
Chapter 3: Installing KVM Hypervisor, libvirt, and oVirt
Getting acquainted with QEMU and libvirt
Getting acquainted with oVirt
Installing QEMU, libvirt, and oVirt
Installing the first virtual machine in KVM
Automating virtual machine installation
Installing oVirt
Starting a virtual machine using QEMU and libvirt
Summary
Questions
Further reading
Chapter 4: Libvirt Networking
Understanding physical and virtual networking
Virtual networking
Libvirt NAT network
Libvirt routed network
Libvirt isolated network
Using userspace networking with TAP and TUN devices
Implementing Linux bridging
Configuring Open vSwitch
Other Open vSwitch use cases
Understanding and using SR-IOV
Understanding macvtap
Summary
Questions
Further reading
Chapter 5: Libvirt Storage
Introduction to storage
Storage pools
Local storage pools
Libvirt storage pools
NFS storage pool
iSCSI and SAN storage
Storage redundancy and multipathing
Gluster and Ceph as a storage backend for KVM
Gluster
Ceph
Virtual disk images and formats and basic KVM storage operations
Getting image information
Attaching a disk using virt-manager
Attaching a disk using virsh
Creating an ISO image library
Deleting a storage pool
Creating storage volumes
Creating volumes using the virsh command
Deleting a volume using the virsh command
The latest developments in storage – NVMe and NVMeOF
Summary
Questions
Further reading
Chapter 6: Virtual Display Devices and Protocols
Using virtual machine display devices
Physical and virtual graphics cards in VDI scenarios
GPU PCI passthrough
Discussing remote display protocols
Remote display protocols history
Types of remote display protocols
Using the VNC display protocol
Why VNC?
Using the SPICE display protocol
Adding a SPICE graphics server
Methods to access a virtual machine console
Getting display portability with noVNC
Summary
Questions
Further reading
Chapter 7: Virtual Machines: Installation, Configuration, and Life Cycle Management
Creating a new VM using virt-manager
Using virt-manager
Using virt-* commands
Creating a new VM using Cockpit
Creating a new VM using oVirt
Configuring your VM
Adding and removing virtual hardware from your VM
Migrating VMs
Benefits of VM migration
Setting up the environment
Offline migration
Live or online migration
Summary
Questions
Further reading
Chapter 8: Creating and Modifying VM Disks, Templates, and Snapshots
Modifying VM images using libguestfs tools
virt-v2v
virt-p2v
guestfish
VM templating
Working with templates
Deploying VMs from a template
virt-builder and virt-builder repos
virt-builder repositories
Snapshots
Working with internal snapshots
Managing snapshots using virt-manager
Working with external disk snapshots
Use cases and best practices while using snapshots
Summary
Questions
Further reading
Section 3: Automation, Customization, and Orchestration for KVM VMs
Chapter 9: Customizing a Virtual Machine with cloud-init
What is the need for virtual machine customization?
Understanding cloud-init
Understanding cloud-init architecture
Installing and configuring cloud-init at boot time
Cloud-init images
Cloud-init data sources
Passing metadata and user data to cloud-init
Using cloud-init modules
Examples on how to use a cloud-config script with cloud-init
The first deployment
The second deployment
The third deployment
Summary
Questions
Further reading
Chapter 10: Automated Windows Guest Deployment and Customization
The prerequisites to creating Windows VMs on KVM
Creating Windows VMs using the virt-install utility
Customizing Windows VMs using cloudbase-init
cloudbase-init customization examples
Troubleshooting common cloudbase-init customization issues
Summary
Questions
Further reading
Chapter 11: Ansible and Scripting for Orchestration and Automation
Understanding Ansible
Automation approaches
Introduction to Ansible
Deploying and using AWX
Deploying Ansible
Provisioning a virtual machine using the kvm_libvirt module
Working with playbooks
Installing KVM
Using Ansible and cloud-init for automation and orchestration
Orchestrating multi-tier application deployment on KVM VM
Learning by example – various examples of using Ansible with KVM
Summary
Questions
Further reading
Section 4: Scalability, Monitoring, Performance Tuning, and Troubleshooting
Chapter 12: Scaling Out KVM with OpenStack
Introduction to OpenStack
Software-defined networking
Understanding VXLAN
Understanding GENEVE
OpenStack components
Swift
Nova
Glance
Horizon
Designate
Keystone
Neutron
Additional OpenStack use cases
Creating a Packstack demo environment for OpenStack
Provisioning the OpenStack environment
Installing OpenStack step by step
OpenStack administration
Day-to-day administration
Identity management
Integrating OpenStack with Ansible
Installing an Ansible deployment server
Configuring the Ansible inventory
Running Ansible playbooks
Summary
Questions
Further reading
Chapter 13: Scaling out KVM with AWS
Introduction to AWS
Approaching the cloud
Multi-cloud
Shadow IT
Market share
Big infrastructure but no services
Pricing
Data centers
Placement is the key
AWS services
Preparing and converting virtual machines for AWS
What do we want to do?
Uploading an image to EC2
Building hybrid KVM clouds with Eucalyptus
How do you install it?
Using Eucalyptus for AWS control
Summary
Questions
Further reading
Chapter 14: Monitoring the KVM Virtualization Platform
Monitoring the KVM virtualization platform
Introduction to the open source ELK solution
Elasticsearch
Logstash
Kibana
Setting up and integrating the ELK stack
Workflow
Configuring data collector and aggregator
Creating charts in Kibana
Creating custom utilization reports
ELK and KVM
Summary
Questions
Further reading
Chapter 15: Performance Tuning and Optimization for KVM VMs
It's all about design
General hardware design
VM design
Tuning the VM CPU and memory performance
CPU pinning
Working with memory
Getting acquainted with KSM
Tuning the CPU and memory with NUMA
NUMA memory allocation policies
Understanding emulatorpin
KSM and NUMA
Automatic NUMA balancing
The numactl command
Understanding numad and numastat
Virtio device tuning
Block I/O tuning
Network I/O tuning
How to turn it on
KVM guest time-keeping best practices
Software-based design
Summary
Questions
Further reading
Chapter 16: Troubleshooting Guidelines for the KVM Platform
Verifying the KVM service status
KVM services logging
Enabling debug mode logging
Advanced troubleshooting tools
oVirt
oVirt and KVM storage problems
Problems with snapshots and templates – virtual machine customization
Problems working with Ansible and OpenStack
Dependencies
Troubleshooting Eucalyptus
AWS and its verbosity, which doesn't help
Paying attention to details
Troubleshooting problems with the ELK stack
Best practices for troubleshooting KVM issues
Summary
Questions
Further reading
Other Books You May Enjoy
Index