KVM Virtualization Cookbook

Deploy, manage, and scale virtual instances using Kernel-based Virtual Machines

KVM Virtualization Cookbook

This ebook is included in a Mapt subscription
Konstantin Ivanov

Deploy, manage, and scale virtual instances using Kernel-based Virtual Machines
$0.00
$18.00
$44.99
$29.99p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781788294676
Paperback340 pages

Book Description

Virtualization technologies such as KVM allow for better control over the available server resources, by deploying multiple virtual instances on the same physical host, or clusters of compute resources. With KVM it is possible to run various workloads in isolation with the hypervisor layer providing better tenant isolation and higher degree of security.

This book will provide a deep dive into deploying KVM virtual machines using qemu and libvirt and will demonstrate practical examples on how to run, scale, monitor, migrate and backup such instances. You will also discover real production ready recipes on deploying KVM instances with OpenStack and how to programatically manage the life cycle of KVM virtual machines using Python. You will learn numerous tips and techniques which will help you deploy & plan the KVM infrastructure. Next, you will be introduced to the working of libvirt libraries and the iPython development environment.

Finally, you will be able to tune your Linux kernel for high throughput and better performance. By the end of this book, you will gain all the knowledge needed to be an expert in working with the KVM virtualization infrastructure.

Table of Contents

Chapter 1: Getting Started with QEMU and KVM
Introduction
Installing and configuring QEMU
Managing disk images with qemu-img
Preparing images for OS installation with qemu-nbd
Installing a custom OS on the image with debootstrap
Resizing an image
Using pre-existing images
Running virtual machines with qemu-system-*
Starting the QEMU VM with KVM support
Connecting to a running instance with VNC
Chapter 2: Using libvirt to Manage KVM
Introduction
Installing and configuring libvirt
Defining KVM instances
Starting, stopping, and removing KVM instances
Inspecting and editing KVM configs
Building new KVM instances with virt-install and using the console
Managing CPU and memory resources in KVM
Attaching block devices to virtual machines
Sharing directories between a running VM and the host OS
Autostarting KVM instances
Working with storage pools
Managing volumes
Managing secrets
Chapter 3: KVM Networking with libvirt
Introduction
The Linux bridge
The Open vSwitch
Configuring NAT forwarding network
Configuring bridged network
Configuring PCI passthrough network
Manipulating network interfaces
Chapter 4: Migrating KVM Instances
Introduction
Manual offline migration using an iSCSI storage pool
Manual offline migration using GlusterFS shared volumes
Online migration using the virsh command with shared storage
Offline migration using the virsh command and local image
Online migration using the virsh command and local image
Chapter 5: Monitoring and Backup of KVM Virtual Machines
Introduction
Resource usage collection with libvirt
Monitoring KVM instances with Sensu
Simple KVM backups with tar and rsync
Creating snapshots
Listing snapshots
Inspecting snapshots
Editing snapshots
Reverting snapshots
Deleting snapshots
Chapter 6: Deploying KVM Instances with OpenStack
Introduction
Preparing the host for the OpenStack deployment
Installing and configuring the OpenStack Keystone identity service
Installing and configuring the OpenStack Glance image service
Installing and configuring the OpenStack Nova compute service
Installing and configuring the OpenStack Neutron networking service
Building and inspecting KVM instances with OpenStack
Stopping KVM instances with OpenStack
Terminating KVM instances with OpenStack
Chapter 7: Using Python to Build and Manage KVM Instances
Introduction
Installing and using the Python libvirt library
Defining KVM instances with Python
Starting, stopping, and deleting KVM instances with Python
Inspecting KVM instances with Python
Building a simple REST API server with libvirt and bottle
Chapter 8: Kernel Tuning for KVM Performance
Introduction
Tuning the kernel for low I/O latency
Memory tuning for KVM guests
CPU performance options
NUMA tuning with libvirt
Tuning the kernel for network performance

What You Will Learn

  • Deploy different workloads in isolation with KVM virtualization and better utilize the available compute resources
  • Explore the benefits of running applications with KVM and learn to prevent the “bad-neighbor” effect
  • Leveraging various networking technologies in the context of virtualization with Open vSwitch and the Linux bridge.
  • Create KVM instances using Python and inspect running KVM instances
  • Understand Kernel Tuning for enhanced KVM performance and better memory utilization

Authors

Table of Contents

Chapter 1: Getting Started with QEMU and KVM
Introduction
Installing and configuring QEMU
Managing disk images with qemu-img
Preparing images for OS installation with qemu-nbd
Installing a custom OS on the image with debootstrap
Resizing an image
Using pre-existing images
Running virtual machines with qemu-system-*
Starting the QEMU VM with KVM support
Connecting to a running instance with VNC
Chapter 2: Using libvirt to Manage KVM
Introduction
Installing and configuring libvirt
Defining KVM instances
Starting, stopping, and removing KVM instances
Inspecting and editing KVM configs
Building new KVM instances with virt-install and using the console
Managing CPU and memory resources in KVM
Attaching block devices to virtual machines
Sharing directories between a running VM and the host OS
Autostarting KVM instances
Working with storage pools
Managing volumes
Managing secrets
Chapter 3: KVM Networking with libvirt
Introduction
The Linux bridge
The Open vSwitch
Configuring NAT forwarding network
Configuring bridged network
Configuring PCI passthrough network
Manipulating network interfaces
Chapter 4: Migrating KVM Instances
Introduction
Manual offline migration using an iSCSI storage pool
Manual offline migration using GlusterFS shared volumes
Online migration using the virsh command with shared storage
Offline migration using the virsh command and local image
Online migration using the virsh command and local image
Chapter 5: Monitoring and Backup of KVM Virtual Machines
Introduction
Resource usage collection with libvirt
Monitoring KVM instances with Sensu
Simple KVM backups with tar and rsync
Creating snapshots
Listing snapshots
Inspecting snapshots
Editing snapshots
Reverting snapshots
Deleting snapshots
Chapter 6: Deploying KVM Instances with OpenStack
Introduction
Preparing the host for the OpenStack deployment
Installing and configuring the OpenStack Keystone identity service
Installing and configuring the OpenStack Glance image service
Installing and configuring the OpenStack Nova compute service
Installing and configuring the OpenStack Neutron networking service
Building and inspecting KVM instances with OpenStack
Stopping KVM instances with OpenStack
Terminating KVM instances with OpenStack
Chapter 7: Using Python to Build and Manage KVM Instances
Introduction
Installing and using the Python libvirt library
Defining KVM instances with Python
Starting, stopping, and deleting KVM instances with Python
Inspecting KVM instances with Python
Building a simple REST API server with libvirt and bottle
Chapter 8: Kernel Tuning for KVM Performance
Introduction
Tuning the kernel for low I/O latency
Memory tuning for KVM guests
CPU performance options
NUMA tuning with libvirt
Tuning the kernel for network performance

Book Details

ISBN 139781788294676
Paperback340 pages
Read More

Read More Reviews