OpenShift for Developers
by Joshua Wood and Brian Tannous
Copyright 2021 OReilly Media. 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). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com .
- Acquisitions Editor: Suzanne McQuade
- Development Editor: Nicole Tach
- Production Editor: Katherine Tozer
- Copyeditor: Audrey Doyle
- Proofreader: Piper Editorial Consulting, LLC
- Indexer: Potomac Indexing, LLC
- Interior Designer: David Futato
- Cover Designer: Karen Montgomery
- Illustrator: Kate Dullea
- September 2021: Second Edition
Revision History for the Second Edition
- 2021-09-02: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781098103361 for release details.
The OReilly logo is a registered trademark of OReilly Media, Inc. OpenShift for Developers, the cover image, and related trade dress are trademarks of OReilly Media, Inc.
The views expressed in this work are those of the authors, and do not represent the publishers views. 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.
This work is part of a collaboration between OReilly and Red Hat. See our statement of editorial independence.
978-1-098-10336-1
[LSI]
Dedication
To Randy Wood
Joshua
To Skeeter
Brian
Preface
Software serves more people more critically than ever before. These two demands are generalized as scale and reliability. Over the past decade, the software industry has pursued scale and reliability with tactics, infrastructure, and cultural initiatives like DevOps, which sees developers share the operational responsibility of keeping applications running.
One set of tactics is the automation of operations chores: writing software to run your software. The automation of repetitive toil is among the keystones of Site Reliability Engineering (SRE), an IT discipline defined by the OReilly title of the same name. DevOps and its younger cousin GitOps both apply SREs automation ideas to development machinery and to the practice of building software. The simplest form might be the triggering of automatic construction and deployment processes whenever an applications source code changes.
Modern software infrastructure pursues scale and reliability through distributed computing. Despite all the syllables, distributed computing just means making many computers act like one big computer. The assembled system can do more work (scale), and it can cast understudies for potential points of failure (reliability).
Kubernetes is a system for managing applications on distributed computers by encapsulating them in discrete, interchangeable artifacts called containers. Kubernetes can manage where and when containers run without knowing all about them and their dependencies. Kubernetes is termed a container orchestrator.
OpenShift uses Kubernetes orchestration at its core to harness computers together into a cluster. The computers that form the cluster are called nodes. OpenShift defines how those nodes relate and how work is performed on them. By packaging core distributed computing primitives with tools, policies, and interfaces for using them, OpenShift helps teams adopt modern practices from DevOps and GitOps and automate repetitive processes according to SRE precepts.
Who This Book Is For
If youre an application developer familiar with data structures and functions and how to build them into programs, but youre new to containers, Kubernetes, and application platforms, this guide to OpenShift is for you. It will show you how to use OpenShift to build, deploy, scale, and manage your software, and how you can automate those chores with OpenShift features such as build triggers, pipelines, and demand-driven autoscaling. You dont need to have used Kubernetes or OpenShift before.
What You Will Learn
This book explains what OpenShift is and how to use it to build your applications, run them, and keep them running through changing demand, failure recovery, and a continuous stream of new releases as you iterate on their source code with new fixes and features.
Chapters introduce OpenShift, its components, and its concepts.
shows you how to run OpenShift on your computer so that you have a virtual cluster to conduct the books exercises.
In , youll configure OpenShift to fetch the source code for a simple Hello World application, build it into a container image, and run it.
introduces OpenShift Pipelines, a framework for composing Continuous Integration and Continuous Deployment (CI/CD) routines, and shows you how to add Pipelines to your cluster.
In , youll deploy a more realistic application with a tiered architecture and multiple components.
In , youll augment the applications backend to retain data between sessions .
shows you how to examine, manipulate, and scale the running application both manually and automatically, how to set up OpenShift to periodically check application health, and how to govern the rollout of new versions of your application.
is a high-level overview of OpenShifts monitoring and alerting facilities .
dissects OpenShift automation features you used along the way to set you on the path toward eliminating toil by letting the platform do the repetitive work.
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
BoldShows commands or other text that should be typed literally by the user.
Tip
This element signifies a tip or suggestion.
Note
This element signifies a general note.
Warning
This element indicates a warning or caution.
Using Code Examples
Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/openshift-for-developers.
If you have a technical question or a problem using the code examples, please send email to .
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 youre 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 examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission.