SlideShare a Scribd company logo
Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.com
DevOps with OpenShift 1st Edition Mike Hepburn
https://textbookfull.com/product/devops-with-openshift-1st-
edition-mike-hepburn/
OR CLICK BUTTON
DOWNLOAD NOW
Explore and download more ebook at https://textbookfull.com
Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.
DevOps with OpenShift Cloud Deployments Made Easy 1st
Edition Mike Hepburn
https://textbookfull.com/product/devops-with-openshift-cloud-
deployments-made-easy-1st-edition-mike-hepburn/
textboxfull.com
Cloud Native DevOps with Kubernetes 1st Edition John
Arundel
https://textbookfull.com/product/cloud-native-devops-with-
kubernetes-1st-edition-john-arundel/
textboxfull.com
DevOps for Digital Leaders Reignite Business with a Modern
DevOps Enabled Software Factory 1st Edition Aruna
Ravichandran
https://textbookfull.com/product/devops-for-digital-leaders-reignite-
business-with-a-modern-devops-enabled-software-factory-1st-edition-
aruna-ravichandran/
textboxfull.com
Implementing Devops with Microsoft Azure Mitesh Soni
https://textbookfull.com/product/implementing-devops-with-microsoft-
azure-mitesh-soni/
textboxfull.com
Domestic law in international investment arbitration 1st
Edition Hepburn
https://textbookfull.com/product/domestic-law-in-international-
investment-arbitration-1st-edition-hepburn/
textboxfull.com
Introduction to DevOps with Chocolate, LEGO and Scrum Game
1st Edition Dana Pylayeva (Auth.)
https://textbookfull.com/product/introduction-to-devops-with-
chocolate-lego-and-scrum-game-1st-edition-dana-pylayeva-auth/
textboxfull.com
Agile Project Management with Azure DevOps: Concepts,
Templates, and Metrics 1st Edition Joachim Rossberg
https://textbookfull.com/product/agile-project-management-with-azure-
devops-concepts-templates-and-metrics-1st-edition-joachim-rossberg/
textboxfull.com
DevOps for SharePoint: With Packer, Terraform, Ansible,
and Vagrant Oscar Medina
https://textbookfull.com/product/devops-for-sharepoint-with-packer-
terraform-ansible-and-vagrant-oscar-medina/
textboxfull.com
Red Hat and IT Security: With Red Hat Ansible, Red Hat
OpenShift, and Red Hat Security Auditing 1st Edition
Rithik Chatterjee
https://textbookfull.com/product/red-hat-and-it-security-with-red-hat-
ansible-red-hat-openshift-and-red-hat-security-auditing-1st-edition-
rithik-chatterjee/
textboxfull.com
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
Stefano Picozzi,
Mike Hepburn & Noel O'Connor
DevOps with
OpenShift
CLOUD DEPLOYMENTS MADE EASY
C
o
m
p
l
i
m
e
n
t
s
o
f
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
Stefano Picozzi, Mike Hepburn, and Noel O’Connor
DevOps with OpenShift
Cloud Deployments Made Easy
Boston Farnham Sebastopol Tokyo
Beijing Boston Farnham Sebastopol Tokyo
Beijing
978-1-491-97662-3
[LSI]
DevOps with OpenShift
by Stefano Picozzi, Mike Hepburn, and Noel O’Connor
Copyright © 2017 Red Hat, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://oreilly.com/safari). For more information, contact our corporate/insti‐
tutional sales department: 800-998-9938 or corporate@oreilly.com.
Editors: Brian Anderson and Virginia Wilson
Production Editor: Nicholas Adams
Copyeditor: Jasmine Kwityn
Proofreader: Sonia Saruba
Indexer: Angela Howard
Interior Designer: David Futato
Cover Designer: Randy Comer
Illustrator: Rebecca Demarest
May 2017: First Edition
Revision History for the First Edition
2017-04-10: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781491975961 for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. DevOps with OpenShift, the cover
image, and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the authors have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1. Introduction to DevOps with OpenShift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
DevOps 1
Containers 2
Container Orchestration 2
Continuous Integration 2
Continuous Delivery 3
Continuous Deployment 3
Pipelines 3
Software Configuration Management 4
Deployment Patterns 4
Continuous Improvement 5
Summary 5
2. Installing the All-In-One OpenShift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Software Requirements 7
Install OpenShift oc Client Tools 8
Install Docker 9
Launch OpenShift 10
Verify Your Environment 11
Log In Using the Command Line 11
Log In from Console 12
Working with Storage 14
Create a Persistent Volume 14
Set Up the Volume Claim 15
Create a GitHub Account 16
Alternative Form Factors 16
iii
Summary 16
3. Deployments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
The Replication Controller 17
Deployment Strategies 18
Rolling 18
Triggers 19
Recreate 21
Custom 22
Lifecycle Hooks 22
Deployment Pod Resources 26
Blue-Green Deployments 27
A/B Deployments 28
Canary Deployments 31
Rollbacks 32
Summary 34
4. Pipelines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Our First Pipeline Example 35
Pipeline Components 38
So What’s Happened Here? Examination of the Pipeline Details 39
Explore Jenkins 41
Multiple Project Pipeline Example 43
Build, Tag, Promote 43
Create Projects 44
Add Role-Based Access Control 45
Deploy Jenkins and Our Pipeline Definition 45
Deploy Our Sample Application 46
Run Our Pipeline Deployment 48
Quickly Deploying a New Branch 50
Managing Image Changes 50
Cascading Pipelines 52
Customizing Jenkins 55
Parallel Build Jobs 57
Summary 58
5. Configuration Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Secrets 59
Secret Creation 60
Using Secrets in Pods 60
Additional Information 63
Configuration Maps 64
iv | Table of Contents
Creating Configuration Maps 64
Mounting Configuration Maps as Volumes 64
Mounting the Configuration Map as Environment Variables 65
Environment Variables 67
Adding Environment Variables 67
Removing Environment Variables 67
Change Triggers 68
Labels and Annotations 70
Downward API 70
Handling Large Configuration Data Sets 73
Persistent Volumes 73
Layered Images 73
Summary 74
6. Custom Image Builds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
OpenShift Builds 75
Build Strategies 75
Build Sources 76
Build Configurations 76
Source to Image 79
S2I Process 80
Custom S2I Scripts 81
Custom S2I Builder 81
Builder Image 82
S2I Scripts 83
Adding a New Builder Image 84
Building a Sample Application 84
Troubleshooting 87
Summary 88
7. Application Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Integrated Logging 91
Container Logs Are Transient 92
Aggregated Logging 92
Kibana 94
Some General Aggregated Kibana Queries 95
Simple Metrics 97
Resource Scheduling 99
Quotas 101
Quota Scopes 103
Quota Enforcement 104
Limit Ranges and Requests Versus Limits 104
Table of Contents | v
Multiproject Quotas 106
Applications 107
Eviction and Pod Rescheduling 107
Overcommit 108
Auto Pod Scaling 108
Java-Based Application Monitoring and Management Using Jolokia 110
Summary 114
Afterword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
A. OpenShift and 12 Factor Apps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
vi | Table of Contents
Preface
If you’re old, don’t try to change yourself, change your environment.
—B. F. Skinner
One view of DevOps is that it helps take on that last mile problem in software: value
delivery. The premise is that encouraging behaviors such as teaming, feedback, and
experimentation will be reinforced by desirable outcomes such as better software,
delivered faster and at lower cost. For many, the DevOps discourse then quickly turns
to automation. That makes sense as automation is an environmental intervention that
is relatively actionable. If you want to change behavior, change the environment!
In this context, automation becomes a significant investment decision with strategic
import. DevOps automation engineers face a number of design choices. What level of
interface abstraction is appropriate for the automation tooling? Where should you
separate automation concerns of an infrastructure nature from those that should be
more application centric?
These questions matter because automation tooling that is accessible to all can better
connect all the participants in the software delivery process. That is going to help fos‐
ter all those positive teaming behaviors we are after. Automation that is decoupled
from infrastructure provisioning events makes it possible to quickly tenant new
project streams. Users can immediately self-serve without raising a new infrastruc‐
ture requisition.
We want to open the innovation process to all, be they 10x programmers or citizen
developers. Doing DevOps with OpenShift makes this possible, and this book will
show you how.
This is a practical guide that will show how to easily implement and automate power‐
ful cloud deployment patterns using OpenShift. The OpenShift container manage‐
ment platform provides a self-service platform for users. Its natively container-aware
approach will allow us to show you an application-centric view to automation.
vii
Who Should Read This Book
If you are keen to awaken your inner DevOps then this book is for you. It is intended
for programmers who want to learn how to use OpenShift to automate the software
delivery process to achieve continuous integration, delivery, and deployment.
Note that we deliberately take an application workload-centric view of the problem.
Concerns related to the overall management and operation of the OpenShift system
will be the subject of a forthcoming title in O’Reilly’s OpenShift series.
We will step you through how to develop container-based applications that can be
easily and safely changed via pipelines and powerful deployment patterns. Starting
with a few simple steps to launch OpenShift as an all-in-one image on your worksta‐
tion, we will cover examples for application environment configuration, persistent
volume claims, and A/B, blue-green, and rolling or replacement deployment strate‐
gies. Techniques for third-party tool chain integration using webhooks will be
explained and demonstrated.
This book builds on the material covered in OpenShift for Developers and so assumes
some background knowledge of basic OpenShift development concepts such as:
• Developing and deploying an application.
• Using application templates.
• Managing application workloads.
• Working with Docker images.
As with the previous title, we also assume you are familiar with basic Linux or Win‐
dows shell commands, and how to install additional software on your computer. The
software you install will provide you with a complete working OpenShift environ‐
ment that you can use locally for development or testing.
We have used a PHP and a Node.js application for many of the examples in this book.
You do not need to be proficient in PHP or Node.js. If you are familiar with any of
the popular programming languages you will do just fine.
Why We Wrote This Book
As Red Hat consultants, we are often called upon to assist clients in the deployment
and widespread adoption of OpenShift as their container management platform.
They are drawn to OpenShift as a technology enabler for increased agility and
responsiveness. In this context, change-ability can be the most critical of nonfunc‐
tional requirements. Continuous improvement needs continuous user feedback. We
have found that the ability to push, test, and then roll forward or roll back small
application changes to live users can become critical to realizing such benefits. In this
viii | Preface
book we want to help you implement DevOps practices using OpenShift so that you
can quickly deliver quality applications that will make a difference for your users.
Online Resources
In this book you will install a self-contained OpenShift environment based on Open‐
Shift Origin. This is the upstream open source version of OpenShift on which Red
Hat’s OpenShift Container Platform, OpenShift Dedicated, and OpenShift Online
products are based.
Various options are available to stand up a self-contained environment. For this book,
we will focus on the oc cluster up technique that starts up a local all-in-one cluster
based on OpenShift Origin. Alternative approaches are available, such as the Vagrant
all-in-one virtual machine described at the OpenShift Origin site. This procedure was
covered in OpenShift for Developers and so is not repeated in detail here.
OpenShift Origin will always include all the latest features, with support being pro‐
vided by the OpenShift community.
The OpenShift product releases are created as a regular snapshot of the OpenShift
Origin project. The product releases do not always have the very latest features, but if
you have a commercial Red Hat subscription, the product releases include support
from Red Hat.
If you would like to try out the OpenShift Container Platform version, a couple of
options are available.
The first is to register for a Red Hat Developers account. The Red Hat Developer Pro‐
gram allows you to access versions of Red Hat products for personal use on your own
computer. One of the products made available through the program is the Red Hat
Container Development Kit. This includes a version of OpenShift that you can install
on your own computer, but which is based on OpenShift Container Platform rather
than OpenShift Origin.
A second way of trying out OpenShift Container Platform is via the Amazon Web
Services (AWS) Test Drive program. This will set you up an OpenShift environment
running across a multinode cluster on AWS.
Take a look at more in-depth documentation on OpenShift and how to use it at the
OpenShift documentation site.
Check out the OpenShift blog, where regular articles are published on OpenShift.
If you want to hear about how others in the OpenShift community are using Open‐
Shift, or wish to share your own experiences, you can join the OpenShift Commons.
Preface | ix
If you have questions or issues, you can reach the OpenShift team through Stack
Overflow, on Twitter (@openshift), or in the #openshift channel on IRC’s FreeNode
network.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program ele‐
ments such as variable or function names, databases, data types, environment
variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter‐
mined by context.
This element signifies a tip or suggestion.
This element signifies a general note.
This element indicates a warning or caution.
Using Code Examples
Supplemental material (code examples, exercises, etc.) is available for download at
https://github.com/devops-with-openshift.
x | Preface
This book is here to help you get your job done. In general, if example code is offered
with this book, you may use it in your programs and documentation. You do not
need to contact us for permission unless you’re reproducing a significant portion of
the code. For example, writing a program that uses several chunks of code from this
book does not require permission. Selling or distributing a CD-ROM of examples
from O’Reilly books does require permission. Answering a question by citing this
book and quoting example code does not require permission. Incorporating a signifi‐
cant amount of example code from this book into your product’s documentation does
require permission.
We appreciate, but do not require, attribution. An attribution usually includes the
title, author, publisher, and ISBN. For example: “DevOps with OpenShift by Stefano
Picozzi, Mike Hepburn, and Noel O’Connor (O’Reilly). Copyright 2017 Red Hat, Inc.,
978-1-491-97662-3.”
If you feel your use of code examples falls outside fair use or the permission given
above, feel free to contact us at permissions@oreilly.com.
O’Reilly Safari
Safari (formerly Safari Books Online) is a membership-based
training and reference platform for enterprise, government,
educators, and individuals.
Members have access to thousands of books, training videos, Learning Paths, interac‐
tive tutorials, and curated playlists from over 250 publishers, including O’Reilly
Media, Harvard Business Review, Prentice Hall Professional, Addison-Wesley Profes‐
sional, Microsoft Press, Sams, Que, Peachpit Press, Adobe, Focal Press, Cisco Press,
John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe
Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, and
Course Technology, among others.
For more information, please visit http://oreilly.com/safari.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
Preface | xi
707-829-0104 (fax)
To comment or ask technical questions about this book, send email to bookques‐
tions@oreilly.com.
For more information about our books, courses, conferences, and news, see our web‐
site at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Acknowledgments
Stefano
It’s a privilege to contribute to a book such as this. For this, I am grateful to my family
and Red Hat for allowing me to indulge in those private, quiet moments it takes to
then get it done!
I also appreciate the many clients who have taken the time to share their aspirations
and challenges with me. Software process improvement is hard. All the insights and
suggestions presented here originate there.
Mike
One of my favorite quotes related to content creation is this one from Harry S. Tru‐
man: “It is amazing what you can accomplish if you do not care who gets the credit.”
It is with this humility that I wish to acknowledge all of the fantastic work from the
OpenShift community that has provided ideas that have gone into this book.
You Rock.
Noel
Writing this book has been a whole heap of fun and I’m grateful to Stefano and Mike
for inviting me to participate in this project. I’d also like to thank my wife and chil‐
dren for their patience and support while writing this book.
The true power of this platform is in its open source foundations and the multitude
of perspectives and opinions that only a diverse open community can bring. Thanks
also to all those involved in the internal Red Hat teams who develop, productize, test,
document, and support this platform.
xii | Preface
CHAPTER 1
Introduction to DevOps with OpenShift
This book provides a practical guide for using OpenShift as an enablement technol‐
ogy for DevOps. OpenShift’s combination of container management platform with
natively container-aware automation can bring those Developer and Operations con‐
stituencies together in ways not previously possible. This enables software work
products to present themselves in a standardized form to your preferred continuous
integration and delivery tool chains.
Container awareness makes it possible to leverage deployment strategies and quality
of service characteristics honored by the container management platform and under‐
lying orchestration engine. We can start thinking in terms of containers-as-code rather
than infrastructure-as-code.
So to get started, let’s review some key DevOps concepts as interpreted with a
container-centric viewpoint.
DevOps
DevOps is concerned with aligning the constituents in the software delivery process
to a common goal of value delivery—and it’s not just Developers and Operators, but
InfoSec and Quality Assurance functions and more. Recognize that wealth is created
when the work product is valued by actors external to the production system. Value
delivery outcomes are measured by metrics tied to production delivery velocity, qual‐
ity, and waste. DevOps emphasizes behavioral- or cultural-related changes such as
those which encourage teaming, inclusion, feedback, and experimentation. Techno‐
logical interventions such as automation are central as they can reinforce such target
behaviors. DevOps does not necessarily imply functional roles in software delivery
such as development, quality assurance, or operations are merged or seconded. More
1
important is that a professional respect and shared sensibility is formed across the
delivery team.
Containers
Containers are the runtime representation of a packaging format based on a light‐
weight, immutable image. Runtime dependencies are resolved within the image
which facilitates portability. This makes possible the agreement on a standardized
software work product. Management and runtime tooling that is container aware can
then be applied consistently no matter what the underlying technology stack.
Container-based workloads are suitable for multi-tenancy on a single compute
instance and when implemented securely can realize significant operation efficien‐
cies. An important corollary is that launching a new workload does not incur the cost
of provisioning new compute infrastructure. This enables a true on-demand, self-
service experience for users.
Container Orchestration
Container orchestration involves the lifecycle management of container workloads,
including functions such as to schedule, stop, start, and replicate across a cluster of
machines. Compute resources for running workloads are abstracted, allowing the
host infrastructure to be treated as a single logical deployment target. Kubernetes is
an open source community project addressing container orchestration. It groups
containers that make up an application into logical units for easy management and
discovery, and features self-healing, service discovery, load balancing, and storage
services among its rich feature set. Orchestration plays a critical role in our design
goal of application-centricity as quality of service attributes and deployment patterns
are executed by invoking Kubernetes API primitives.
Continuous Integration
Continuous integration (CI) concerns the integration of code from potentially multi‐
ple authors into a shared source code management (SCM) repository. Such check-ins
could occur many times a day, and automation steps in such a process could include
gates or controls to expose any issues as early as possible. SCMs such as Git
include workflow support to commit to trunk, push, and merge code pull requests
from multiple developers. With containers, a Git push event could be configured to
then trigger an image build event via the webhooks mechanism.
2 | Chapter 1: Introduction to DevOps with OpenShift
Continuous Delivery
Once a CI strategy is in place, consideration can then move to achieving continuous
delivery (CD). This involves automating the steps required to promote the work
product from one environment to the next within the defined software development
lifecycle (SDLC). Such steps could include automated testing, smoke, unit, functional,
and static code analysis and static dependency checks for known security vulnerabili‐
ties. With containers, promotion in later stages of the SLC may merely involve the
tagging of the (immutable) image to mark acceptance. Binary promotions are also
possible such that only the image is pushed (to the target registry of the new environ‐
ment), leaving source code in situ.
Continuous Deployment
By convention, we can denote the special case of automated continuous delivery to
production as continuous deployment (CD). We make such a distinction because such
deployments may be subject to additional governance processes and gates—for exam‐
ple, deliberate human intervention to manage risk and complete sign-off procedures.
We make such a distinction because such deployments may be subject to additional
governance processes. As per Figure 1-1, there may be scenarios for deliberate human
intervention to manage risk and complete sign-off procedures.
Figure 1-1. Continuous delivery versus deployment
Pipelines
Pipelines are a representation of the flow/automation in a CI/CD process. Typically a
pipeline might call out discrete steps in the software delivery process and present
them visually or via a high-level scripting language so the flow can be manipulated.
Continuous Delivery | 3
The steps might include build, unit tests, acceptance tests, packaging, documentation,
reporting, and deployment and verification phases. Well-designed pipelines help
deliver better quality code faster by enabling participants in the software delivery
process to more easily diagnose and respond to feedback. As illustrated in Figure 1-2,
diagnosis and response turnaround can be accelerated by organizing releases into
smaller and more frequent release bundles.
Figure 1-2. Smaller releases, release often, faster feedback
Software Configuration Management
For our purposes we will take a narrower view of software configuration management
(CM) and focus on the recommended software engineering practice of separating
dynamic configuration from static runtime software. Doing so allows developers and
operations engineers to change the configuration without having to rebuild the run‐
time such as might occur when deploying to different environments. Containers,
based as they are on immutable images, amplify this behavior as the alternative would
be configuration layered across multiple images for each deployment scenario.
Deployment Patterns
Aligned with the goal of automation across all steps in the software delivery lifecycle
are patterns for deployment. We look here for strategies that can balance across crite‐
ria including safety, testability, reversibility, and downtime minimization in cloud-
scale scenarios. Some deployment patterns also offer opportunities for capturing and
4 | Chapter 1: Introduction to DevOps with OpenShift
responding to feedback. An A/B deployment allows for testing a user-defined
hypothesis such as whether application version A is more effective than B. Usage
results can then drive weighted load balancing across the alternatives. Automation of
deployment strategies in this DevOps world are implemented by driving the orches‐
tration APIs.
Continuous Improvement
Let’s conclude this chapter by covering continuous improvement (Figure 1-3), which
should be the thread that connects all of the process improvement–related practices
summarized. The environment changes and so must we. These practices make it easy
and inexpensive to experiment, formulate, and test hypotheses, as well as capture, act
on, and experiment with the feedback received. This way we can continue to inject
energy into the system and so maintain a state of dynamic stability—a balance of
adaptive/agile versus fixed/stable.
Figure 1-3. Continuous improvement
Summary
We covered here some of what is unique and nuanced about DevOps with OpenShift
and why it matters. Realizing these DevOps concepts using natively container-aware
automation can bring cloud deployment power to all the people, from 10x program‐
mer to citizen developer. The following chapters will show you how.
Continuous Improvement | 5
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
CHAPTER 2
Installing the All-In-One OpenShift
The same OpenShift codebase can take on many form factors. It can be a large public
cloud deployment, offered as a managed service, a private instance in your company’s
data center, or as small as a local installation on your own workstation. This makes
for a very convenient platform for evaluating, learning, and testing OpenShift-based
workloads. Skills developed on a local instance are transferable to more complex dis‐
tributed topologies.
The easiest way to get started is to visit the OpenShift website and register for a free
developer account. This will suffice for many of the examples covered in this book.
Once registered, you can log in and you are good to go!
Another option is to use a local OpenShift all-in-one cluster on your own worksta‐
tion. This is a fully functioning OpenShift instance with an integrated Docker regis‐
try, OpenShift master, and node. It can support both the upstream OpenShift Origin
and OpenShift Container Platform versions. The aim of this feature is to allow web
developers and other interested parties to run OpenShift V3 on their own computer.
The cluster will be routable from your local system so you can treat it like a hosted
version of OpenShift and can view the URLs you create.
As your own private instance, you can create as many projects as you like, push and
pull to your registry, create local persistent volumes, and have cluster admin access.
Here we will document building this using the oc cluster up command.
Software Requirements
The oc cluster up command starts a local OpenShift all-in-one cluster with a con‐
figured registry, router, image streams, and default templates. By default, the com‐
mand requires a working Docker connection. However, if running in an environment
with Docker Machine installed, it can create a Docker machine for you.
7
The oc cluster up command will create a default user and project, and once it com‐
pletes will allow you to start using the command line to create and deploy apps with
commands like oc new-app, oc new-build, and oc run. It will also print out a URL
to access the management console for your cluster.
So let’s get started. We are going to install the latest OpenShift client tools, install
Docker, and then start a local cluster instance.
The all-in-one cluster uses xip.io to provide DNS resolution with
application URLs. The advantage of this is that you actually get
routable URLs to your local machine without browser or separate
DNS configuration steps. The drawback is that you need to be
online whenever you use the cluster and xip.io may be blocked by
your company’s firewalls. Verify xip.io accessibility using a com‐
mand such as nslookup and check that it can return an address in
the non-authoritative answer section:
$ nslookup x.127.0.0.1.xip.io
Server: 61.9.195.193
Address: 61.9.195.193#53
Non-authoritative answer:
Name: x.127.0.0.1.xip.io
Address: 127.0.0.1
Install OpenShift oc Client Tools
OpenShift 3 allows you to work using a command-line interface (CLI), web console,
or via the Eclipse IDE using the latest JBoss tools. The CLI tool is known as oc and is
what we will use in most cases. It’s a single Go executable, so installation is simply a
matter of downloading the tool and adding it to your PATH. Choose the latest, stable
release from https://github.com/openshift/origin/releases, select the download that
matches your operating system environment, update your PATH, and you are good to
go.
For example, if I extracted the contents to the CLI directory in my home directory, I
would issue the following command in both Linux and macOS to update the PATH
and then verify success:
$ export PATH=$PATH:~/cli/
$ oc version
oc v1.4.1+3f9807a
kubernetes v1.4.0+776c994
features: Basic-Auth
Server https://127.0.0.1:8443
8 | Chapter 2: Installing the All-In-One OpenShift
openshift v1.4.0-rc1+b4e0954
kubernetes v1.4.0+776c994
What version of OpenShift is that? The output from the oc
version command indicates that we have downloaded v1.4.1 of the
OpenShift Origin client tools. This means that when we come to
launch our local instance using oc cluster up, v1.4.1 of Open‐
Shift Origin distribution will be pulled down.
For Windows users, the specific details for updating your PATH varies slightly
between releases. Using Windows 10, right-click the bottom lefthand corner to raise
the Power User task menu, then click System, Advanced System Settings, and finally,
select Environment Variables. Once the dialog opens, select the Path variable and add
“;C:CLI” at the end (ensure you replace “C:CLI” with the location of where you
extracted the tool). You could also just copy it to C:Windows or a directory you
know is already on your path.
Install Docker
The oc cluster up command looks for a working Docker connection. The installa‐
tion and configuration instructions for Linux, macOS, and Windows environments
are covered in the documentation website for Local Cluster Management. Refer to the
website for configuration instructions for your environment, but take note of the
requirement to configure for an insecure registry parameter of 172.30.0.0/16 in each
case. If using Docker for Mac or Docker for Windows, you configure this setting
from the Preferences GUI. Once installed, verify Docker is functioning before pro‐
ceeding. For this book, Docker version 1.13.0 was used. Note that if you will be
attempting more memory-intensive use cases, increase the assigned memory for
Docker:
$ docker version
Client:
Version: 1.13.0
API version: 1.25
...
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
Software Requirements | 9
Docker for Windows is available for Windows 10 and Windows
Server 2016. If you are running earlier versions, then go for the
Vagrant self-contained OpenShift.
Launch OpenShift
With Docker and the oc tools installed and verified, we are ready to launch Open‐
Shift! The oc cluster command accepts various switches, but two we will take spe‐
cial note of are the host-data-dir and host-config-dir parameters. These allow
you to specify a location for storing OpenShift cluster system state. Doing so enables
you to set up named “profiles” for separate cluster instances within the same worksta‐
tion that you can return to later. For the first invocation do something like below,
replacing $HOME to reflect your environment and $PROFILE to, for example, “DevOps‐
WithOpenShift”. This first attempt may take a few minutes as it downloads the Open‐
Shift distribution. Make note of the URL for the server as we will be referring to that
later.
$ oc cluster up 
--host-data-dir='$HOME/oc/profiles/$PROFILE/data' 
--host-config-dir='$HOME/oc/profiles/$PROFILE/config'
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking Docker version ... OK
-- Checking for existing OpenShift container ... OK
-- Checking for openshift/origin:v1.4.1 image ...
Pulling image openshift/origin:v1.4.1
Pulled 1/3 layers, 41% complete
Pulled 2/3 layers, 76% complete
Pulled 3/3 layers, 100% complete
Extracting
Image pull complete
...
-- Server Information ...
OpenShift server started.
The server is accessible via web console at:
https://192.168.99.100:8443
You are logged in as:
User: developer
Password: developer
To login as administrator:
oc login -u system:admin
The profile feature described is available when using a native Docker service (e.g.,
Docker for Mac or Docker for Windows). Environments using Docker Toolbox
10 | Chapter 2: Installing the All-In-One OpenShift
would pass the --create-machine switch instead at first-time launch in order to cre‐
ate a Docker virtual machine driver.
By default, oc cluster up will pull down from the upstream
OpenShift Origin repository, v1.4.1 in this case. To point to a spe‐
cific enterprise image, and version, add the --image and --version
switches to the cluster up invocation. For example, adding
--image=registry.access.redhat.com/openshift3/ose and
--version=v3.4 will launch using OpenShift Container Platform
V3.4.
Windows users can launch the equivalent instruction on Power‐
Shell, albeit using the ^ character for command-line continuation.
Linux and macOS users can also consider passing an additional
parameter --public-hostname=127.0.0.1 to ensure an OpenShift
server on 127.0.0.1:8443.
Now let’s restart the OpenShift cluster using the use-existing-config parameter
and point to the saved named profile:
$ oc cluster down
$ oc cluster up 
--host-data-dir='$HOME/oc/profiles/$PROFILE/data' 
--host-config-dir='$HOME/oc/profiles/$PROFILE/config' 
--use-existing-config
...
The oc cluster command supports many switches. There are var‐
ious open source projects that have built convenience wrappers and
tools to simplfy usage. Some of these include Minishift and oc-
cluster-wrapper.
Verify Your Environment
Let’s now check that we are good to go by logging in using the CLI. We will then ver‐
ify our installation by creating an application.
Log In Using the Command Line
$ oc login -u developer -p developer
Login successful.
You have one project on this server: "myproject"
Verify Your Environment | 11
Using project "myproject".
$ oc project myproject
Already on project "myproject" on server "https://127.0.0.1:8443".
$ oc new-app --name='cotd' --labels name='cotd' php~https://github.com/devops-
with-openshift/cotd.git -e SELECTOR=cats
--> Found image 1875070 (10 days old) in image stream "openshift/php" under tag
"5.6" for "php"
Apache 2.4 with PHP 5.6
-----------------------
Platform for building and running PHP 5.6 applications
Tags: builder, php, php56, rh-php56
* A source build using source code from https://github.com/devops-with-
openshift/cotd.git will be created
* The resulting image will be pushed to image stream "cotd:latest"
* Use 'start-build' to trigger a new build
* This image will be deployed in deployment config "cotd"
* Port 8080/tcp will be load balanced by service "cotd"
* Other containers can access this service through the hostname "cotd"
--> Creating resources with label name=cotd ...
imagestream "cotd" created
buildconfig "cotd" created
deploymentconfig "cotd" created
service "cotd" created
--> Success
Build scheduled, use 'oc logs -f bc/cotd' to track its progress.
Run 'oc status' to view your app.
$ oc expose service cotd
route "cotd" exposed
Windows users with Docker for Windows installed should invoke
the cluster up and cluster down command from PowerShell.
Some of the labs to follow may describe Linux/Bash-style
command-line operations. Windows users can reproduce such
instructions using Bash for Windows or an equivalent.
Log In from Console
The console can be accessed using the OpenShift server console URL as displayed
during the launch output (https://127.0.0.1:8443/console/). Log in using “developer” as
the username and “developer” as the password. Then visit “My Project” to check the
application you just created using the CLI (Figure 2-1).
12 | Chapter 2: Installing the All-In-One OpenShift
Figure 2-1. My project with COTD application
Click the route link as displayed in your console—for example, http://cotd-myproject.
127.0.0.1.xip.io. If all is functioning correctly you should see something like
Figure 2-2.
While you are test-driving your brand-new, all-in-one cluster, why
not check out the profile feature? Just shut down your running
cluster and restart using a different profile name. Then toggle
between the different profiles to verify system state is preserved
within each profile, and restart. System configuration for each pro‐
file will be located as specified in your --host-data-dir and
--host-config-dir launch runtime switches.
Verify Your Environment | 13
Figure 2-2. Cats!
Working with Storage
For some of the labs to follow you may wish to attach storage to your container run‐
ning in your local cluster instance. The approach described is valid for a cluster
instance launched using a native Docker service (i.e., not using the --create-
machine switch). To do so using the oc CLI, follow these steps:
1. Create a persistent volume (pv).
2. Set up the volume claim and assign to a deploymentConfig.
Create a Persistent Volume
To create a persistent volume (pv), you need to log in as the cluster admin user and
issue the following instruction, replacing $VOLUMENAME, $VOLUMESIZE, and $VOLUME
PATH to reflect your environment—for example, sample settings could be myvolume,
1Gi, and /tmp/myvolume (a complete review of available configuration options can be
found in the documentation):
14 | Chapter 2: Installing the All-In-One OpenShift
$ oc login -u system:admin
$ oc create -f - << EOF!
apiVersion: v1
kind: PersistentVolume
metadata:
name: $VOLUMENAME
spec:
capacity:
storage: $VOLUMESIZE
accessModes:
- ReadWriteOnce
- ReadWriteMany
persistentVolumeReclaimPolicy: Recycle
hostPath:
path: $VOLUMEPATH
EOF!
persistentvolume "myvolume" created
The host path ($VOLUMEPATH) needs to be shared to Docker and
expressed using a POSIX-style path convention. If using Docker for
Mac or Docker for Windows, visit the Docker Preferences to
update the sharing settings. In Windows, $VOLUMEPATH would take
the form C/path/to/directory.
You may be wondering what those “access modes” are. The Kuber‐
netes documentation summarizes this as RWO (ReadWriteOnce),
the volume can be mounted as read-write by a single node; ROX
(ReadOnlyMany), the volume can be mounted read-only by many
nodes; and RWX (ReadWriteMany), the volume can be mounted as
read-write by many nodes.
Set Up the Volume Claim
You can create a persistent volume claim (PVC) and assign it to a deploymentConfig
in a single operation using the oc volume. Assuming you have created an application
called “cotd” inside project “myproject”, then you would issue an instruction similar
to below. Replace $VOLUMECLAIMNAME, $VOLUMECLAIMSIZE, $MOUNTPATH, and $VOLUME
NAME to reflect your environment. Sample settings could be myvolumeclaim, 100Mi,
and /opt/app-root/src/data. Note that in this instance, the $MOUNTPATH denotes the
path inside your container:
$ oc login -u developer -p developer
$ oc project myproject
$ oc volume dc/cotd --add 
--name=images
Working with Storage | 15
Another Random Scribd Document
with Unrelated Content
THE MARRIAGE CHAIR.
In which a bride of the upper classes is carried to her husband’s
home. It is often a very beautiful thing, gorgeous with its embroidery
in silk and colours. People who are not rich enough to have one of
their own can hire them for the occasion. In China large families are
the rule. If a mother dies, the women of the village suckle and bring
up the child between them, and children are not weaned until they
are from three to five years of age. Chinese women are very modest
and kind-hearted, are faithful wives, and, according to their own
notions, good mothers. In Sze Chuan there is no trace of infanticide,
but it is practised in many parts of the Empire.
THE MARRIAGE CHAIR
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
MODE OF CARRYING
CASH AND BABIES.
In travelling, the carriage of money is a great annoyance, owing to
the smallness of its value and the large number of coins or “cash”
necessary to make up an amount of any size. Exchanging eighteen
shillings English for brass cash, the weight of them amounted to
seventy-two pounds, which had to be carried by the coolies. These
cash have a square hole in the middle, and are strung together upon
a piece of straw twist. Should the straw break, the loss of time in
getting up the pieces is much more than the loss of the money. The
Chinese are honest, very keen at a bargain, but when the bargain is
made the Chinaman may be depended on to keep it.
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
MODE OF CARRYING
CASH AND BABIES
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
A PAI-FANG,
OR WIDOW’S ARCH.
These are often very fine structures in stone, wonderfully carved, or
in wood highly decorated. It is not uncommon to enter a town under
quite a succession of them. Very fine ones are often found at the
entrance of very squalid villages. They are erections put up to
honour widows who, faithful to the memory of their husbands, have
remained widows, devoting themselves to good works and to the
service of their parents-in-law, which is the great duty of every good
wife. Permission of the Emperor has to be obtained for their erection.
The various towns and villages take pride in their “widows’ arches.” It
is not uncommon to find a shrine for the burning of incense beside
the arch.
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
A PAI-FANG,
OR WIDOW’S ARCH
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
TWO SOLDIERS OF
SZE CHUAN.
The military are usually dressed in picturesque but unserviceable,
not to say grotesque costumes, the carnation red, beloved of the
Chinese, and blue being the prevailing colours. They carry fans, and
often paper umbrellas. They are ill-trained and indolent, lounging
about the gates of the cities or the streets gambling and smoking.
Their curse is that they have nothing to do.
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
TWO SOLDIERS OF
SZE CHUAN
PDF DevOps with OpenShift 1st Edition Mike Hepburn download
OPIUM CULTURE
ENCROACHING
ON THE RICE LANDS,
SZE CHUAN.
The great system of irrigation at Sze Chuan was intended for the
cultivation of rice only; but the great and terrible growth in the
demand for opium has caused the cultivation of the poppy so to
increase that it is encroaching on the rice lands.
This may be regarded as the saddest and most terrible fact as
regards the future of China.
The use of opium is of comparatively recent date, but the growth and
spreading of the habit has been most rapid.
At the first, both local and government officials did their best to stop it
and to stamp out the culture of the poppy; but although laws were
passed making death the penalty for its cultivation they became a
dead letter, until to-day it is estimated that eighty per cent. of the
men and fifty per cent. of the women, in one or two populous
provinces, are opium smokers. They do not all smoke to excess.
There are moderate smokers as we have our moderate drinkers; but
all through the province of Sze Chuan the opium shops are as thick
as the gin shops in the lower parts of London.
It is not necessary to dilate on the effects of opium when freely
indulged in. They are too well known. China’s only hope is to
emancipate herself from the vice that is eating away her manhood.
But will she be able to do it?
OPIUM CULTURE
ENCROACHING
ON THE RICE LANDS,
SZE CHUAN
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
textbookfull.com

More Related Content

Similar to PDF DevOps with OpenShift 1st Edition Mike Hepburn download (20)

PPTX
Red Hat Openshift Fundamentals.pptx
ssuser18b1c6
 
PPTX
DevOps with OpenShift - Fabien Dupont - ManageIQ Design Summit 2016
ManageIQ
 
ODP
DevOps, PaaS and the Modern Enterprise CloudExpo Europe presentation by Diane...
OpenShift Origin
 
PPTX
CICD with k8s and os
Michael Lehmann
 
PDF
Production Kubernetes: Building Successful Application Platforms 1st Edition ...
isleymonwuka
 
PDF
Successful DevOps implementation for small teams a true story
Jakub Paweł Głazik
 
PDF
The DevOps 2.6 Toolkit: Jenkins X: Cloud-Native Kubernetes-First Continuous D...
comeewidbyph
 
PDF
DevNation Tech Talk: Getting GitOps
Red Hat Developers
 
PDF
Open shift and docker - october,2014
Hojoong Kim
 
PDF
Plataforma DevOps en OpenShift
Juan Carlos García Peláez
 
PPTX
OCP Datacomm RedHat - Kubernetes Launch
PT Datacomm Diangraha
 
PDF
Openshift cheat rhce_r3v1 rhce
Darnette A
 
PPTX
Private Cloud Deployment Automation with XebiaLabs and OpenShift
XebiaLabs
 
PDF
DevOps Engineer Training course online
praveena03290906
 
PDF
DevOps-Engineer-Training-Courses -Online
praveena03290906
 
PDF
DevOps -Engineer-Training-Online-Courses
praveena03290906
 
PDF
Devops -Engineer-Training-Courses-Online
praveena03290906
 
PDF
PDF GitOps Cookbook (Third Early Release) Natale Vinto download
xamysakuchuk
 
ODP
Speed Up Development With OpenShift
plarsen67
 
PDF
OpenShift As A DevOps Platform
Lalatendu Mohanty
 
Red Hat Openshift Fundamentals.pptx
ssuser18b1c6
 
DevOps with OpenShift - Fabien Dupont - ManageIQ Design Summit 2016
ManageIQ
 
DevOps, PaaS and the Modern Enterprise CloudExpo Europe presentation by Diane...
OpenShift Origin
 
CICD with k8s and os
Michael Lehmann
 
Production Kubernetes: Building Successful Application Platforms 1st Edition ...
isleymonwuka
 
Successful DevOps implementation for small teams a true story
Jakub Paweł Głazik
 
The DevOps 2.6 Toolkit: Jenkins X: Cloud-Native Kubernetes-First Continuous D...
comeewidbyph
 
DevNation Tech Talk: Getting GitOps
Red Hat Developers
 
Open shift and docker - october,2014
Hojoong Kim
 
Plataforma DevOps en OpenShift
Juan Carlos García Peláez
 
OCP Datacomm RedHat - Kubernetes Launch
PT Datacomm Diangraha
 
Openshift cheat rhce_r3v1 rhce
Darnette A
 
Private Cloud Deployment Automation with XebiaLabs and OpenShift
XebiaLabs
 
DevOps Engineer Training course online
praveena03290906
 
DevOps-Engineer-Training-Courses -Online
praveena03290906
 
DevOps -Engineer-Training-Online-Courses
praveena03290906
 
Devops -Engineer-Training-Courses-Online
praveena03290906
 
PDF GitOps Cookbook (Third Early Release) Natale Vinto download
xamysakuchuk
 
Speed Up Development With OpenShift
plarsen67
 
OpenShift As A DevOps Platform
Lalatendu Mohanty
 

Recently uploaded (20)

PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Dimensions of Societal Planning in Commonism
StefanMz
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Ad

PDF DevOps with OpenShift 1st Edition Mike Hepburn download

  • 1. Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.com DevOps with OpenShift 1st Edition Mike Hepburn https://textbookfull.com/product/devops-with-openshift-1st- edition-mike-hepburn/ OR CLICK BUTTON DOWNLOAD NOW Explore and download more ebook at https://textbookfull.com
  • 2. Recommended digital products (PDF, EPUB, MOBI) that you can download immediately if you are interested. DevOps with OpenShift Cloud Deployments Made Easy 1st Edition Mike Hepburn https://textbookfull.com/product/devops-with-openshift-cloud- deployments-made-easy-1st-edition-mike-hepburn/ textboxfull.com Cloud Native DevOps with Kubernetes 1st Edition John Arundel https://textbookfull.com/product/cloud-native-devops-with- kubernetes-1st-edition-john-arundel/ textboxfull.com DevOps for Digital Leaders Reignite Business with a Modern DevOps Enabled Software Factory 1st Edition Aruna Ravichandran https://textbookfull.com/product/devops-for-digital-leaders-reignite- business-with-a-modern-devops-enabled-software-factory-1st-edition- aruna-ravichandran/ textboxfull.com Implementing Devops with Microsoft Azure Mitesh Soni https://textbookfull.com/product/implementing-devops-with-microsoft- azure-mitesh-soni/ textboxfull.com
  • 3. Domestic law in international investment arbitration 1st Edition Hepburn https://textbookfull.com/product/domestic-law-in-international- investment-arbitration-1st-edition-hepburn/ textboxfull.com Introduction to DevOps with Chocolate, LEGO and Scrum Game 1st Edition Dana Pylayeva (Auth.) https://textbookfull.com/product/introduction-to-devops-with- chocolate-lego-and-scrum-game-1st-edition-dana-pylayeva-auth/ textboxfull.com Agile Project Management with Azure DevOps: Concepts, Templates, and Metrics 1st Edition Joachim Rossberg https://textbookfull.com/product/agile-project-management-with-azure- devops-concepts-templates-and-metrics-1st-edition-joachim-rossberg/ textboxfull.com DevOps for SharePoint: With Packer, Terraform, Ansible, and Vagrant Oscar Medina https://textbookfull.com/product/devops-for-sharepoint-with-packer- terraform-ansible-and-vagrant-oscar-medina/ textboxfull.com Red Hat and IT Security: With Red Hat Ansible, Red Hat OpenShift, and Red Hat Security Auditing 1st Edition Rithik Chatterjee https://textbookfull.com/product/red-hat-and-it-security-with-red-hat- ansible-red-hat-openshift-and-red-hat-security-auditing-1st-edition- rithik-chatterjee/ textboxfull.com
  • 5. Stefano Picozzi, Mike Hepburn & Noel O'Connor DevOps with OpenShift CLOUD DEPLOYMENTS MADE EASY C o m p l i m e n t s o f
  • 7. Stefano Picozzi, Mike Hepburn, and Noel O’Connor DevOps with OpenShift Cloud Deployments Made Easy Boston Farnham Sebastopol Tokyo Beijing Boston Farnham Sebastopol Tokyo Beijing
  • 8. 978-1-491-97662-3 [LSI] DevOps with OpenShift by Stefano Picozzi, Mike Hepburn, and Noel O’Connor Copyright © 2017 Red Hat, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com/safari). For more information, contact our corporate/insti‐ tutional sales department: 800-998-9938 or [email protected]. Editors: Brian Anderson and Virginia Wilson Production Editor: Nicholas Adams Copyeditor: Jasmine Kwityn Proofreader: Sonia Saruba Indexer: Angela Howard Interior Designer: David Futato Cover Designer: Randy Comer Illustrator: Rebecca Demarest May 2017: First Edition Revision History for the First Edition 2017-04-10: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781491975961 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. DevOps with OpenShift, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
  • 9. Table of Contents Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii 1. Introduction to DevOps with OpenShift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 DevOps 1 Containers 2 Container Orchestration 2 Continuous Integration 2 Continuous Delivery 3 Continuous Deployment 3 Pipelines 3 Software Configuration Management 4 Deployment Patterns 4 Continuous Improvement 5 Summary 5 2. Installing the All-In-One OpenShift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Software Requirements 7 Install OpenShift oc Client Tools 8 Install Docker 9 Launch OpenShift 10 Verify Your Environment 11 Log In Using the Command Line 11 Log In from Console 12 Working with Storage 14 Create a Persistent Volume 14 Set Up the Volume Claim 15 Create a GitHub Account 16 Alternative Form Factors 16 iii
  • 10. Summary 16 3. Deployments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 The Replication Controller 17 Deployment Strategies 18 Rolling 18 Triggers 19 Recreate 21 Custom 22 Lifecycle Hooks 22 Deployment Pod Resources 26 Blue-Green Deployments 27 A/B Deployments 28 Canary Deployments 31 Rollbacks 32 Summary 34 4. Pipelines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Our First Pipeline Example 35 Pipeline Components 38 So What’s Happened Here? Examination of the Pipeline Details 39 Explore Jenkins 41 Multiple Project Pipeline Example 43 Build, Tag, Promote 43 Create Projects 44 Add Role-Based Access Control 45 Deploy Jenkins and Our Pipeline Definition 45 Deploy Our Sample Application 46 Run Our Pipeline Deployment 48 Quickly Deploying a New Branch 50 Managing Image Changes 50 Cascading Pipelines 52 Customizing Jenkins 55 Parallel Build Jobs 57 Summary 58 5. Configuration Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Secrets 59 Secret Creation 60 Using Secrets in Pods 60 Additional Information 63 Configuration Maps 64 iv | Table of Contents
  • 11. Creating Configuration Maps 64 Mounting Configuration Maps as Volumes 64 Mounting the Configuration Map as Environment Variables 65 Environment Variables 67 Adding Environment Variables 67 Removing Environment Variables 67 Change Triggers 68 Labels and Annotations 70 Downward API 70 Handling Large Configuration Data Sets 73 Persistent Volumes 73 Layered Images 73 Summary 74 6. Custom Image Builds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 OpenShift Builds 75 Build Strategies 75 Build Sources 76 Build Configurations 76 Source to Image 79 S2I Process 80 Custom S2I Scripts 81 Custom S2I Builder 81 Builder Image 82 S2I Scripts 83 Adding a New Builder Image 84 Building a Sample Application 84 Troubleshooting 87 Summary 88 7. Application Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Integrated Logging 91 Container Logs Are Transient 92 Aggregated Logging 92 Kibana 94 Some General Aggregated Kibana Queries 95 Simple Metrics 97 Resource Scheduling 99 Quotas 101 Quota Scopes 103 Quota Enforcement 104 Limit Ranges and Requests Versus Limits 104 Table of Contents | v
  • 12. Multiproject Quotas 106 Applications 107 Eviction and Pod Rescheduling 107 Overcommit 108 Auto Pod Scaling 108 Java-Based Application Monitoring and Management Using Jolokia 110 Summary 114 Afterword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 A. OpenShift and 12 Factor Apps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 vi | Table of Contents
  • 13. Preface If you’re old, don’t try to change yourself, change your environment. —B. F. Skinner One view of DevOps is that it helps take on that last mile problem in software: value delivery. The premise is that encouraging behaviors such as teaming, feedback, and experimentation will be reinforced by desirable outcomes such as better software, delivered faster and at lower cost. For many, the DevOps discourse then quickly turns to automation. That makes sense as automation is an environmental intervention that is relatively actionable. If you want to change behavior, change the environment! In this context, automation becomes a significant investment decision with strategic import. DevOps automation engineers face a number of design choices. What level of interface abstraction is appropriate for the automation tooling? Where should you separate automation concerns of an infrastructure nature from those that should be more application centric? These questions matter because automation tooling that is accessible to all can better connect all the participants in the software delivery process. That is going to help fos‐ ter all those positive teaming behaviors we are after. Automation that is decoupled from infrastructure provisioning events makes it possible to quickly tenant new project streams. Users can immediately self-serve without raising a new infrastruc‐ ture requisition. We want to open the innovation process to all, be they 10x programmers or citizen developers. Doing DevOps with OpenShift makes this possible, and this book will show you how. This is a practical guide that will show how to easily implement and automate power‐ ful cloud deployment patterns using OpenShift. The OpenShift container manage‐ ment platform provides a self-service platform for users. Its natively container-aware approach will allow us to show you an application-centric view to automation. vii
  • 14. Who Should Read This Book If you are keen to awaken your inner DevOps then this book is for you. It is intended for programmers who want to learn how to use OpenShift to automate the software delivery process to achieve continuous integration, delivery, and deployment. Note that we deliberately take an application workload-centric view of the problem. Concerns related to the overall management and operation of the OpenShift system will be the subject of a forthcoming title in O’Reilly’s OpenShift series. We will step you through how to develop container-based applications that can be easily and safely changed via pipelines and powerful deployment patterns. Starting with a few simple steps to launch OpenShift as an all-in-one image on your worksta‐ tion, we will cover examples for application environment configuration, persistent volume claims, and A/B, blue-green, and rolling or replacement deployment strate‐ gies. Techniques for third-party tool chain integration using webhooks will be explained and demonstrated. This book builds on the material covered in OpenShift for Developers and so assumes some background knowledge of basic OpenShift development concepts such as: • Developing and deploying an application. • Using application templates. • Managing application workloads. • Working with Docker images. As with the previous title, we also assume you are familiar with basic Linux or Win‐ dows shell commands, and how to install additional software on your computer. The software you install will provide you with a complete working OpenShift environ‐ ment that you can use locally for development or testing. We have used a PHP and a Node.js application for many of the examples in this book. You do not need to be proficient in PHP or Node.js. If you are familiar with any of the popular programming languages you will do just fine. Why We Wrote This Book As Red Hat consultants, we are often called upon to assist clients in the deployment and widespread adoption of OpenShift as their container management platform. They are drawn to OpenShift as a technology enabler for increased agility and responsiveness. In this context, change-ability can be the most critical of nonfunc‐ tional requirements. Continuous improvement needs continuous user feedback. We have found that the ability to push, test, and then roll forward or roll back small application changes to live users can become critical to realizing such benefits. In this viii | Preface
  • 15. book we want to help you implement DevOps practices using OpenShift so that you can quickly deliver quality applications that will make a difference for your users. Online Resources In this book you will install a self-contained OpenShift environment based on Open‐ Shift Origin. This is the upstream open source version of OpenShift on which Red Hat’s OpenShift Container Platform, OpenShift Dedicated, and OpenShift Online products are based. Various options are available to stand up a self-contained environment. For this book, we will focus on the oc cluster up technique that starts up a local all-in-one cluster based on OpenShift Origin. Alternative approaches are available, such as the Vagrant all-in-one virtual machine described at the OpenShift Origin site. This procedure was covered in OpenShift for Developers and so is not repeated in detail here. OpenShift Origin will always include all the latest features, with support being pro‐ vided by the OpenShift community. The OpenShift product releases are created as a regular snapshot of the OpenShift Origin project. The product releases do not always have the very latest features, but if you have a commercial Red Hat subscription, the product releases include support from Red Hat. If you would like to try out the OpenShift Container Platform version, a couple of options are available. The first is to register for a Red Hat Developers account. The Red Hat Developer Pro‐ gram allows you to access versions of Red Hat products for personal use on your own computer. One of the products made available through the program is the Red Hat Container Development Kit. This includes a version of OpenShift that you can install on your own computer, but which is based on OpenShift Container Platform rather than OpenShift Origin. A second way of trying out OpenShift Container Platform is via the Amazon Web Services (AWS) Test Drive program. This will set you up an OpenShift environment running across a multinode cluster on AWS. Take a look at more in-depth documentation on OpenShift and how to use it at the OpenShift documentation site. Check out the OpenShift blog, where regular articles are published on OpenShift. If you want to hear about how others in the OpenShift community are using Open‐ Shift, or wish to share your own experiences, you can join the OpenShift Commons. Preface | ix
  • 16. If you have questions or issues, you can reach the OpenShift team through Stack Overflow, on Twitter (@openshift), or in the #openshift channel on IRC’s FreeNode network. Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width Used for program listings, as well as within paragraphs to refer to program ele‐ ments such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width bold Shows commands or other text that should be typed literally by the user. Constant width italic Shows text that should be replaced with user-supplied values or by values deter‐ mined by context. This element signifies a tip or suggestion. This element signifies a general note. This element indicates a warning or caution. Using Code Examples Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/devops-with-openshift. x | Preface
  • 17. This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a signifi‐ cant amount of example code from this book into your product’s documentation does require permission. We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “DevOps with OpenShift by Stefano Picozzi, Mike Hepburn, and Noel O’Connor (O’Reilly). Copyright 2017 Red Hat, Inc., 978-1-491-97662-3.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at [email protected]. O’Reilly Safari Safari (formerly Safari Books Online) is a membership-based training and reference platform for enterprise, government, educators, and individuals. Members have access to thousands of books, training videos, Learning Paths, interac‐ tive tutorials, and curated playlists from over 250 publishers, including O’Reilly Media, Harvard Business Review, Prentice Hall Professional, Addison-Wesley Profes‐ sional, Microsoft Press, Sams, Que, Peachpit Press, Adobe, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, and Course Technology, among others. For more information, please visit http://oreilly.com/safari. How to Contact Us Please address comments and questions concerning this book to the publisher: O’Reilly Media, Inc. 1005 Gravenstein Highway North Sebastopol, CA 95472 800-998-9938 (in the United States or Canada) 707-829-0515 (international or local) Preface | xi
  • 18. 707-829-0104 (fax) To comment or ask technical questions about this book, send email to bookques‐ [email protected]. For more information about our books, courses, conferences, and news, see our web‐ site at http://www.oreilly.com. Find us on Facebook: http://facebook.com/oreilly Follow us on Twitter: http://twitter.com/oreillymedia Watch us on YouTube: http://www.youtube.com/oreillymedia Acknowledgments Stefano It’s a privilege to contribute to a book such as this. For this, I am grateful to my family and Red Hat for allowing me to indulge in those private, quiet moments it takes to then get it done! I also appreciate the many clients who have taken the time to share their aspirations and challenges with me. Software process improvement is hard. All the insights and suggestions presented here originate there. Mike One of my favorite quotes related to content creation is this one from Harry S. Tru‐ man: “It is amazing what you can accomplish if you do not care who gets the credit.” It is with this humility that I wish to acknowledge all of the fantastic work from the OpenShift community that has provided ideas that have gone into this book. You Rock. Noel Writing this book has been a whole heap of fun and I’m grateful to Stefano and Mike for inviting me to participate in this project. I’d also like to thank my wife and chil‐ dren for their patience and support while writing this book. The true power of this platform is in its open source foundations and the multitude of perspectives and opinions that only a diverse open community can bring. Thanks also to all those involved in the internal Red Hat teams who develop, productize, test, document, and support this platform. xii | Preface
  • 19. CHAPTER 1 Introduction to DevOps with OpenShift This book provides a practical guide for using OpenShift as an enablement technol‐ ogy for DevOps. OpenShift’s combination of container management platform with natively container-aware automation can bring those Developer and Operations con‐ stituencies together in ways not previously possible. This enables software work products to present themselves in a standardized form to your preferred continuous integration and delivery tool chains. Container awareness makes it possible to leverage deployment strategies and quality of service characteristics honored by the container management platform and under‐ lying orchestration engine. We can start thinking in terms of containers-as-code rather than infrastructure-as-code. So to get started, let’s review some key DevOps concepts as interpreted with a container-centric viewpoint. DevOps DevOps is concerned with aligning the constituents in the software delivery process to a common goal of value delivery—and it’s not just Developers and Operators, but InfoSec and Quality Assurance functions and more. Recognize that wealth is created when the work product is valued by actors external to the production system. Value delivery outcomes are measured by metrics tied to production delivery velocity, qual‐ ity, and waste. DevOps emphasizes behavioral- or cultural-related changes such as those which encourage teaming, inclusion, feedback, and experimentation. Techno‐ logical interventions such as automation are central as they can reinforce such target behaviors. DevOps does not necessarily imply functional roles in software delivery such as development, quality assurance, or operations are merged or seconded. More 1
  • 20. important is that a professional respect and shared sensibility is formed across the delivery team. Containers Containers are the runtime representation of a packaging format based on a light‐ weight, immutable image. Runtime dependencies are resolved within the image which facilitates portability. This makes possible the agreement on a standardized software work product. Management and runtime tooling that is container aware can then be applied consistently no matter what the underlying technology stack. Container-based workloads are suitable for multi-tenancy on a single compute instance and when implemented securely can realize significant operation efficien‐ cies. An important corollary is that launching a new workload does not incur the cost of provisioning new compute infrastructure. This enables a true on-demand, self- service experience for users. Container Orchestration Container orchestration involves the lifecycle management of container workloads, including functions such as to schedule, stop, start, and replicate across a cluster of machines. Compute resources for running workloads are abstracted, allowing the host infrastructure to be treated as a single logical deployment target. Kubernetes is an open source community project addressing container orchestration. It groups containers that make up an application into logical units for easy management and discovery, and features self-healing, service discovery, load balancing, and storage services among its rich feature set. Orchestration plays a critical role in our design goal of application-centricity as quality of service attributes and deployment patterns are executed by invoking Kubernetes API primitives. Continuous Integration Continuous integration (CI) concerns the integration of code from potentially multi‐ ple authors into a shared source code management (SCM) repository. Such check-ins could occur many times a day, and automation steps in such a process could include gates or controls to expose any issues as early as possible. SCMs such as Git include workflow support to commit to trunk, push, and merge code pull requests from multiple developers. With containers, a Git push event could be configured to then trigger an image build event via the webhooks mechanism. 2 | Chapter 1: Introduction to DevOps with OpenShift
  • 21. Continuous Delivery Once a CI strategy is in place, consideration can then move to achieving continuous delivery (CD). This involves automating the steps required to promote the work product from one environment to the next within the defined software development lifecycle (SDLC). Such steps could include automated testing, smoke, unit, functional, and static code analysis and static dependency checks for known security vulnerabili‐ ties. With containers, promotion in later stages of the SLC may merely involve the tagging of the (immutable) image to mark acceptance. Binary promotions are also possible such that only the image is pushed (to the target registry of the new environ‐ ment), leaving source code in situ. Continuous Deployment By convention, we can denote the special case of automated continuous delivery to production as continuous deployment (CD). We make such a distinction because such deployments may be subject to additional governance processes and gates—for exam‐ ple, deliberate human intervention to manage risk and complete sign-off procedures. We make such a distinction because such deployments may be subject to additional governance processes. As per Figure 1-1, there may be scenarios for deliberate human intervention to manage risk and complete sign-off procedures. Figure 1-1. Continuous delivery versus deployment Pipelines Pipelines are a representation of the flow/automation in a CI/CD process. Typically a pipeline might call out discrete steps in the software delivery process and present them visually or via a high-level scripting language so the flow can be manipulated. Continuous Delivery | 3
  • 22. The steps might include build, unit tests, acceptance tests, packaging, documentation, reporting, and deployment and verification phases. Well-designed pipelines help deliver better quality code faster by enabling participants in the software delivery process to more easily diagnose and respond to feedback. As illustrated in Figure 1-2, diagnosis and response turnaround can be accelerated by organizing releases into smaller and more frequent release bundles. Figure 1-2. Smaller releases, release often, faster feedback Software Configuration Management For our purposes we will take a narrower view of software configuration management (CM) and focus on the recommended software engineering practice of separating dynamic configuration from static runtime software. Doing so allows developers and operations engineers to change the configuration without having to rebuild the run‐ time such as might occur when deploying to different environments. Containers, based as they are on immutable images, amplify this behavior as the alternative would be configuration layered across multiple images for each deployment scenario. Deployment Patterns Aligned with the goal of automation across all steps in the software delivery lifecycle are patterns for deployment. We look here for strategies that can balance across crite‐ ria including safety, testability, reversibility, and downtime minimization in cloud- scale scenarios. Some deployment patterns also offer opportunities for capturing and 4 | Chapter 1: Introduction to DevOps with OpenShift
  • 23. responding to feedback. An A/B deployment allows for testing a user-defined hypothesis such as whether application version A is more effective than B. Usage results can then drive weighted load balancing across the alternatives. Automation of deployment strategies in this DevOps world are implemented by driving the orches‐ tration APIs. Continuous Improvement Let’s conclude this chapter by covering continuous improvement (Figure 1-3), which should be the thread that connects all of the process improvement–related practices summarized. The environment changes and so must we. These practices make it easy and inexpensive to experiment, formulate, and test hypotheses, as well as capture, act on, and experiment with the feedback received. This way we can continue to inject energy into the system and so maintain a state of dynamic stability—a balance of adaptive/agile versus fixed/stable. Figure 1-3. Continuous improvement Summary We covered here some of what is unique and nuanced about DevOps with OpenShift and why it matters. Realizing these DevOps concepts using natively container-aware automation can bring cloud deployment power to all the people, from 10x program‐ mer to citizen developer. The following chapters will show you how. Continuous Improvement | 5
  • 25. CHAPTER 2 Installing the All-In-One OpenShift The same OpenShift codebase can take on many form factors. It can be a large public cloud deployment, offered as a managed service, a private instance in your company’s data center, or as small as a local installation on your own workstation. This makes for a very convenient platform for evaluating, learning, and testing OpenShift-based workloads. Skills developed on a local instance are transferable to more complex dis‐ tributed topologies. The easiest way to get started is to visit the OpenShift website and register for a free developer account. This will suffice for many of the examples covered in this book. Once registered, you can log in and you are good to go! Another option is to use a local OpenShift all-in-one cluster on your own worksta‐ tion. This is a fully functioning OpenShift instance with an integrated Docker regis‐ try, OpenShift master, and node. It can support both the upstream OpenShift Origin and OpenShift Container Platform versions. The aim of this feature is to allow web developers and other interested parties to run OpenShift V3 on their own computer. The cluster will be routable from your local system so you can treat it like a hosted version of OpenShift and can view the URLs you create. As your own private instance, you can create as many projects as you like, push and pull to your registry, create local persistent volumes, and have cluster admin access. Here we will document building this using the oc cluster up command. Software Requirements The oc cluster up command starts a local OpenShift all-in-one cluster with a con‐ figured registry, router, image streams, and default templates. By default, the com‐ mand requires a working Docker connection. However, if running in an environment with Docker Machine installed, it can create a Docker machine for you. 7
  • 26. The oc cluster up command will create a default user and project, and once it com‐ pletes will allow you to start using the command line to create and deploy apps with commands like oc new-app, oc new-build, and oc run. It will also print out a URL to access the management console for your cluster. So let’s get started. We are going to install the latest OpenShift client tools, install Docker, and then start a local cluster instance. The all-in-one cluster uses xip.io to provide DNS resolution with application URLs. The advantage of this is that you actually get routable URLs to your local machine without browser or separate DNS configuration steps. The drawback is that you need to be online whenever you use the cluster and xip.io may be blocked by your company’s firewalls. Verify xip.io accessibility using a com‐ mand such as nslookup and check that it can return an address in the non-authoritative answer section: $ nslookup x.127.0.0.1.xip.io Server: 61.9.195.193 Address: 61.9.195.193#53 Non-authoritative answer: Name: x.127.0.0.1.xip.io Address: 127.0.0.1 Install OpenShift oc Client Tools OpenShift 3 allows you to work using a command-line interface (CLI), web console, or via the Eclipse IDE using the latest JBoss tools. The CLI tool is known as oc and is what we will use in most cases. It’s a single Go executable, so installation is simply a matter of downloading the tool and adding it to your PATH. Choose the latest, stable release from https://github.com/openshift/origin/releases, select the download that matches your operating system environment, update your PATH, and you are good to go. For example, if I extracted the contents to the CLI directory in my home directory, I would issue the following command in both Linux and macOS to update the PATH and then verify success: $ export PATH=$PATH:~/cli/ $ oc version oc v1.4.1+3f9807a kubernetes v1.4.0+776c994 features: Basic-Auth Server https://127.0.0.1:8443 8 | Chapter 2: Installing the All-In-One OpenShift
  • 27. openshift v1.4.0-rc1+b4e0954 kubernetes v1.4.0+776c994 What version of OpenShift is that? The output from the oc version command indicates that we have downloaded v1.4.1 of the OpenShift Origin client tools. This means that when we come to launch our local instance using oc cluster up, v1.4.1 of Open‐ Shift Origin distribution will be pulled down. For Windows users, the specific details for updating your PATH varies slightly between releases. Using Windows 10, right-click the bottom lefthand corner to raise the Power User task menu, then click System, Advanced System Settings, and finally, select Environment Variables. Once the dialog opens, select the Path variable and add “;C:CLI” at the end (ensure you replace “C:CLI” with the location of where you extracted the tool). You could also just copy it to C:Windows or a directory you know is already on your path. Install Docker The oc cluster up command looks for a working Docker connection. The installa‐ tion and configuration instructions for Linux, macOS, and Windows environments are covered in the documentation website for Local Cluster Management. Refer to the website for configuration instructions for your environment, but take note of the requirement to configure for an insecure registry parameter of 172.30.0.0/16 in each case. If using Docker for Mac or Docker for Windows, you configure this setting from the Preferences GUI. Once installed, verify Docker is functioning before pro‐ ceeding. For this book, Docker version 1.13.0 was used. Note that if you will be attempting more memory-intensive use cases, increase the assigned memory for Docker: $ docker version Client: Version: 1.13.0 API version: 1.25 ... $ docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 78445dd45222: Pull complete Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. ... Software Requirements | 9
  • 28. Docker for Windows is available for Windows 10 and Windows Server 2016. If you are running earlier versions, then go for the Vagrant self-contained OpenShift. Launch OpenShift With Docker and the oc tools installed and verified, we are ready to launch Open‐ Shift! The oc cluster command accepts various switches, but two we will take spe‐ cial note of are the host-data-dir and host-config-dir parameters. These allow you to specify a location for storing OpenShift cluster system state. Doing so enables you to set up named “profiles” for separate cluster instances within the same worksta‐ tion that you can return to later. For the first invocation do something like below, replacing $HOME to reflect your environment and $PROFILE to, for example, “DevOps‐ WithOpenShift”. This first attempt may take a few minutes as it downloads the Open‐ Shift distribution. Make note of the URL for the server as we will be referring to that later. $ oc cluster up --host-data-dir='$HOME/oc/profiles/$PROFILE/data' --host-config-dir='$HOME/oc/profiles/$PROFILE/config' -- Checking OpenShift client ... OK -- Checking Docker client ... OK -- Checking Docker version ... OK -- Checking for existing OpenShift container ... OK -- Checking for openshift/origin:v1.4.1 image ... Pulling image openshift/origin:v1.4.1 Pulled 1/3 layers, 41% complete Pulled 2/3 layers, 76% complete Pulled 3/3 layers, 100% complete Extracting Image pull complete ... -- Server Information ... OpenShift server started. The server is accessible via web console at: https://192.168.99.100:8443 You are logged in as: User: developer Password: developer To login as administrator: oc login -u system:admin The profile feature described is available when using a native Docker service (e.g., Docker for Mac or Docker for Windows). Environments using Docker Toolbox 10 | Chapter 2: Installing the All-In-One OpenShift
  • 29. would pass the --create-machine switch instead at first-time launch in order to cre‐ ate a Docker virtual machine driver. By default, oc cluster up will pull down from the upstream OpenShift Origin repository, v1.4.1 in this case. To point to a spe‐ cific enterprise image, and version, add the --image and --version switches to the cluster up invocation. For example, adding --image=registry.access.redhat.com/openshift3/ose and --version=v3.4 will launch using OpenShift Container Platform V3.4. Windows users can launch the equivalent instruction on Power‐ Shell, albeit using the ^ character for command-line continuation. Linux and macOS users can also consider passing an additional parameter --public-hostname=127.0.0.1 to ensure an OpenShift server on 127.0.0.1:8443. Now let’s restart the OpenShift cluster using the use-existing-config parameter and point to the saved named profile: $ oc cluster down $ oc cluster up --host-data-dir='$HOME/oc/profiles/$PROFILE/data' --host-config-dir='$HOME/oc/profiles/$PROFILE/config' --use-existing-config ... The oc cluster command supports many switches. There are var‐ ious open source projects that have built convenience wrappers and tools to simplfy usage. Some of these include Minishift and oc- cluster-wrapper. Verify Your Environment Let’s now check that we are good to go by logging in using the CLI. We will then ver‐ ify our installation by creating an application. Log In Using the Command Line $ oc login -u developer -p developer Login successful. You have one project on this server: "myproject" Verify Your Environment | 11
  • 30. Using project "myproject". $ oc project myproject Already on project "myproject" on server "https://127.0.0.1:8443". $ oc new-app --name='cotd' --labels name='cotd' php~https://github.com/devops- with-openshift/cotd.git -e SELECTOR=cats --> Found image 1875070 (10 days old) in image stream "openshift/php" under tag "5.6" for "php" Apache 2.4 with PHP 5.6 ----------------------- Platform for building and running PHP 5.6 applications Tags: builder, php, php56, rh-php56 * A source build using source code from https://github.com/devops-with- openshift/cotd.git will be created * The resulting image will be pushed to image stream "cotd:latest" * Use 'start-build' to trigger a new build * This image will be deployed in deployment config "cotd" * Port 8080/tcp will be load balanced by service "cotd" * Other containers can access this service through the hostname "cotd" --> Creating resources with label name=cotd ... imagestream "cotd" created buildconfig "cotd" created deploymentconfig "cotd" created service "cotd" created --> Success Build scheduled, use 'oc logs -f bc/cotd' to track its progress. Run 'oc status' to view your app. $ oc expose service cotd route "cotd" exposed Windows users with Docker for Windows installed should invoke the cluster up and cluster down command from PowerShell. Some of the labs to follow may describe Linux/Bash-style command-line operations. Windows users can reproduce such instructions using Bash for Windows or an equivalent. Log In from Console The console can be accessed using the OpenShift server console URL as displayed during the launch output (https://127.0.0.1:8443/console/). Log in using “developer” as the username and “developer” as the password. Then visit “My Project” to check the application you just created using the CLI (Figure 2-1). 12 | Chapter 2: Installing the All-In-One OpenShift
  • 31. Figure 2-1. My project with COTD application Click the route link as displayed in your console—for example, http://cotd-myproject. 127.0.0.1.xip.io. If all is functioning correctly you should see something like Figure 2-2. While you are test-driving your brand-new, all-in-one cluster, why not check out the profile feature? Just shut down your running cluster and restart using a different profile name. Then toggle between the different profiles to verify system state is preserved within each profile, and restart. System configuration for each pro‐ file will be located as specified in your --host-data-dir and --host-config-dir launch runtime switches. Verify Your Environment | 13
  • 32. Figure 2-2. Cats! Working with Storage For some of the labs to follow you may wish to attach storage to your container run‐ ning in your local cluster instance. The approach described is valid for a cluster instance launched using a native Docker service (i.e., not using the --create- machine switch). To do so using the oc CLI, follow these steps: 1. Create a persistent volume (pv). 2. Set up the volume claim and assign to a deploymentConfig. Create a Persistent Volume To create a persistent volume (pv), you need to log in as the cluster admin user and issue the following instruction, replacing $VOLUMENAME, $VOLUMESIZE, and $VOLUME PATH to reflect your environment—for example, sample settings could be myvolume, 1Gi, and /tmp/myvolume (a complete review of available configuration options can be found in the documentation): 14 | Chapter 2: Installing the All-In-One OpenShift
  • 33. $ oc login -u system:admin $ oc create -f - << EOF! apiVersion: v1 kind: PersistentVolume metadata: name: $VOLUMENAME spec: capacity: storage: $VOLUMESIZE accessModes: - ReadWriteOnce - ReadWriteMany persistentVolumeReclaimPolicy: Recycle hostPath: path: $VOLUMEPATH EOF! persistentvolume "myvolume" created The host path ($VOLUMEPATH) needs to be shared to Docker and expressed using a POSIX-style path convention. If using Docker for Mac or Docker for Windows, visit the Docker Preferences to update the sharing settings. In Windows, $VOLUMEPATH would take the form C/path/to/directory. You may be wondering what those “access modes” are. The Kuber‐ netes documentation summarizes this as RWO (ReadWriteOnce), the volume can be mounted as read-write by a single node; ROX (ReadOnlyMany), the volume can be mounted read-only by many nodes; and RWX (ReadWriteMany), the volume can be mounted as read-write by many nodes. Set Up the Volume Claim You can create a persistent volume claim (PVC) and assign it to a deploymentConfig in a single operation using the oc volume. Assuming you have created an application called “cotd” inside project “myproject”, then you would issue an instruction similar to below. Replace $VOLUMECLAIMNAME, $VOLUMECLAIMSIZE, $MOUNTPATH, and $VOLUME NAME to reflect your environment. Sample settings could be myvolumeclaim, 100Mi, and /opt/app-root/src/data. Note that in this instance, the $MOUNTPATH denotes the path inside your container: $ oc login -u developer -p developer $ oc project myproject $ oc volume dc/cotd --add --name=images Working with Storage | 15
  • 34. Another Random Scribd Document with Unrelated Content
  • 35. THE MARRIAGE CHAIR. In which a bride of the upper classes is carried to her husband’s home. It is often a very beautiful thing, gorgeous with its embroidery in silk and colours. People who are not rich enough to have one of their own can hire them for the occasion. In China large families are the rule. If a mother dies, the women of the village suckle and bring up the child between them, and children are not weaned until they are from three to five years of age. Chinese women are very modest and kind-hearted, are faithful wives, and, according to their own notions, good mothers. In Sze Chuan there is no trace of infanticide, but it is practised in many parts of the Empire.
  • 38. MODE OF CARRYING CASH AND BABIES. In travelling, the carriage of money is a great annoyance, owing to the smallness of its value and the large number of coins or “cash” necessary to make up an amount of any size. Exchanging eighteen shillings English for brass cash, the weight of them amounted to seventy-two pounds, which had to be carried by the coolies. These cash have a square hole in the middle, and are strung together upon a piece of straw twist. Should the straw break, the loss of time in getting up the pieces is much more than the loss of the money. The Chinese are honest, very keen at a bargain, but when the bargain is made the Chinaman may be depended on to keep it.
  • 41. MODE OF CARRYING CASH AND BABIES
  • 43. A PAI-FANG, OR WIDOW’S ARCH. These are often very fine structures in stone, wonderfully carved, or in wood highly decorated. It is not uncommon to enter a town under quite a succession of them. Very fine ones are often found at the entrance of very squalid villages. They are erections put up to honour widows who, faithful to the memory of their husbands, have remained widows, devoting themselves to good works and to the service of their parents-in-law, which is the great duty of every good wife. Permission of the Emperor has to be obtained for their erection. The various towns and villages take pride in their “widows’ arches.” It is not uncommon to find a shrine for the burning of incense beside the arch.
  • 48. TWO SOLDIERS OF SZE CHUAN. The military are usually dressed in picturesque but unserviceable, not to say grotesque costumes, the carnation red, beloved of the Chinese, and blue being the prevailing colours. They carry fans, and often paper umbrellas. They are ill-trained and indolent, lounging about the gates of the cities or the streets gambling and smoking. Their curse is that they have nothing to do.
  • 53. OPIUM CULTURE ENCROACHING ON THE RICE LANDS, SZE CHUAN. The great system of irrigation at Sze Chuan was intended for the cultivation of rice only; but the great and terrible growth in the demand for opium has caused the cultivation of the poppy so to increase that it is encroaching on the rice lands. This may be regarded as the saddest and most terrible fact as regards the future of China. The use of opium is of comparatively recent date, but the growth and spreading of the habit has been most rapid. At the first, both local and government officials did their best to stop it and to stamp out the culture of the poppy; but although laws were passed making death the penalty for its cultivation they became a dead letter, until to-day it is estimated that eighty per cent. of the men and fifty per cent. of the women, in one or two populous provinces, are opium smokers. They do not all smoke to excess. There are moderate smokers as we have our moderate drinkers; but all through the province of Sze Chuan the opium shops are as thick as the gin shops in the lower parts of London. It is not necessary to dilate on the effects of opium when freely indulged in. They are too well known. China’s only hope is to emancipate herself from the vice that is eating away her manhood. But will she be able to do it?
  • 54. OPIUM CULTURE ENCROACHING ON THE RICE LANDS, SZE CHUAN
  • 55. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! textbookfull.com