售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
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
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜