Summary of “OpenShift for Developers: A Guide for Impatient Beginners” by Joshua Wood, Brian Tannous (2021)

Summary of

Technology and Digital TransformationCloud Computing

Title: OpenShift for Developers: A Guide for Impatient Beginners
Authors: Joshua Wood, Brian Tannous
Year: 2021
Category: Cloud Computing


Introduction

“OpenShift for Developers: A Guide for Impatient Beginners” by Joshua Wood and Brian Tannous is a comprehensive primer designed to ease developers into the world of OpenShift, a leading Kubernetes platform. The book demystifies the complexities of using containers and Kubernetes by providing step-by-step guides, practical examples, and hands-on scenarios to make cloud-native development accessible and actionable. This summary distills the essential takeaways and actionable advice provided throughout the text.

Chapter 1: Getting Started

The book begins with an introduction to OpenShift’s basic concepts and architecture. It explains the need for containers, Kubernetes, and how OpenShift simplifies container orchestration.

Key Points:
Containers: Containers encapsulate an application and its dependencies so that it can run consistently across multiple computing environments.
Kubernetes: An open-source platform designed to automate deploying, scaling, and operating application containers.
OpenShift: A Kubernetes-based platform that enhances Kubernetes with developer-friendly features and enterprise-level capabilities.

Actionable Advice:
Install OpenShift Local (CRC): Developers should start by installing OpenShift Local (CodeReady Containers) on their local machine, which provides a minimal OpenShift 4 cluster.
Example: Download CRC from the official OpenShift website and follow the setup instructions to create a development-focused OpenShift cluster on your local machine.

Chapter 2: OpenShift Basics

This chapter goes deeper into the OpenShift web console and CLI, covering the essential tools and commands needed to interact with OpenShift clusters.

Key Points:
OpenShift Web Console: A graphical interface for managing applications and cluster operations.
OC CLI: The command-line interface for administrators and developers to interact with OpenShift.

Actionable Advice:
Web Console Tour: Spend time familiarizing yourself with the various sections of the OpenShift web console, such as the Developer and Administrator views.
Example: Navigate to the OpenShift console URL provided upon CRC installation and explore sections like ‘Topology View,’ which visualizes deployed applications.

Chapter 3: Creating and Deploying Applications

A core focus of OpenShift, this chapter explains how to create applications using Source-to-Image (S2I), deploy existing images, and manage them through OpenShift.

Key Points:
Source-to-Image (S2I): A tool for building reproducible container images directly from source code.
Deployment Configurations (DC): Configurations that define the deployment process for applications in OpenShift.
BuildConfig: OpenShift resource that defines the build process.

Actionable Advice:
Deploy Sample App with S2I:
Example: Use the OpenShift web console to create a new application by pointing to a GitHub repository. Select ‘Source to Image’ to automatically build an image from the source code.
Example: oc new-app https://github.com/sclorg/nodejs-ex.git to create a new Node.js app from a Git repo using the OC CLI.

Chapter 4: Managing and Scaling Applications

This chapter stresses how OpenShift can manage application lifecycles, including scaling, updates, and rollbacks.

Key Points:
Scaling: Increasing or decreasing the number of pod replicas to handle load.
Rolling Updates: Updating an application with zero downtime.
Rollbacks: Reverting to a previous deployment state.

Actionable Advice:
Scale an Application: Use the web console or OC CLI to scale application replicas up or down based on traffic.
Example: In the web console, select your application and adjust the ‘Pods’ slider to change the replica count.
Perform Rolling Updates: Update a deployment without downtime by providing a new image version.
Example: oc set image dc/sample-app sample-app=myrepo/myimage:v2 to update the deployment configuration with a new image version.

Chapter 5: OpenShift Builds

This section explains the build process in OpenShift, including different build strategies and how to automate builds.

Key Points:
Build Strategies: S2I, Docker, and Custom are the main strategies supported by OpenShift.
Triggering Builds: Automatize build triggers using webhooks, image change triggers, or configuration change triggers.

Actionable Advice:
Automate Builds with Webhooks: Connect a GitHub repository to trigger OpenShift builds on code commits.
Example: Create a webhook in your GitHub repo and connect it to your OpenShift build config to auto-trigger builds on code pushes.

Chapter 6: Services, Routes, and Networking

Handling internal and external communication for containerized applications, this chapter delves into OpenShift services, routes, and networking.

Key Points:
Services: Objects that expose a set of pods as a network service inside the cluster.
Routes: Resources that expose services to the external world via HTTP/HTTPS.
Network Policies: Control the flow of traffic between pods and services.

Actionable Advice:
Create a Route for External Access:
Example: Use the web console to create a route that exposes your service. Navigate to the ‘Routes’ section and create a new route binding it to your service.
Example: oc expose svc/my-service to create a route using the OC CLI.
Implement Network Policies: Define policies to restrict and manage pod communication.
Example: Create a network policy YAML file that only allows traffic from specific namespaces or pods.

Chapter 7: Persistent Storage

Persistent storage is crucial for stateful applications. This chapter explores OpenShift’s options for managing data storage.

Key Points:
Persistent Volume (PV): Storage resource in the cluster.
Persistent Volume Claim (PVC): Request for storage by a user.

Actionable Advice:
Claim and Use Persistent Storage:
Example: Define a PVC in a YAML file and apply it to your project with oc apply -f pvc.yaml.
Example: Attach the PVC to a pod to provide persistent storage.

Chapter 8: Monitoring and Logging

Efficient monitoring and logging mechanisms are vital for managing application health and performance.

Key Points:
Prometheus and Grafana: Integrated for metrics collection and visualization.
Elastic Stack (ELK): For centralized logging in OpenShift.

Actionable Advice:
Set Up Monitoring Dashboards:
Example: Use the OpenShift console to navigate to the Monitoring section and build custom dashboards in Grafana using metrics from Prometheus.
Implement Centralized Logging:
Example: Configure Fluentd to aggregate logs from node pods and ship them to Elasticsearch, making it available in Kibana for analysis.

Chapter 9: Security and User Management

Security is paramount in any cloud infrastructure. This chapter outlines the key security features and user management practices in OpenShift.

Key Points:
Role-Based Access Control (RBAC): Manages permissions for users and groups.
Security Context Constraints (SCCs): Define what actions can be performed by pods.

Actionable Advice:
Set Up User Roles and Permissions:
Example: Create roles and bind them to users using oc create role and oc create rolebinding.
Example: oc adm policy add-role-to-user admin user1 to grant admin permissions to specific users.
Apply Security Constraints:
Example: Use YAML to define and apply SCCs that restrict permissions for pods and containers.

Conclusion

“OpenShift for Developers: A Guide for Impatient Beginners” provides a clear and practical narrative for developers venturing into cloud-native application development using OpenShift. By detailing the workflow from setup to deployment and management, the book equips developers with the necessary tools and knowledge to harness OpenShift’s capabilities effectively. Each chapter offers concrete steps and examples, ensuring that readers not only understand the concepts but also know exactly how to implement them in their development workflows.

By following the actionable advice outlined throughout the book, developers can expect to gain a solid foundation in OpenShift and be better prepared to build, deploy, and scale applications in a cloud-native environment.

Technology and Digital TransformationCloud Computing