Puppet for Containerization
()
About this ebook
Learn about configuration management and gain complete control of your Docker containers using Puppet
About This Book- This is the first book that focuses specifically on the combination of containerization and configuration management tools as the landscape for system administration changes
- It demonstrates to administrators how to seamlessly integrate containerization without disrupting their entire system
- It provides a canny way for you to grow your tool kit and embrace new tech such as Docker while building on your existing skill set
This book is designed for system administrators who are looking to explore containerization. Intermediate experience and expertise with Puppet is presumed.
What You Will Learn- Write Puppet modules to build Docker
- Create Docker Compose templates with .erb files
- Get to know the architecture of Docker schedulers
- Create a Docker network and service discovery framework
- Build a fully functional Docker scheduler with Puppet
- Make Docker production ready with Puppet
This book teaches you how to take advantage of the new benefits of containerization systems such as Docker, Kubernetes, Docker Swarm, and Docker UCP, without losing the panoptical power of proper configuration management.
You will learn how to integrate your containerized applications and modules with your Puppet workflow. You will also understand how to manage, monitor, and orchestrate hosts to keep deployed containers running seamlessly. With the help of this book, you can efficiently automate and document with containers, as a part of your system.
The book will also cover use cases of deploying Puppet within a containerized environment.
Style and approachThis book uniquely focuses on the pain point of making containerization part of a bigger, established workflow of system administration. It will begin with the presumption that one has a use for Docker containers, and a background in system administration. Then, step by step, it takes you through the concepts and methods necessary to integrate this new time-saving technology into a well-managed configuration run by Puppet.
Related to Puppet for Containerization
Related ebooks
Puppet for Containerization Rating: 0 out of 5 stars0 ratingsDocker High Performance Rating: 0 out of 5 stars0 ratingsDeveloping with Docker Rating: 0 out of 5 stars0 ratingsBeginning DevOps with Docker: Automate the deployment of your environment with the power of the Docker toolchain Rating: 0 out of 5 stars0 ratingsMonitoring Docker Rating: 0 out of 5 stars0 ratingsDocker High Performance: Complete your Docker journey by optimizing your application's work?ows and performance, 2nd Edition Rating: 0 out of 5 stars0 ratingsLearn Docker – Fundamentals of Docker 19.x: Build, test, ship, and run containers with Docker and Kubernetes, 2nd Edition Rating: 0 out of 5 stars0 ratingsDocker and Kubernetes for Java Developers Rating: 0 out of 5 stars0 ratingsDocker: Up and Running: Build and deploy containerized web apps with Docker and Kubernetes (English Edition) Rating: 0 out of 5 stars0 ratingsKubernetes for Developers: Use Kubernetes to develop, test, and deploy your applications with the help of containers Rating: 0 out of 5 stars0 ratingsThe Kubernetes Bible: The definitive guide to deploying and managing Kubernetes across major cloud platforms Rating: 4 out of 5 stars4/5Mastering Docker: Unlock new opportunities using Docker's most advanced features, 3rd Edition Rating: 0 out of 5 stars0 ratingsPractical Docker with Python: Build, Release and Distribute your Python App with Docker Rating: 0 out of 5 stars0 ratingsExtending Docker Rating: 0 out of 5 stars0 ratingsDocker on Amazon Web Services: Build, deploy, and manage your container applications at scale Rating: 0 out of 5 stars0 ratingsDocker for Serverless Applications: Containerize and orchestrate functions using OpenFaas, OpenWhisk, and Fn Rating: 0 out of 5 stars0 ratingsHands-On Kubernetes on Windows: Effectively orchestrate Windows container workloads using Kubernetes Rating: 0 out of 5 stars0 ratingsSecuring Docker Rating: 0 out of 5 stars0 ratingsDocker on Windows Rating: 0 out of 5 stars0 ratingsContainers in OpenStack: Leverage OpenStack services to make the most of Docker, Kubernetes and Mesos Rating: 0 out of 5 stars0 ratingsLearning Docker: Build, ship, and scale faster Rating: 0 out of 5 stars0 ratingsHands-On Microservices with Kubernetes: Build, deploy, and manage scalable microservices on Kubernetes Rating: 0 out of 5 stars0 ratingsHands-On Microservices with Node.js: Build, test, and deploy robust microservices in JavaScript Rating: 0 out of 5 stars0 ratingsAmazon Fargate Quick Start Guide: Learn how to use AWS Fargate to run containers with ease Rating: 0 out of 5 stars0 ratingsThe DevOps 2.0 Toolkit Rating: 0 out of 5 stars0 ratings
Systems Architecture For You
Learn Git in a Month of Lunches Rating: 0 out of 5 stars0 ratingsCompTIA A+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Core 1 Exam 220-1101 Rating: 0 out of 5 stars0 ratingsAutoCAD 2023 : Beginners And Intermediate user Guide Rating: 0 out of 5 stars0 ratingsHaskell Design Patterns Rating: 0 out of 5 stars0 ratingsBlockchain Basics: A Non-Technical Introduction in 25 Steps Rating: 4 out of 5 stars4/5CompTIA ITF+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam FC0-U61 Rating: 5 out of 5 stars5/5CompTIA Network+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam N10-008 Rating: 0 out of 5 stars0 ratingsJavaScript Application Design: A Build First Approach Rating: 0 out of 5 stars0 ratingsSoftware Architecture with Python Rating: 0 out of 5 stars0 ratingsRaspberry Pi Projects For Dummies Rating: 5 out of 5 stars5/5Microsoft IIS 10.0 Cookbook Rating: 0 out of 5 stars0 ratingsSolution Architecture Foundations Rating: 3 out of 5 stars3/5PlayStation 2 Architecture: Architecture of Consoles: A Practical Analysis, #12 Rating: 0 out of 5 stars0 ratingsSOA Patterns Rating: 0 out of 5 stars0 ratingsPayment Card Industry Professional (PCIP) v4.0: Your Ultimate Study Guide to Success Rating: 0 out of 5 stars0 ratingsNintendo DS Architecture: Architecture of Consoles: A Practical Analysis, #14 Rating: 0 out of 5 stars0 ratingsMicroservices with Azure Rating: 0 out of 5 stars0 ratingsThe Construction Technology Handbook Rating: 0 out of 5 stars0 ratingsThe Practice of Enterprise Architecture: A Modern Approach to Business and IT Alignment Rating: 4 out of 5 stars4/5NES Architecture: Architecture of Consoles: A Practical Analysis, #1 Rating: 5 out of 5 stars5/5Xbox 360 Architecture: Architecture of Consoles: A Practical Analysis, #20 Rating: 0 out of 5 stars0 ratingsFundamentals of Computer Organization and Architecture Rating: 5 out of 5 stars5/5.NET Core in Action Rating: 0 out of 5 stars0 ratingsReact JS and Express Framework: A Comprehensive Guide Rating: 0 out of 5 stars0 ratingsLearning Embedded Android N Programming Rating: 0 out of 5 stars0 ratingsBuilding an Effective Cybersecurity Program, 2nd Edition Rating: 0 out of 5 stars0 ratings
Reviews for Puppet for Containerization
0 ratings0 reviews
Book preview
Puppet for Containerization - Scott Coulton
Table of Contents
Puppet for Containerization
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
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. Installing Docker with Puppet
Installing Vagrant
The installation
VirtualBox
Vagrant
Vagrantfile
Welcome to the Puppet Forge
The Puppet Forge
Creating our puppetfile
Installing Docker
Setting our manifests
Summary
2. Working with Docker Hub
Working with Docker Hub
An overview of Docker Hub
Creating a Docker Hub account
Exploring official images
Automated builds in Docker Hub
Automated builds
Pushing to Docker Hub
Working with official images
Dockerfiles
Docker Compose
Puppet manifest
Summary
3. Building a Single Container Application
Building a Puppet module skeleton
The Puppet module generator
Coding using resource declarations
File structures
Writing our module
Running our module
Coding using .erb files
Writing our module with Docker Compose
Docker Compose up with Puppet
Summary
4. Building Multicontainer Applications
Decoupling a state
State versus stateless
Docker_bitbucket (manifest resources)
Creating our module skeleton
Let's code
Running our module
Docker_bitbucket (Docker Compose)
Let's code – take 2
Running our module – take 2
Summary
5. Configuring Service Discovery and Docker Networking
Service discovery
The theory
The service discovery module
Docker networking
The prerequisites
The code
Summary
6. Multinode Applications
The design of our solution
The Consul cluster
The ELK stack
Putting it all together
The server setup
The Consul cluster
The ELK stack
Summary
7. Container Schedulers
Docker Swarm
The Docker Swarm architecture
Coding
Docker UCP
The Docker UCP architecture
Coding
Kubernetes
The architecture
Coding
Summary
8. Logging, Monitoring, and Recovery Techniques
Logging
The solution
The code
Logstash
Monitoring
Monitoring with Consul
Recovery techniques
Built-in HA
Summary
9. Best Practices for the Real World
Hiera
What data belongs in Hiera
Tips and tricks for Hiera
The code
UCP
Kubernetes
Summary
Index
Puppet for Containerization
Puppet for Containerization
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2016
Production reference: 1130516
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-328-6
www.packtpub.com
Credits
Author
Scott Coulton
Reviewer
Ajeet Singh Raina
Commissioning Editor
Sarah Crofton
Acquisition Editor
Rahul Nair
Content Development Editor
Sumeet Sawant
Technical Editor
Dhiraj Chandanshive
Copy Editor
Neha Vyas
Project Coordinator
Shweta H Birwatkar
Proofreader
Safis Editing
Indexer
Rekha Nair
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
About the Author
Scott Coulton is a solutions architect with 10 years of experience in the field of managed services and hosting space. He has extensive experience in architecture and in rolling out systems and network solutions for national and multinational companies with a wide variety of technologies including AWS, Puppet, Docker, Cisco, VMware, Microsoft, and Linux. His design strengths are in cloud computing, automation, and security space.
You can find him at https://www.linkedin.com/in/scott-coulton-22864813. You can find him on Twitter at @scottcoulton and on GitHub at https://github.com/scotty-c.
About the Reviewer
Ajeet Singh Raina is a Docker Captain (https://www.docker.com/community/docker-captains) as well as technical lead engineer at Dell India R&D. He has picked up a variety of skills in his career, from having worked as an IT consultant and systems administrator to system integration testing. He received a certification as a VMware Certified Professional (VCP 4.1) while he was a part of the VMQA GOS validation team at VMware and has more than 8 years of industry experience. He is currently working with Enterprise Solution Group at Dell India R&D and has solid understanding of diverse range of topics, such as IT infrastructures, systems management, system integration engineering, and quality assurance.
Ajeet has a great passion for upcoming trends and technologies. He loves contributing toward open source space through writing and blogging at http://www.collabnix.com. He is currently busy evaluating and building up containers and microservices for his organization. Last year, he reviewed PowerCLI Cookbook, Packt Publishing.
This book would not have been a success without direct and indirect help from many people. Thanks to my wife and 7-year old kid for putting up with me, for all the missing family time, and for providing me with love and encouragement throughout the reviewing period. Thanks to my parents and family members for all their love, guidance, and encouragement during the tough times. Thanks to all my past and present colleagues and mentors at VMware and Dell Inc. for the insightful knowledge they shared with me.
www.PacktPub.com
eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
eBooks, discount offers, and morehttps://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
To Halen,
Dream big and work hard. There is nothing in your life that you won't be able to achieve.
Love,
Dad
Preface
This book teaches you how to take advantage of the new benefits of containerization systems such as Docker, Kubernetes, Docker Swarm, and Docker UCP, without losing the panoptical power of proper configuration management. You will learn to integrate your containerized applications and modules with your Puppet workflow.
What this book covers
Chapter 1, Installing Docker with Puppet, covers how to create a development environment with Docker using Puppet. We will look at how to install Vagrant and VirtualBox. Then, we will look at Puppet Forge and how to search for modules and their dependencies. We will briefly touch upon r10k to be our transport mechanism from the Puppet Forge to our environment. Then, we build our environment with Puppet.
Chapter 2, Working with Docker Hub, covers a lot about the Docker Hub ecosystem: what are official images, how automated builds work, and of course, working with images in three different ways.
Chapter 3, Building a Single Container Application, contains our first Puppet module to create a Docker container. In this chapter, we will look at writing rspec-puppet unit tests to make sure that our module does what it's meant to do. We will know how to map our Puppet module dependencies with our metadata.json and fixtures.yml files.
Chapter 4, Building Multicontainer Applications, introduces Docker Compose. We will look at the docker-compose .yaml file construct. We will then take that knowledge and create a Puppet template (.erb file) and wrap that into a module. We will also touch on the Docker Compose functionality that will let us scale containers.
Chapter 5, Configuring Service Discovery and Docker Networking, introduces two very important topics when working with containers. First, we will look at service discovery, what it is, why do we need it, and lastly, the different types of service discovery.
Chapter 6, Multinode Applications, introduces all the skills that you've learned in the book so far. We are really going to step it up a notch. In this chapter, we are going to deploy four servers, and we are going to look at how to Consul cluster. In this chapter, we are going to look at the two ways to network our containers. Firstly, using the stand host IP network, that our Consul cluster will communicate on. We will also install the ELK (Elasticsearch, Logstash, and Kibana) stack.
Chapter 7, Container Schedulers, covers container schedulers such as Docker Swarm and Kubernetes. Then, we will build a dev environment containing four servers, three cluster nodes, and a master. We will also build a Docker network and service discovery framework.
Chapter 8, Logging, Monitoring, and Recovery Techniques, will take the environment that we created in the last chapter and add monitoring, logging, and recovery techniques to it. This will make our applications robust and ready for production.
Chapter 9, Best Practices for the Real World, focuses more on the best practices for deploying Puppet itself within a containerized environment using all the new skills that you learned in the previous chapters. By the end of this journey, readers will be able to master Puppet and Docker and apply them in the real world.
What you need for this book
For this book we need Intel i5 or above, 8 GB of ram (16 preferable), 50 GB of free disk space, and any OS that can run Vagrant.
Who this book is for
This book is designed for system administrators who are looking to explore containerization. Intermediate experience and expertise of Puppet is presumed.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: The other change that we have made to the servers.yaml file is we have added entries to the /etc/hosts directory.
Any command-line input or output is written as follows:
command: -server --client 0.0.0.0 --advertise <%= @consul_advertise %> -bootstrap-expect <%= @consul_bootstrap_expect %>
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: The next thing we need to do is click on the Create button.
Note
Warnings or important notes appear in a box like this.