Complete Download Getting Started with Kubernetes Orchestrate and manage large scale Docker deployments with Kubernetes to unlock greater control over your infrastructure and extend your containerization strategy 1st Edition Jonathan Baier PDF All Chapters
Complete Download Getting Started with Kubernetes Orchestrate and manage large scale Docker deployments with Kubernetes to unlock greater control over your infrastructure and extend your containerization strategy 1st Edition Jonathan Baier PDF All Chapters
com
OR CLICK HERE
DOWLOAD NOW
https://ebookgate.com/product/puppet-4-essentials-2nd-edition-acquire-
skills-to-manage-your-it-infrastructure-effectively-with-puppet-felix-
frank/
ebookgate.com
https://ebookgate.com/product/playing-with-java-microservices-on-
kubernetes-and-openshift-1st-edition-nebrass-lamouchi/
ebookgate.com
https://ebookgate.com/product/kubernetes-native-microservices-with-
quarkus-and-microprofile-1st-edition-john-clingan-ken-finnigan/
ebookgate.com
https://ebookgate.com/product/getting-started-with-rfid-1st-edition-
tom-igoe/
ebookgate.com
Getting Started with React Native 1st Edition Holmes
https://ebookgate.com/product/getting-started-with-react-native-1st-
edition-holmes/
ebookgate.com
Manage Your Life with Outlook For Dummies 1st Edition Greg
Harvey
https://ebookgate.com/product/manage-your-life-with-outlook-for-
dummies-1st-edition-greg-harvey/
ebookgate.com
Getting started with WAP and WML 1st ed Edition Huw Evans
https://ebookgate.com/product/getting-started-with-wap-and-wml-1st-ed-
edition-huw-evans/
ebookgate.com
https://ebookgate.com/product/getting-started-with-makerbot-1st-ed-
edition-bre-pettis/
ebookgate.com
https://ebookgate.com/product/getting-started-with-raspberry-pi-1st-
edition-matt-richardson/
ebookgate.com
Getting Started with Kubernetes
Table of Contents
Getting Started with Kubernetes
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
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
Errata
Piracy
Questions
1. Kubernetes and Container Operations
A brief overview of containers
What is a container?
Why are containers so cool?
Advantages to Continuous Integration/Continuous Deployment
Resource utilization
Microservices and orchestration
Future challenges
Advantages of Kubernetes
Our first cluster
Kubernetes UI
Grafana
Swagger
Command line
Services running on the master
Services running on the minions
Tear down cluster
Working with other providers
Resetting the cluster
Summary
Footnotes
References
2. Kubernetes – Core Concepts and Constructs
The architecture
Master
Node (formerly minions)
Core constructs
Pods
Pod example
Labels
The container’s afterlife
Services
Replication controllers
Our first Kubernetes application
More on labels
Health checks
TCP checks
Life cycle hooks or graceful shutdown
Application scheduling
Scheduling example
Summary
Footnotes
3. Core Concepts – Networking, Storage, and Advanced Services
Kubernetes networking
Networking comparisons
Docker
Docker plugins (libnetwork)
Weave
Flannel
Project Calico
Balanced design
Advanced services
External services
Internal services
Custom load balancing
Cross-node proxy
Custom ports
Multiple ports
Migrations, multicluster, and more
Custom addressing
Service discovery
DNS
Persistent storage
Temporary disks
Cloud volumes
GCE persistent disks
AWS Elastic Block Store
Other PD options
Multitenancy
Limits
Summary
Footnotes
4. Updates and Gradual Rollouts
Example set up
Scaling up
Smooth updates
Testing, releases, and cutovers
Growing your cluster
Scaling up the cluster on GCE
Autoscaling and scaling down
Scaling up the cluster on AWS
Scaling manually
Summary
5. Continuous Delivery
Integration with continuous delivery
Gulp.js
Prerequisites
Gulp build example
Kubernetes plugin for Jenkins
Prerequisites
Installing plugins
Configuring the Kubernetes plugin
Bonus fun
Summary
6. Monitoring and Logging
Monitoring operations
Built-in monitoring
Exploring Heapster
Customizing our dashboards
FluentD and Google Cloud Logging
FluentD
Maturing our monitoring operations
GCE (StackDriver)
Sign-up for GCE monitoring
Configure detailed monitoring
Alerts
Beyond system monitoring with Sysdig
Sysdig Cloud
Detailed views
Topology views
Metrics
Alerting
Kubernetes support
The Sysdig command line
The csysdig command-line UI
Summary
Footnotes
7. OCI, CNCF, CoreOS, and Tectonic
The importance of standards
Open Container Initiative
Cloud Native Computing Foundation
Standard container specification
CoreOS
rkt
etcd
Kubernetes with CoreOS
Tectonic
Dashboard highlights
Summary
Footnotes
8. Towards Production-Ready
Ready for production
Security
Ready, set, go
Third-party companies
Private registries
Google Container Engine
Twistlock
Kismatic
Mesosphere (Kubernetes on Mesos)
Deis
OpenShift
Where to learn more
Summary
Index
Getting Started with Kubernetes
Getting Started with Kubernetes
Copyright © 2015 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: December 2015
Production reference: 1151215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-403-5
www.packtpub.com
Credits
Author
Jonathan Baier
Reviewer
Giragadurai Vallirajan
Commissioning Editor
Dipika Gaonkar
Acquisition Editor
Indrajit A. Das
Content Development Editor
Pooja Mhapsekar
Technical Editor
Gaurav Suri
Copy Editor
Dipti Mankame
Project Coordinator
Francina Pinto
Proofreader
Safis Editing
Indexer
Priya Sane
Graphics
Kirk D’Penha
Production Coordinator
Shantanu N. Zagade
Cover Work
Shantanu N. Zagade
About the Author
Jonathan Baier is a senior cloud architect living in Brooklyn, NY. He has had a passion
for technology since an early age. When he was 14 years old, he was so interested in the
family computer (an IBM PCjr) that he poured through the several hundred pages of
BASIC and DOS manuals. Then, he taught himself to code a very poorly-written version
of Tic-Tac-Toe. During his teen years, he started a computer support business. Since then,
he has dabbled in entrepreneurship several times throughout his life. He now enjoys
working for Cloud Technology Partners, a cloud-focused professional service and
application development firm headquartered in Boston.
He has over a decade of experience delivering technology strategies and solutions for both
public and private sector businesses of all sizes. He has a breadth of experience working
with a wide variety of technologies and with stakeholders from all levels of management.
Working in the areas of architecture, containerization, and cloud security, he has created
strategic roadmaps to guide and help mature the overall IT capabilities of various
enterprises. Furthermore, he has helped organizations of various sizes build and
implement their cloud strategy and solve the many challenges that arise when “designs on
paper” meet reality.
Acknowledgments
A tremendous thank you to my wonderful wife, Tomoko, and my playful son, Nikko. You
both gave me incredible support and motivation during the writing process. There were
many early morning, long weekend, and late night writing sessions that I could not have
done without you both. Your smiles move mountains I could not on my own. You are my
true north stars and my guiding light in the storm.
I’d also like to extend special thanks to all my colleagues and friends at Cloud Technology
Partners, many of whom provided encouragement and support throughout the process. I’d
especially like to thank Mike Kavis, David Linthicum, Alan Zall, Lisa Noon, and Charles
Radi, who helped me make the book so much better with their efforts. I’d also like to
thank the amazing CTP marketing team (Brad Young, Shannon Croy, and Nicole Givin)
for making my work look great on the Web and in front of the camera.
About the Reviewer
Giragadurai Vallirajan is a seasoned technologist and entrepreneur. Currently, he is the
CTO of Bluemeric Technologies Pvt Ltd, Bangalore. He has more than 12 years of
experience in the IT industry and has worked for Fortune 100 companies, including
Lehman Brothers (Tokyo) and Hewlett-Packard (Bangalore). Giragadurai has considerable
expertise in big data analytics, predictive analytics, complex event processing, and
performance tuning in distributed and cloud environments. He is an entrepreneur at heart;
he started an analytics start-up, Vorthy Softwares (Singapore/India), before joining
Bluemeric.
www.PacktPub.com
Support files, eBooks, discount offers, and
more
For support files and downloads related to your book, please visit www.PacktPub.com.
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 <[email protected]> for more details.
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.
https://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
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view 9 entirely free books. Simply use your login credentials for
immediate access.
Preface
This book is a guide to getting started with Kubernetes and overall container management.
We will walk you through the features and functions of Kubernetes and show how it fits
into an overall operations strategy. You’ll learn what hurdles lurk in moving container off
the developer’s laptop and managing them at a larger scale. You’ll also see how
Kubernetes is the perfect tool to help you face these challenges with confidence.
What this book covers
Chapter 1, Kubernetes and Container Operations, provides a brief overview of containers
and the how, what, and why of Kubernetes orchestration. It explores how it impacts your
business goals and everyday operations.
Chapter 2, Kubernetes – Core Concepts and Constructs, will explore core Kubernetes
constructs, such as pods, services, replication controllers, and labels using a few simple
examples. Basic operations, including health checks and scheduling, will also be covered.
Chapter 3, Core Concepts – Networking, Storage, and Advanced Services, covers cluster
networking for Kubernetes and the Kubernetes proxy, a deeper dive into services, storage
concerns, persistent data across pods, and the container lifecycles. Finishing up, we will
see a brief overview of some higher level isolation features for mutlitenancy.
Chapter 4, Updates and Gradual Rollouts, takes a quick look at how to roll out updates
and new features with minimal disruption to uptime. We will also look at scaling the
Kubernetes cluster.
Chapter 5, Continuous Delivery, will cover integration of Kubernetes into your continuous
delivery pipeline. We will see how to use a K8s cluster with Gulp.js and Jenkins as well.
Chapter 6, Monitoring and Logging, teaches you how to use and customize built-in and
third-party monitoring tools on your Kubernetes cluster. We will look at built-in logging
and monitoring, the Google Cloud Logging service, and Sysdig.
Chapter 7, OCI, CNCF, CoreOS, and Tectonic, discovers how open standards benefit the
entire container ecosystem. We’ll look at a few of the prominent standards organizations
and cover CoreOS and Tectonic. Also, we will explore their advantages as a host OS and
enterprise platform.
Chapter 8, Towards Production-Ready, shows some of the helpful tools and third-party
projects available and where you can go to get more help.
What you need for this book
This book will cover downloading and running the Kubernetes project. You’ll need access
to a Linux system (VirtualBox will work if you are on windows) and some familiarity with
the command shell.
In addition, you should have at least a Google Cloud Platform account. You can sign up
for a free trial here:
https://cloud.google.com/
Also, an AWS account is necessary for a few sections of the book. You can also sign up
for a free trial here:
https://aws.amazon.com/
Who this book is for
Although you’re in heads down in development, neck deep in operations, or looking
forward as an executive, Kubernetes and this book are for you. Getting Started with
Kubernetes will help you understand how to move your container applications into
production with best practices and step-by-step walk-throughs tied to a real-world
operational strategy. You’ll learn how Kubernetes fits into your everyday operations and
can help you prepare for production-ready container application stacks.
It will be helpful to have some familiarity with Docker containers, general software
developments, and operations at a high level.
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, folder names, filenames, file extensions, and pathnames are shown as
follows: “You can also use the scale command to reduce the number of replicas.”
URLs are shown as follows:
https://docs.docker.com/installation/
If we wish you to use a URL after replacing a portion of it with your own values, it will be
shown like this:
https://<your master ip>/swagger-ui/
Resource definition files and other code blocks are set as follows:
apiVersion: v1
kind: Pod
metadata:
name: node-js-pod
spec:
containers:
- name: node-js-pod
image: bitnami/apache:latest
ports:
- containerPort: 80
When we wish you to replace a portion of the listing with your own value, the relevant
lines or items are set in bold between less than and greater than symbols:
subsets:
- addresses:
- IP: <X.X.X.X>
ports:
- name: http
port: 80
protocol: TCP
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: “We can modify this
group by clicking the Edit group button at the top of the page.”
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or disliked. Reader feedback is important for us as it helps us
develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <[email protected]>, and mention the
book’s title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or
contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help
you to get the most from your purchase.
Downloading the example code
You can download the example code files from your account at http://www.packtpub.com
for all the Packt Publishing books you have purchased. If you purchased this book
elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-
mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do
happen. If you find a mistake in one of our books—maybe a mistake in the text or the
code—we would be grateful if you could report this to us. By doing so, you can save other
readers from frustration and help us improve subsequent versions of this book. If you find
any errata, please report them by visiting http://www.packtpub.com/submit-errata,
selecting your book, clicking on the Errata Submission Form link, and entering the
details of your errata. Once your errata are verified, your submission will be accepted and
the errata will be uploaded to our website or added to any list of existing errata under the
Errata section of that title.
To view the previously submitted errata, go to
https://www.packtpub.com/books/content/support and enter the name of the book in the
search field. The required information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At
Packt, we take the protection of our copyright and licenses very seriously. If you come
across any illegal copies of our works in any form on the Internet, please provide us with
the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated
material.
We appreciate your help in protecting our authors and our ability to bring you valuable
content.
Questions
If you have a problem with any aspect of this book, you can contact us at
<[email protected]>, and we will do our best to address the problem.
Chapter 1. Kubernetes and Container
Operations
This chapter will give a brief overview of containers and how they work as well as why
management and orchestration is important to your business and/or project team. The
chapter will also give a brief overview of how Kubernetes orchestration can enhance our
container management strategy and how we can get a basic Kubernetes cluster up,
running, and ready for container deployments.
This chapter will include the following topics:
Introducing container operations and management
Why container management is important
Advantages of Kubernetes
Downloading the latest Kubernetes
Installing and starting up a new Kubernetes cluster
A brief overview of containers
Over the past two years, containers have grown in popularity like wildfire. You would be
hard-pressed to attend an IT conference without finding popular sessions on Docker or
containers in general.
Docker lies at the heart of the mass adoption and the excitement in the container space. As
Malcom Mclean revolutionized the physical shipping world in 1957 by creating a
standardized shipping container, which is used today for everything from ice cube trays to
automobiles1, Linux containers are revolutionizing the software development world by
making application environments portable and consistent across the infrastructure
landscape. As an organization, Docker has taken the existing container technology to a
new level by making it easy to implement and replicate across environments and
providers.
What is a container?
At the core of container technology are cGroups and namespaces. Additionally, Docker
uses union file systems for added benefits to the container development process.
Control groups (cGroups) work by allowing the host to share and also limit the resources
each process or container can consume. This is important for both, resource utilization and
security, as it prevents denial-of-service attacks on the host’s hardware resources. Several
containers can share CPU and memory while staying within the predefined constraints.
Namespaces offer another form of isolation in the way of processes. Processes are limited
to see only the process ID in the same namespace. Namespaces from other system
processes would not be accessible from a container process. For example, a network
namespace would isolate access to the network interfaces and configuration, which allows
the separation of network interfaces, routes, and firewall rules.
Union file systems are also a key advantage to using Docker containers. The easiest way
to understand union file systems is to think of them like a layer cake with each layer baked
independently. The Linux kernel is our base layer; then, we might add an OS like Red Hat
Linux or Ubuntu. Next, we might add an application like Nginx or Apache. Every
change creates a new layer. Finally, as you make changes and new layers are added, you’ll
always have a top layer (think frosting) that is a writable layer.
Figure 1.2. Layered file system
What makes this truly efficient is that Docker caches the layers the first time we build
them. So, let’s say that we have an image with Ubuntu and then add Apache and build the
image. Next, we build MySQL with Ubuntu as the base. The second build will be much
faster because the Ubuntu layer is already cached. Essentially, our chocolate and vanilla
layers, from Figure 1.2, are already baked. We simply need to bake the pistachio (MySQL)
layer, assemble, and add the icing (writable layer).
Another Random Document on
Scribd Without Any Related Topics
spring into its original position. It results from this arrangement that
the bolt cannot be unlocked until the primary tumbler has been
raised to the same height as before, so as to receive the tongue of
the secondary tumbler. And as this is the case in respect to any one
primary and its accompanying secondary tumblers, so is it the case
whether each set comprises four, five, or any other number. The key
may be altered at pleasure, and will in any form equally well shoot
the bolt; but the lock can only be unfastened by that arrangement of
key which fastened it.
It is, however, desirable to trace the course of improvements more
in detail, because every successive change illustrates one or other of
the several properties required in a good lock. Messrs. Day and
Newell’s lock was not finally brought to an efficient form without
many attempts more or less abortive. Mr. Newell conceived the idea
of applying a second series of tumblers, so placed as to be acted on
by the first series. Each of these secondary tumblers had an
elongated slot, such that a screw could pass through all of them; the
screw having a clamp to overlap the tumblers on the inside of the
lock. The head of the screw rested in a small round hole on the back
of the lock, so placed as to form a secondary key-hole, to which a
small key was fitted. There was thus a double system of locking,
effected in the following way: when the large key had been applied,
and had begun to act on the primary tumblers, the small key was
used to operate on the clamp-screw, and thus bind all of the
secondary tumblers together, ensuring their position at the exact
heights or distances to which the primary key had caused them to
be lifted. The bolt was then free to be shot, and the first series of
tumblers reverted to their original position.
But such an arrangement has obvious inconveniences. Few
persons would incur the trouble of using two keys; and besides this,
there were not wanting certain defects in the action and reaction of
the several parts; for if the clamp-screw were to be left unreleased,
the first series of tumblers would be upheld by the second series in
such a way that the exact impression of the lengths of the several
bits of the key could be obtained through the key-hole while the lock
was unlocked or the bolt unshot. To remedy one or both of these
evils was the next object of Mr. Newell’s attention. He made a series
of notches or teeth in each of the secondary tumblers,
corresponding in mutual distance with the steps or bits of the key;
and opposite these notched edges he placed a dog or lever, with a
projecting tooth suitable to fall into the notches when adjusted
properly in relation to each other. When the key was used, the
primary tumblers were raised in the usual way, and acted on the
secondary tumblers; these latter were so thrown that the dog-tooth
caught in the notches and held them fast, thereby rendering the
same service as the clamp-screw and the small key in the former
arrangement. No other relative position of the bits of the key could
now unlock the lock.
Still, improvement as it was, this change was not enough; Mr.
Newell found that his lock, like all the locks that had preceded it,
was capable of being picked by a clever practitioner; and candidly
admitting the fact, he sought to obtain some new means of security.
He tried what a series of complicated wards would do, in aid of the
former mechanism; but the result proved unsatisfactory. His next
principle was to provide a number of false notches on the abutting
parts of the primary and secondary tumblers, with alterations in
other parts of the apparatus. The theory now depended upon was
this, that if the bolt were subjected to pressure, the tumblers would
be held fast by false notches, and could not be raised by any lock-
picking instrument. To increase the security, a steel-curtain was so
adjusted as to cover, or at least protect, the key-hole. Great
anticipations were entertained of this lock, but they were destined to
be negatived. A clever American machinist, Mr. Pettit, accepted
Messrs. Day and Newell’s challenge (500 dollars to any one who
could pick this lock); he succeeded in picking the lock, and thus won
the prize.
Once again disappointed, Mr. Newell re-examined the whole affair,
and sought for some new principle of security that had not before
occurred to him. He had found that, modify his lock how he might,
the sharp-eyed and neat-fingered mechanician could still explore the
interior of the lock in such a way as to find out the relative positions
of the tumblers, and thus adapt their means to the desired end.
How, therefore, to shut out this exploration altogether became the
problem; how to make a lock, the works of which should be
parautoptic—to coin a word from the Greek, which should signify
concealed from view. The result of his labours was the production of
the American bank-lock now known by that name. The details of this
lock may now conveniently be given.
Fig. 43 represents the key in two different forms, or with the bits
differently arranged. Either form will lock the lock, but the other will
not then unlock it. The end of the key is represented in fig. 44,
shewing the screw which fixes the bits in their places. The bits for a
six-bitted key are shewn separately in fig. 45.
fig. 43. Key of the Parautoptic lock.
ebookgate.com