Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
DevOps: Puppet, Docker, and Kubernetes
Credits
Preface
What this learning path covers
What you need for this learning path
Who this learning path is for
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Module 1
1. Puppet Language and Style
Introduction
Adding a resource to a node
How to do it...
How it works...
Using Facter to describe a node
How to do it...
How it works...
There's more...
Variables
Scope
Installing a package before starting a service
How to do it...
How it works...
Capitalization
Learning metaparameters and ordering
Trifecta
Idempotency
Installing, configuring, and starting a service
How to do it...
How it works…
Using community Puppet style
How to do it…
Indentation
Quoting
False
Variables
Parameters
Symlinks
Creating a manifest
How to do it...
There's more…
Checking your manifests with Puppet-lint
Getting ready
How to do it...
There's more...
See also
Using modules
How to do it…
How it works…
There's more…
Templates
Facts, functions, types, and providers
Third-party modules
Module organization
See also
Using standard naming conventions
How to do it…
There's more…
Using inline templates
How to do it…
How it works…
There's more...
See also
Iterating over multiple items
How to do it…
How it works…
There's more…
Using hashes
Creating arrays with the split function
Writing powerful conditional statements
How to do it…
How it works…
There's more…
Elseif branches
Comparisons
Combining expressions
See also
Using regular expressions in if statements
How to do it…
How it works…
There's more…
Capturing patterns
Regular expression syntax
See also
Using selectors and case statements
How to do it…
How it works…
Selector
Case statement
There's more…
Regular expressions
Defaults
Using the in operator
How to do it…
There's more…
Using regular expression substitutions
How to do it…
How it works…
There's more…
See also
Using the future parser
Getting ready
How to do it...
Appending to and concatenating arrays
Lambda functions
Reduce
Filter
Map
Slice
Each
Other features
2. Puppet Infrastructure
Introduction
Installing Puppet
Getting ready
How to do it...
Managing your manifests with Git
Getting ready
How to do it...
How it works...
There's more...
Creating a decentralized Puppet architecture
Getting ready
How to do it...
How it works...
Writing a papply script
How to do it...
How it works...
Running Puppet from cron
Getting ready
How to do it...
How it works...
There's more...
Bootstrapping Puppet with bash
Getting ready
How to do it...
How it works...
There's more...
Creating a centralized Puppet infrastructure
Getting ready
How to do it...
How it works...
There's more...
Creating certificates with multiple DNS names
Getting ready
How to do it...
How it works...
Running Puppet from passenger
Getting ready
How to do it...
How it works...
There's more...
Setting up the environment
Getting ready
How to do it...
There's more...
Configuring PuppetDB
Getting ready
How to do it...
How it works...
There's more...
Configuring Hiera
Getting ready
How to do it...
How it works...
There's more...
Setting node-specific data with Hiera
Getting ready
How to do it...
How it works...
Storing secret data with hiera-gpg
Getting ready
How to do it...
How it works...
There's more...
See also
Using MessagePack serialization
Getting ready
How to do it...
How it works...
Automatic syntax checking with Git hooks
How to do it...
How it works...
Pushing code around with Git
Getting ready
How to do it...
How it works...
Managing Environments with Git
Getting ready
How to do it...
How it works...
There's more...
3. Writing Better Manifests
Introduction
Using arrays of resources
How to do it…
How it works…
See also
Using resource defaults
How to do it...
How it works...
There's more...
Using defined types
How to do it…
How it works…
There's more…
See also
Using tags
How to do it...
There's more…
Using run stages
How to do it…
How it works…
There's more…
See also
Using roles and profiles
How to do it…
How it works…
There's more…
Passing parameters to classes
How to do it…
How it works…
There's more…
Specifying default values
Passing parameters from Hiera
Getting ready
How to do it...
How it works...
There's more...
Writing reusable, cross-platform manifests
How to do it…
How it works...
There's more…
See also
Getting information about the environment
How to do it…
How it works…
There's more…
See also
Importing dynamic information
Getting ready
How to do it…
How it works…
There's more…
See also
Passing arguments to shell commands
How to do it…
How it works…
4. Working with Files and Packages
Introduction
Making quick edits to config files
Getting ready
How to do it...
How it works…
There's more…
Editing INI style files with puppetlabs-inifile
Getting ready
How to do it...
How it works...
There's more...
Using Augeas to reliably edit config files
How to do it…
How it works…
There's more…
Building config files using snippets
Getting ready
How to do it...
How it works...
Using ERB templates
How to do it…
How it works…
There's more…
See also
Using array iteration in templates
How to do it…
How it works…
There's more…
See also
Using EPP templates
How to do it...
How it works...
There's more...
Using GnuPG to encrypt secrets
Getting ready
How to do it...
How it works...
There's more...
See also
Installing packages from a third-party repository
How to do it…
How it works…
There's more...
Comparing package versions
How to do it…
How it works…
5. Users and Virtual Resources
Introduction
Using virtual resources
How to do it...
How it works...
There's more...
Managing users with virtual resources
How to do it...
How it works...
There's more...
See also
Managing users' SSH access
How to do it...
How it works...
There's more...
Managing users' customization files
How to do it...
How it works...
There's more...
See also
Using exported resources
Getting ready
How to do it...
How it works...
There's more...
6. Managing Resources and Files
Introduction
Distributing cron jobs efficiently
How to do it...
How it works...
There's more...
See also
Scheduling when resources are applied
How to do it...
How it works...
There's more...
Using host resources
How to do it...
How it works...
There's more...
Using exported host resources
Getting ready
How to do it...
How it works...
There's more...
Using multiple file sources
How to do it...
How it works...
There's more...
See also
Distributing and merging directory trees
How to do it...
How it works...
There's more...
Cleaning up old files
How to do it...
How it works...
There's more...
Auditing resources
How to do it...
How it works...
There's more...
See also
Temporarily disabling resources
How to do it...
How it works...
7. Managing Applications
Introduction
Using public modules
How to do it...
How it works...
There's more...
Managing Apache servers
How to do it...
How it works...
Creating Apache virtual hosts
How to do it...
How it works...
There's more...
Creating nginx virtual hosts
How to do it...
How it works...
There's more...
Managing MySQL
How to do it...
How it works...
There's more...
Creating databases and users
How to do it...
How it works...
There's more...
8. Internode Coordination
Introduction
Managing firewalls with iptables
Getting ready
How to do it...
How it works...
There's more...
Building high-availability services using Heartbeat
Getting ready
How to do it…
How it works…
There's more...
Managing NFS servers and file shares
How to do it...
How it works…
Using HAProxy to load-balance multiple web servers
How to do it…
How it works…
There's more...
Managing Docker with Puppet
Getting ready
How to do it...
How it works...
There's more...
9. External Tools and the Puppet Ecosystem
Introduction
Creating custom facts
How to do it...
How it works...
There's more...
See also
Adding external facts
Getting ready
How to do it...
How it works...
There's more...
Debugging external facts
Using external facts in Puppet
See also
Setting facts as environment variables
How to do it...
Generating manifests with the Puppet resource command
How to do it...
There's more...
Generating manifests with other tools
Getting ready
How to do it...
There's more...
Using an external node classifier
Getting ready
How to do it...
How it works...
There's more...
See also
Creating your own resource types
How to do it...
How it works...
There's more...
Documentation
Validation
Creating your own providers
How to do it...
How it works...
There's more...
Creating custom functions
How to do it...
How it works...
There's more...
Testing your puppet manifests with rspec-puppet
Getting ready
How to do it...
How it works...
There's more...
See also
Using librarian-puppet
Getting ready
How to do it...
How it works...
There's more...
Using r10k
Getting ready
How to do it...
How it works...
There's more...
10. Monitoring, Reporting, and Troubleshooting
Introduction
Noop – the don't change anything option
How to do it...
How it works...
There's more...
See also
Logging command output
How to do it...
How it works...
There's more...
Logging debug messages
How to do it...
How it works...
There's more...
Printing out variable values
Resource ordering
Generating reports
How to do it...
How it works...
There's more...
Other report types
See also
Producing automatic HTML documentation
How to do it...
How it works...
There's more...
Drawing dependency graphs
Getting ready
How to do it...
How it works...
There's more...
See also
Understanding Puppet errors
How to do it...
See also
Inspecting configuration settings
How to do it...
How it works...
See also
2. Module 2
1. Introduction and Installation
Introduction
Namespaces
The pid namespace
The net namespace
The ipc namespace
The mnt namespace
The uts namespace
The user namespace
Cgroups
The Union filesystem
Verifying the requirements for Docker installation
Getting ready
How to do it…
How it works…
See also
Installing Docker
Getting ready
How to do it…
How it works...
There's more…
See also
Pulling an image and running a container
Getting ready
How to do it…
How it works…
There's more…
See also
Adding a nonroot user to administer Docker
Getting ready
How to do it…
How it works…
Setting up the Docker host with Docker Machine
Getting ready
How to do it…
How it works…
There's more…
See also
Finding help with the Docker command line
Getting ready
How to do it…
How it works…
See also
2. Working with Docker Containers
Introduction
Listing/searching for an image
Getting ready
How to do it…
How it works…
There's more…
See also
Pulling an image
Getting ready
How to do it…
How it works…
There's more…
See also
Listing images
Getting ready
How to do it…
How it works…
There's more…
See also
Starting a container
Getting ready
How to do it…
How it works…
There's more…
See also
Listing containers
Getting ready
How to do it…
How it works…
There's more…
See also
Looking at the logs of containers
Getting ready
How to do it…
How it works…
There's more…
See also
Stopping a container
Getting ready
How to do it…
How it works…
There's more…
See also
Deleting a container
Getting ready
How to do it…
There's more…
How it works…
See also
Setting the restart policy on a container
Getting ready
How to do it…
There's more…
See also
Getting privileged access inside a container
Getting ready
How to do it…
How it works…
There's more…
See also
Exposing a port while starting a container
Getting ready
How to do it…
There's more…
See also
Accessing the host device inside the container
Getting ready
How to do it…
How it works…
See also
Injecting a new process to a running container
Getting ready
How to do it…
How it works…
See also
Returning low-level information about a container
Getting ready
How to do it…
How it works…
There's more…
See also
Labeling and filtering containers
Getting ready
How to do it…
How it works…
There's more…
See also
3. Working with Docker Images
Introduction
Creating an account with Docker Hub
Getting ready
How to do it…
How it works…
See also
Creating an image from the container
Getting ready
How to do it…
How it works…
There's more…
See also
Publishing an image to the registry
Getting ready
How to do it…
How it works…
There's more…
See also
Looking at the history of an image
Getting ready
How to do it…
How it works…
There's more…
See also
Deleting an image
Getting ready
How to do it…
There's more…
See also
Exporting an image
Getting ready
How to do it…
There's more…
See also
Importing an image
Getting ready
How to do it…
See also
Building images using Dockerfiles
Getting ready
How to do it…
How it works…
There's more…
See also
Building an Apache image – a Dockerfile example
Getting ready
How to do it…
How it works…
There's more…
See also
Accessing Firefox from a container – a Dockerfile example
Getting ready
How to do it…
How it works…
There's more...
See also
Building a WordPress image – a Dockerfile example
Getting ready
How to do it…
How it works…
There's more…
See also
Setting up a private index/registry
Getting ready
How to do it…
How it works…
There's more…
See also
Automated builds – with GitHub and Bitbucket
Getting ready
How to do it…
How it works…
There's more…
See also
Creating the base image – using supermin
Getting ready
How to do it…
How it works…
There's more…
See also
Creating the base image – using Debootstrap
Getting ready
How to do it…
See also
Visualizing dependencies between layers
Getting ready
How to do it…
How it works…
There's more…
See also
4. Network and Data Management for Containers
Introduction
Accessing containers from outside
Getting ready
How to do it…
How it works…
There's more…
See also
Managing data in containers
Getting ready
How to do it...
How it works…
There's more…
See also
Linking two or more containers
Getting ready
How to do it…
How it works…
There's more…
See also
Developing a LAMP application by linking containers
Getting ready
How to do it…
How it works…
Networking of multihost containers with Flannel
Getting ready
How to do it…
How it works…
See also
Assigning IPv6 addresses to containers
Getting ready
How to do it…
How it works…
There's more…
See also
5. Docker Use Cases
Introduction
Testing with Docker
Getting ready
How to do it…
How it works…
There's more…
Doing CI/CD with Shippable and Red Hat OpenShift
Getting ready
How to do it…
How it works…
See also
Doing CI/CD with Drone
Getting ready
How to do it…
How it works…
There's more…
See also
Setting up PaaS with OpenShift Origin
Getting ready
How to do it…
How it works…
There's more…
See also
Building and deploying an app on OpenShift v3 from the source code
Getting ready
How to do it…
How it works…
There's more…
See also
Configuring Docker as a hypervisor driver for OpenStack
Getting ready
How to do it…
How it works...
There's more…
See also
6. Docker APIs and Language Bindings
Introduction
Configuring the Docker daemon remote API
Getting ready
How to do it…
How it works…
There's more…
See also
Performing image operations using remote APIs
Getting ready
How to do it…
How it works…
There's more…
See also
Performing container operations using remote APIs
Getting ready
How to do it…
How it works…
See also
Exploring Docker remote API client libraries
Getting ready
How to do it…
How it works…
There's more…
Securing the Docker daemon remote API
Getting ready
How to do it...
How it works…
There's more…
7. Docker Performance
Introduction
Benchmarking CPU performance
Getting ready
How to do it…
How it works…
There's more…
See also
Benchmarking disk performance
Getting ready
How to do it…
How it works…
There's more…
See also
Benchmarking network performance
Getting ready
How to do it…
How it works…
There's more…
See also
Getting container resource usage using the stats feature
Getting ready
How to do it…
How it works…
See also
Setting up performance monitoring
Getting ready
How to do it…
How it works…
There's more…
See also
8. Docker Orchestration and Hosting Platforms
Introduction
Running applications with Docker Compose
Getting ready
How to do it…
How it works…
There's more…
See also
Setting up cluster with Docker Swarm
Getting ready
How to do it…
How it works…
There's more…
See also
Setting up CoreOS for Docker orchestration
Getting ready
How to do it…
How it works…
There's more…
See also
Setting up a Project Atomic host
Getting ready
How to do it…
How it works…
There's more…
See also
Doing atomic update/rollback with Project Atomic
Getting ready
How to do it…
How it works…
See also
Adding more storage for Docker in Project Atomic
Getting ready
How to do it…
How it works…
There's more…
See also
Setting up Cockpit for Project Atomic
Getting ready
How to do it…
How it works…
There's more…
See also
Setting up a Kubernetes cluster
Getting ready
How to do it…
How it works…
There's more…
See also
Scaling up and down in a Kubernetes cluster
Getting ready
How to do it…
How it works…
There's more…
See also
Setting up WordPress with a Kubernetes cluster
Getting ready
How to do it…
How it works…
There's more…
See also
9. Docker Security
Introduction
Setting Mandatory Access Control (MAC) with SELinux
Getting ready
How to do it…
How it works…
There's more…
See also
Allowing writes to volume mounted from the host with SELinux ON
Getting ready
How to do it…
How it works…
See also
Removing capabilities to breakdown the power of a root user inside a container
Getting ready
How to do it...
How it works…
There's more...
See also
Sharing namespaces between the host and the container
Getting ready
How to do it…
How it works…
There's more...
See also
10. Getting Help and Tips and Tricks
Introduction
Starting Docker in debug mode
Getting ready
How to do it...
How it works…
Building a Docker binary from the source
Getting ready
How to do it…
How it works…
There's more…
See also
Building images without using cached layers
Getting ready
How to do it…
How it works…
There's more…
Building your own bridge for container communication
Getting ready
How to do it…
How it works…
There's more…
See also
Changing the default execution driver of Docker
Getting ready
How to do it…
How it works…
See also
Selecting the logging driver for containers
Getting ready
How to do it…
How it works…
There's more…
See also
Getting real-time Docker events for containers
Getting ready
How to do it…
How it works…
There's more…
See also
3. Module 3
1. Building Your Own Kubernetes
Introduction
Exploring architecture
Getting ready
How to do it…
Kubernetes master
API server (kube-apiserver)
Scheduler (kube-scheduler)
Controller manager (kube-controller-manager)
Command Line Interface (kubectl)
Kubernetes node
kubelet
Proxy (kube-proxy)
How it works…
etcd
Overlay network
Flannel
See also
Preparing your environment
Getting ready
Hardware resource
Operating system
How to do it…
Kubernetes master
Kubernetes nodes
etcd
See also
Building datastore
How to do it…
Red Hat Enterprise Linux 7 or CentOS 7
Ubuntu Linux 15.10 Wily Werewolf
Other Linux
Download a binary
Creating a user
Install etcd
How it works…
Auto startup script
Startup script (systemd)
Startup script (init)
Configuration
See also
Creating an overlay network
Getting ready
Installation
CentOS 7 or Red Hat Enterprise Linux 7
Other Linux options
How to do it…
Flannel networking configuration
Integrating with Docker
How it works…
See also
Configuring master
Getting ready
How to do it…
Installation
CentOS 7 or Red Hat Enterprise Linux 7
Adding daemon dependency
Other Linux options
Verification
See also
Configuring nodes
Getting ready
How to do it…
Installation
CentOS 7 or Red Hat Enterprise Linux 7
Other Linux options
Verification
See also
Run your first container in Kubernetes
Getting ready
How to do it…
Running an HTTP server (nginx)
Exposing the port for external access
Stopping the application
How it works…
See also
2. Walking through Kubernetes Concepts
Introduction
An overview of Kubernetes control
Getting ready
How to do it…
How it works…
See also
Working with pods
Getting ready
How to do it…
How it works…
See also
Working with a replication controller
Getting ready
How to do it…
Creating a replication controller
Getting information of a replication controller
Changing the configuration of a replication controller
Removing a replication controller
How it works…
See also
Working with services
Getting ready
How to do it…
Creating services for different resources
Creating a service for a pod
Creating a service for the replication controller and adding an external IP
Creating a no-selector service for an endpoint
Creating a service with session affinity based on another service
Creating a service in a different type
Creating a service in NodePort type
Deleting a service
How it works…
See also
Working with volumes
Getting ready
How to do it…
emptyDir
hostPath
nfs
glusterfs
iscsi
flocker
rbd
gitRepo
awsElasticBlockStore
gcePersistentDisk
downwardAPI
There's more…
PersistentVolume
See also
Working with secrets
Getting ready
How to do it…
Creating a secret
Picking up secret in the container
Deleting a secret
How it works…
There's more…
See also
Working with names
Getting ready
How to do it…
How it works…
See also
Working with namespaces
Getting ready
How to do it…
Changing the default namespace
Deleting a namespace
There's more…
Deleting LimitRange
See also
Working with labels and selectors
Getting ready
How to do it…
Linking service with a replication controller by using label selectors
There's more…
See also
3. Playing with Containers
Introduction
Scaling your containers
Getting ready
How to do it…
How it works…
See also
Updating live containers
Getting ready
How to do it…
How it works…
There's more…
See also
Forwarding container ports
Getting ready
How to do it…
Container-to-container communications
Pod-to-pod communications
Pod-to-service communications
External-to-internal communications
See also
Ensuring flexible usage of your containers
Getting ready
How to do it…
Pod as a job
Creating a job with multiple pods running
Pod as a daemon set
Running the daemon set only on specific nodes
How it works…
See also
Working with configuration files
Getting ready
YAML
JSON
How to do it…
How it works…
Pods
Replication controllers
Services
See also
4. Building a High Availability Cluster
Introduction
Clustering etcd
Getting ready
How to do it…
Static
etcd discovery
See also
Building multiple masters
Getting ready
How to do it…
Preparing multiple master nodes
Setting up kubelet in master
Getting the configuration files ready
Starting the kubelet service and turning daemons on!
How it works…
See also
5. Building a Continuous Delivery Pipeline
Introduction
Moving monolithic to microservices
Getting ready
How to do it…
Microservices
Frontend WebUI
How it works…
Microservices
Frontend WebUI
See also
Integrating with Jenkins
Getting ready
Install a Jenkins server which can build a Docker program
How to do it…
Create your Jenkins project
Run a program testing
Deploying a program
How it works…
There's more…
See also
Working with the private Docker registry
Getting ready
How to do it…
How it works…
Alternatives
Docker Trusted Registry
Nexus Repository Manager
Amazon EC2 Container Registry
See also
Setting up the Continuous Delivery pipeline
Getting ready
How to do it…
How it works…
There's more…
See also
6. Building Kubernetes on AWS
Introduction
Building the Kubernetes infrastructure in AWS
Getting ready
How to do it…
VPC and subnets
Internet Gateway and NAT
Route Table
Security group
How it works…
See also
Managing applications using AWS OpsWorks
Getting ready
How to do it…
The OpsWorks stack
The OpsWorks layer
Adjusting the IAM role
The OpsWorks instance
How it works…
See also
Auto-deploying Kubernetes through Chef recipes
Getting ready
Creating ELB and its security groups
Creating an OpsWorks stack
Creating application layers
How to do it…
Stack configuration for custom recipes
Recipes for etcd
Recipes for the Kubernetes master
Recipes for the Kubernetes node
Starting the instances
See also
Using AWS CloudFormation for fast provisioning
Getting ready
How to do it…
Creating a network infrastructure
Creating OpsWorks for application management
See also
7. Advanced Cluster Administration
Introduction
Advanced settings in kubeconfig
Getting ready
How to do it…
Setting a new credential
Setting a new cluster
Setting and changing the current context
Cleaning up kubeconfig
See also
Setting resource in nodes
Getting ready
How to do it…
Managing node capacity
Managing computing resources in a pod
See also
Playing with WebUI
Getting ready
How to do it…
How it works…
See also
Working with a RESTful API
Getting ready
How to do it…
How it works…
See also
Authentication and authorization
Getting ready
How to do it…
Enabling authentication for an API call
Basic authentication of etcd
Basic authentication of the Kubernetes master
Making use of user authorization
See also
8. Logging and Monitoring
Introduction
Collecting application logs
Getting ready
Elasticsearch
How to do it…
Logstash
Startup script
Dockerfile
Docker build
Kubernetes replication controller and service
Kibana
How it works…
See also
Working with Kubernetes logs
Getting ready
How to do it…
See also
Working with etcd log
Getting ready
How to do it…
See also
Monitoring master and node
Getting ready
Updating Kubernetes to the latest version: 1.2.1
Setting up the DNS server
Start the server using templates
Enable Kubernetes DNS in kubelet
How to do it…
Installing a monitoring cluster
Introducing the Grafana dashboard
Creating a new metric to monitor pods
See also
B. Bibliography
Index
← Prev
Back
Next →
← Prev
Back
Next →