KVM Virtualization Cookbook
eBook - ePub

KVM Virtualization Cookbook

  1. 340 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

KVM Virtualization Cookbook

Book details
Book preview
Table of contents
Citations

About This Book

Deploy, manage, and scale virtual instances using Kernel-based Virtual MachinesAbout This Book• Build, manage and scale virtual machines with practical step-by-step examples• Leverage the libvirt user-space tools and libraries to manage the life-cycle of KVM instances• Deploy and scale applications inside KVM virtual machines with OpenStackWho This Book Is ForIf you are a system administrator working KVM virtualization, this book will help you grow on your expertise of working with the infrastructure to manage things in a better way. You should have a knowledge of working with Linux based systems.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 utilizationIn DetailVirtualization 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.Style and approachThis book takes a complete practical approach with many step-by-step example recipes on how to use KVM in production. The book assumes certain level of expertise with Linux systems and virtualization in general. Some knowledge of Python programming is encouraged, to fully take advantage of the code recipes.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access KVM Virtualization Cookbook by Konstantin Ivanov in PDF and/or ePUB format, as well as other popular books in Computer Science & System Administration. We have over one million books available in our catalogue for you to explore.

Information

Year
2017
ISBN
9781788291507
Edition
1

Deploying KVM Instances with OpenStack

In this chapter, we are going to cover the following topics:
  • 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

Introduction

OpenStack is a cloud operating system that simplifies the deployment and management of virtual machines or containers in a scalable and highly available way. It operates on pools of compute resources (physical or virtual servers) and provides an intelligent scheduling mechanism to select appropriate hosts, and to build or migrate VMs.
OpenStack allows an easier management of virtual images and provides a centralized way of creating and managing software-defined networks. It integrates well with a variety of external and internal projects in order to deliver user and service authentication. OpenStack modular design allows adding and removing services as needed where a minimal production deployment may consist of as few as two projects an image and compute service.
The following diagram shows the ever-growing list of OpenStack projects and the interaction between them:
The OpenStack components and how they interact with each other
In this chapter, we are going to create a simple OpenStack deployment on two compute nodes using the Keystone, Glance, Nova, and Neutron projects from the Newton release of OpenStack, on an Ubuntu Xenial 16.04 server.
For more information on the OpenStack project, please visit https://www.openstack.org/software/.

Preparing the host for the OpenStack deployment

In this recipe, we are going to install the infrastructure components that OpenStack depends on, such as the database server, the message queue, and the caching service. The projects that we are going to use throughout this chapter depend on these services for communication and persistent storage.

Getting ready

For this recipe, we are going to need the following components:
  • An Ubuntu server with great virtualization capabilities
  • Access to the internet for package installation

How to do it...

In order to keep the deployment simple and focus on the provisioning aspect of OpenStack, we are going to use a single physical server to host all services. In production environments, it is a common approach to separate each service onto their own set of servers, for scalability and high availability. By following the steps outlined in this chapter, you should be able to deploy all services on multiple hosts, by replacing the IP addresses and hostnames in the configuration files, as needed.
  1. Update the host and install the package repository for the Newton release:
 root@controller:~# apt install software-properties-common
root@controller:~# add-apt-repository cloud-archive:newton
root@controller:~# apt update && apt dist-upgrade
root@controller:~# reboot
root@controller:~# apt install python-openstackclient
  1. Install the MariaDB database server:
 root@controller:~# apt install mariadb-server python-pymysql
root@controller:~# cat /etc/mysql/mariadb.conf.d/99-openstack.cnf
[mysqld]
bind-address = 10.208.130.36
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
root@controller:~#
Replace the IP address of the network interface the database server binds to, as per your host.
  1. Restart the service and secure the installation:
 root@controller:~# service mysql restart
root@controller:~# mysql_secure_installation
For simplicity, we are going to use lxcpassword as a password for all services throughout the chapter.
  1. Install the RabbitMQ messaging service, create a new user, password, and set permissions:
 root@controller:~# apt install rabbitmq-server
root@controller:~# rabbitmqctl add_user openstack lxcpassword
Creating user "openstack" ...
root@controller:~# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/" ...
root@controller:~#
  1. Install and configure the memcached service:
 root@controller:~# apt install memcached python-memcache
root@controller:~# sed -i 's/127.0.0.1/10.208.130.36/g'
/etc/memcac...

Table of contents

  1. Title Page
  2. Copyright
  3. Credits
  4. About the Author
  5. About the Reviewer
  6. www.PacktPub.com
  7. Customer Feedback
  8. Preface
  9. Getting Started with QEMU and KVM
  10. Using libvirt to Manage KVM
  11. KVM Networking with libvirt
  12. Migrating KVM Instances
  13. Monitoring and Backup of KVM Virtual Machines
  14. Deploying KVM Instances with OpenStack
  15. Using Python to Build and Manage KVM Instances
  16. Kernel Tuning for KVM Performance