DevOps with OpenShift
by Stefano Picozzi , Mike Hepburn , and Noel OConnor
Copyright 2017 Red Hat, Inc. All rights reserved.
Printed in the United States of America.
Published by OReilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.
OReilly 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/institutional 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
Revision History for the First Edition
- 2017-07-07: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781491975961 for release details.
The OReilly logo is a registered trademark of OReilly Media, Inc. DevOps with OpenShift, the cover image, and related trade dress are trademarks of OReilly 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.
978-1-491-97596-1
[LSI]
Preface
If youre old, dont 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 foster 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 infrastructure 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 powerful cloud deployment patterns using OpenShift. The OpenShift container management 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.
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 OReillys 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 workstation, we will cover examples for application environment configuration, persistent volume claims, and A/B, blue-green, and rolling or replacement deployment strategies. 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 Windows shell commands, and how to install additional software on your computer. The software you install will provide you with a complete working OpenShift environment 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 nonfunctional 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 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 OpenShift Origin. This is the upstream open source version of OpenShift on which Red Hats 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 provided 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.