万本电子书0元读

万本电子书0元读

顶部广告

Containerization with LXC电子书

售       价:¥

8人正在读 | 0人评论 9.8

作       者:Konstantin Ivanov

出  版  社:Packt Publishing

出版时间:2017-02-01

字       数:381.4万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Get acquainted with the world of LXC About This Book Get the most practical and up-to-date resource on LXC and take full advantage of what Linux containers can offer in the day-to-day operations of large-scale applications Learn how to deploy and administer various workloads such as web applications inside LXC Save your organization time and money by building robust and secure containers and by speeding the deployment process of your software Who This Book Is For This book is for Linux engineers and software developers who are looking to deploy applications in a fast, secure, and scalable way for use in testing and production. What You Will Learn Deep dive into the foundations of Linux containers with kernel namespaces and cgroups Install, configure, and administer Linux containers with LXC and libvirt Begin writing applications using Python libvirt bindings Take an in-depth look at container networking Set up monitoring and security with LXC Build and deploy a highly available application with LXC in the cloud In Detail In recent years, containers have gained wide adoption by businesses running a variety of application loads. This became possible largely due to the advent of kernel namespaces and better resource management with control groups (cgroups). Linux containers (LXC) are a direct implementation of those kernel features that provide operating system level virtualization without the overhead of a hypervisor layer. This book starts by introducing the foundational concepts behind the implementation of LXC, then moves into the practical aspects of installing and configuring LXC containers. Moving on, you will explore container networking, security, and backups. You will also learn how to deploy LXC with technologies like Open Stack and Vagrant. By the end of the book, you will have a solid grasp of how LXC is implemented and how to run production applications in a highly available and scalable way. Style and approach A practical guide that introduces the core technologies behind Linux containers and provides a deep dive into installation, configuration, and operations of LXC.
目录展开

Containerization with LXC

Containerization with LXC

Credits

About the Author

About the Reviewer

www.PacktPub.com

Why subscribe?

Customer Feedback

Dedication

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

1. Introduction to Linux Containers

The OS kernel and its early limitations

The case for Linux containers

Linux namespaces – the foundation of LXC

Mount namespaces

UTS namespaces

IPC namespaces

PID namespaces

User namespaces

Network namespaces

Resource management with cgroups

Limiting I/O throughput

Limiting memory usage

The cpu and cpuset subsystems

The cgroup freezer subsystem

Using userspace tools to manage cgroups and persist changes

Managing resources with systemd

Summary

2. Installing and Running LXC on Linux Systems

Installing LXC

Installing LXC on Ubuntu with apt

Installing LXC on Ubuntu from source

Installing LXC on CentOS with yum

Installing LXC on CentOS from source

LXC directory installation layout

Building and manipulating LXC containers

Building our first container

Making custom containers with debootstrap on Ubuntu

Making custom containers with yum on CentOS

Summary

3. Command-Line Operations Using Native and Libvirt Tools

Using the LVM backing store

Creating LXC containers using the LVM backing store

Creating container snapshots on the LVM backing store

Creating block devices using truncate, dd, and losetup

Using the Btrfs backing store

Creating LXC containers using the Btrfs backing store

Creating container snapshots on the Btrfs backing store

Using the ZFS backing store

Creating LXC containers using the ZFS backing store

Creating container snapshots on the ZFS backing store

Autostarting LXC containers

LXC container hooks

Attaching directories from the host OS and exploring the running filesystem of a container

Freezing a running container

Limiting container resource usage

Building and running LXC containers with libvirt

Installing libvirt from packages on Debian and CentOS

Installing libvirt from source

Defining LXC containers with libvirt

Starting and connecting to LXC containers with libvirt

Attaching block devices to running containers with libvirt

Networking with libvirt LXC

Generating config from an existing LXC container with libvirt

Stopping and removing LXC containers with libvirt

Summary

4. LXC Code Integration with Python

LXC Python bindings

Installing the LXC Python bindings and preparing the development environment on Ubuntu and CentOS

Building our first container with Python

Gathering container information with Python

Starting containers, applying changes, and listing configuration options with Python

Changing container state with Python

Stopping containers with Python

Cloning containers with Python

Destroying containers with Python and cleaning up the virtual environment

Libvirt Python bindings

Installing the libvirt Python development packages

Building LXC containers with libvirt Python

Starting containers and running basic operations with libvirt Python

Collecting container information with libvirt Python

Stopping and deleting LXC containers with libvirt Python

Vagrant and LXC

Configuring Vagrant LXC

Putting it all together – building a simple RESTful API to LXC with Python

API calls to build and configure LXC containers

Cleaning up using the API calls

Summary

5. Networking in LXC with the Linux Bridge and Open vSwitch

Software bridging in Linux

The Linux bridge

The Linux bridge and the LXC package on Ubuntu

The Linux bridge and the LXC package on CentOS

Using dnsmasq service to obtain an IP address in the container

Statically assigning IP addresses in the LXC container

Overview of LXC network configuration options

Manually manipulating the Linux bridge

Open vSwitch

Connecting LXC to the host network

Configuring LXC using none network mode

Configuring LXC using empty network mode

Configuring LXC using veth mode

Configuring LXC using phys mode

Configuring LXC using vlan mode

Configuring LXC using macvlan mode

Summary

6. Clustering and Horizontal Scaling with LXC

Scaling applications with LXC

Scaling Apache in minimal root filesystem with libvirt LXC

Creating the minimal root filesystem for the containers

Defining the Apache libvirt container

Starting the Apache libvirt container

Scaling Apache with libvirt LXC and HAProxy

Scaling Apache with a full LXC root filesystem and OVS GRE tunnels

Configuring the load-balancer host

Creating the load-balancer container

Building the GRE tunnels

Configuring the Apache nodes

Installing Apache and HAProxy, and testing connectivity

Scaling the Apache service

Summary

7. Monitoring and Backups in a Containerized World

Backing up and migrating LXC

Creating LXC backup using tar and rsync

Restoring from the archived backup

Creating container backup using lxc-copy

Migrating LXC containers on an iSCSI target

Setting up the iSCSI target

Setting up the iSCSI initiator

Logging in to the iSCSI target using the presented block device as rootfs for LXC

Building the iSCSI container

Restoring the iSCSI container

LXC active backup with replicated GlusterFS storage

Creating the shared storage

Building the GlusterFS LXC container

Restoring the GlusterFS container

Monitoring and alerting on LXC metrics

Gathering container metrics

Using lxc-monitor to track container state

Using lxc-top to obtain CPU and memory utilization

Using lxc-info to gather container information

Leveraging cgroups to collect memory metrics

Using cgroups to collect CPU statistics

Collecting network metrics

Simple container monitoring and alerting with Monit

Container monitoring and alert triggers with Sensu

Monitoring LXC containers with Sensu agent and server

Monitoring LXC containers using standalone Sensu checks

Simple autoscaling pattern with LXC, Jenkins, and Sensu

Summary

8. Using LXC with OpenStack

Deploying OpenStack with LXC support on Ubuntu

Preparing the host

Installing the database service

Installing the message queue service

Installing the caching service

Installing and configuring the identity service

Installing and configuring the image service

Installing and configuring the compute service

Installing and configuring the networking service

Defining the LXC instance flavor, generating a key pair, and creating security groups

Creating the networks

Provisioning LXC container with OpenStack

Summary

A. LXC Alternatives to Docker and OpenVZ

Building containers with OpenVZ

Building containers with Docker

Running unprivileged LXC containers

Summary

累计评论(0条) 1个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部