Red Hat OpenShift Developer II: Building Kubernetes Applications

DO288

Welcome

Course Objectives and Structure

Schedule

Chapter 1: Red Hat OpenShift Container Platform for Developers

Goal: Define the Red Hat OpenShift architecture, concepts and terminology, and set up the developer environment.


Objectives:

  • Introduce the Red Hat OpenShift Container Platform and its architecture and components.

  • Set up the classroom and developer environment for the hands-on labs in the course.

  • Describe the concepts and terminology used when deploying applications to Red Hat OpenShift.

Red Hat OpenShift Container Platform Architecture

The Value of Red Hat OpenShift

High-level functional overview

Foundations of Red Hat OpenShift

Kubernetes communication components

Red Hat OpenShift Architecture

Architecture of Red Hat OpenShift

Using the Cluster

Basic Kubernetes Terminology

Quiz: Red Hat OpenShift Container Platform Architecture

Setting up the Developer Environment

Setting Up and Targeting a Development Cluster

Installing and Configuring the Development Tools

Guided Exercise: Setting up the Developer Environment

Red Hat OpenShift Concepts and Terminology

Kubernetes Concepts

Red Hat OpenShift Extends Kubernetes Red Hat OpenShift

Explaining Objects with the CLI

Quiz: Red Hat OpenShift Concepts and Terminology

Summary

  • Red Hat OpenShift is a Kubernetes-based platform that is used to build, deploy, and manage applications.
  • Red Hat OpenShift provides custom resources and components that extend the capabilities of Kubernetes.
  • You can use Red Hat OpenShift across several platform infrastructures, including bare-metal, on-premise servers, and public, private, and hybrid clouds.
  • Red Hat OpenShift Toolkit and odo provide developers with streamlined processes to write and deploy cloud-native applications.
  • You can use the web console, and the oc and odo CLIs, to interact with Red Hat OpenShift.

Chapter 2: Deploying Simple Applications

Goal: Deploy simple applications by using the Red Hat OpenShift web console and command-line tools.


Objectives:

  • Navigate and explore the features of the Red Hat OpenShift web console.

  • Deploy simple applications by using the various methods that the Red Hat OpenShift web console provides.

  • Create and deploy applications by using the odo and oc CLI tools.

Navigating the Red Hat OpenShift Web Console

Overview of the Red Hat OpenShift Web Console

The OpenShift home page

OpenShift web console perspective selection

OpenShift web console topology view

The build status indicator shows that the most recent build succeeded.

Topology view details panel

Build logs for an example Node.js application

Guided Exercise: Navigating the Red Hat OpenShift Web Console

Deploying Applications by Using the Red Hat OpenShift Web Console

Deploying Applications with the Developer Perspective

The Topology Screen

Deploying Applications with the Administrator Perspective

Guided Exercise: Deploying Applications by Using the Red Hat OpenShift Web Console

Deploying Applications by Using the oc and odo CLIs

Deploying Applications with the OpenShift CLI

Describing odo and devfiles

Inner loop versus outer loop

Exposing Applications Outside the Cluster.

Guided Exercise: Deploying Applications by Using the oc and odo CLIs

Lab: Deploying Simple Applications

Summary

  • You can use the web console or the oc and odo CLIs to deploy applications in Red Hat OpenShift.
  • In the web console, the developer perspective streamlines the application development experience by providing multiple methods to deploy applications.
  • These methods include deploying applications and services by using container images, Git repositories, Helm charts, or operator-backed services.

Summary (continued)

  • You can apply these deployment methods from the developer perspective, or by using the CLIs.
  • The administrator perspective of the web console focuses on cluster administration.
  • The topology screen of the developer perspective displays deployed applications in a graph view.

Chapter 3: Building and Publishing Container Images

Goal: Build, deploy, and manage the lifecycle of container images by using a container registry.


Objectives:

  • Build Container Images for Red Hat OpenShift by using Red Hat Universal Base Images (UBI).

  • Use container images from remote container registries in Red Hat OpenShift.

  • Create and manage Red Hat OpenShift Image Streams.

Building Container Images for Red Hat OpenShift

Container Images for Red Hat OpenShift

Use Red Hat Universal Base Images

Optimize Containerfiles for OpenShift

The Overview tab of the Red Hat Ecosystem Catalog provides instructions to use an image

Build and Push Images with Podman

Guided Exercise: Building Container Images for Red Hat OpenShift

Using External Registries in Red Hat OpenShift

Reviewing Container Registries

Authenticating OpenShift with Private Registries

Create secrets in the OpenShift console

Create docker-registry secrets in the OpenShift console

Guided Exercise: Using External Registries in Red Hat OpenShift

Creating Image Streams

Red Hat OpenShift Image Streams

Image Names, Tags, and IDs

Managing Image Streams and Tags

Creating Image Streams From Private Registries

Using Image Streams with Kubernetes Resources

Sharing an Image Stream Between Multiple Projects

Guided Exercise: Creating Image Streams

Lab: Building and Publishing Container Images

Summary

  • Red Hat recommends the use of Red Hat Universal Base Images (UBI) as the base container images for your applications. UBI images are certified, tested, and regularly maintained images that Red Hat provides at no cost.
  • Red Hat provides UBI images for the following runtime languages:
    • OpenJDK
    • Node.js
    • Python
    • PHP
    • .NET
    • Go
    • Ruby
  • To authorize OpenShift with an external registry, store credentials for authorizing the registry in OpenShift and associate the credentials with your service account.

Summary (continued)

  • Image streams are an OpenShift specific resource that you can use to reference container images by using an intermediate name that points to an image from a container registry.
  • An image stream represents one or more sets of container images. Each set, or stream, is identified by an image stream tag, which contains a historic list of the container images that the image stream tag referenced along with the container image in use.

Chapter 4: Managing Red Hat OpenShift Builds

Goal: Describe the Red Hat OpenShift build process and build container images.


Objectives:

  • Describe the various ways to build and customize images in Red Hat OpenShift.

  • Configure and manage Red Hat OpenShift builds.

  • Configure the triggering of automatic builds based on events.

The Red Hat OpenShift Build Process

The Build Process

Build Strategies

BuildConfig Resource

Quiz: The Red Hat OpenShift Build Process

Managing Application Builds

Creating and Managing a Build Configuration

Guided Exercise: Managing Application Builds

Triggering Builds

Defining Build Triggers

Starting New Builds with Image Change Triggers

Starting New Builds with Webhook Triggers

Guided Exercise: Triggering Builds

Lab: Managing Red Hat OpenShift Builds

Summary

  • A BuildConfig resource includes one strategy and one or more input sources.
  • You can use Source, Docker, or Custom build strategies.
  • The build input sources, in order of precedence are: Dockerfile, Git, Image, Binary, Input Secrets, and External artifacts.
  • Manage the build lifecycle with oc commands such as oc start-build, oc cancel-build, oc delete, oc describe, and oc logs.
  • Builds can start automatically through build triggers such as an image change trigger, configuration change triggers, and webhooks triggers.
  • You can perform validation and administrative tasks during builds by using post-commit build hooks.

Chapter 5: Managing Red Hat OpenShift Deployments

Goal: Describe the different Red Hat OpenShift deployment strategies and how to monitor the health of applications.


Objectives:

  • Describe the various deployment strategies for applications running on Red Hat OpenShift.

  • Configure and manage application deployments on Red Hat OpenShift.

  • Configure and manage stateful applications deployed on Red Hat OpenShift.

  • Monitor the health of applications deployed on Red Hat OpenShift by using readiness and liveness probes.

Selecting the Appropriate Deployment Strategy

Automating Application Deployments

The Deployment Resource

The DeploymentConfig Resource

Deployment Strategies

Guided Exercise: Selecting the Appropriate Deployment Strategy

Managing Application Deployments

Manage Deployments with CLI

Externalize Deployment Configuration

Create configuration maps in the OpenShift console

Using Service Accounts

Configure Security Context

Guided Exercise: Managing Application Deployments

Deploying Stateful Applications

Deploying Stateful Applications

Persistent Volumes and Persistent Volume Claims

Static and Dynamic Provisioning

Mounting Claims Within Pods

Adding Storage to Deployments

Ephemeral Storage

Stateful Sets

Guided Exercise: Deploying Stateful Applications

Monitoring Application Health

Specifying Application Resource Requirements

Red Hat OpenShift Application Health Checks

Methods of Checking Application Health

Manage Probes By Using the Web Console

Creating Probes by Using the CLI

Guided Exercise: Monitoring Application Health

Lab: Managing Red Hat OpenShift Deployments

Summary

  • Deploy stateless applications by using the Deployment or DeploymentConfig resources.
  • You can use a deployment strategy to adjust deployments based on the cluster resources, and your downtime and backwards compatibility requirements.
  • Decouple your application from the environment by storing configuration in secrets and configuration maps.
  • You can inject secrets and configuration maps into pods as environment variables or volumes.

Summary (continued)

  • Deploy stateful applications, such as databases, by using the StatefulSet resource.
  • Use persistent volume claims to request storage requirements in your applications.
  • Use health checks to monitor the status of your applications.

Chapter 6: Deploying Multi-container Applications

Goal: Deploy multi-container applications by using Red Hat OpenShift Templates, Helm Charts and Kustomize.


Objectives:

  • Install multi-container applications by using a template.

  • Install multi-container applications by using Helm Charts.

  • Install multi-container applications by using the Kustomize CLI.

Red Hat OpenShift Templates

Describing a Template

Defining Template Parameters

Adding a Template to OpenShift

Creating an Application from a Template

Quiz: Red Hat OpenShift Templates

Install Applications by Using Helm Charts

Deploy Applications with Helm

Helm charts in the developer catalog

Creating Helm Charts

Guided Exercise: Install Applications by Using Helm Charts

The Kustomize CLI

Templating Deployments with Kustomize

Applying Customizations

Guided Exercise: The Kustomize CLI

Lab: Deploying Multi-container Applications

Summary

  • Templates are Red Hat OpenShift resources that you can use to parametrize Kubernetes resources.
  • Use the oc new-app and oc process commands to render and deploy a template.
  • Helm is a Kubernetes-native package manager that you can use to manage applications on OpenShift and Kubernetes.
  • You can use Helm to template and package your Kubernetes resources.
  • Kustomize is a Kubernetes resource packaging tool that is included in the kubectl and oc CLIs by default.

Summary (continued)

  • Kustomize uses base resources that you can customize in overlays.
  • Use the oc apply -k command to apply Kustomized resources.
  • Choosing to use OpenShift Templates, Helm, Kustomize, or a combination of the tools depends on your needs and use-cases.

Chapter 7: Continuous Deployment by Using Red Hat OpenShift Pipelines

Goal: Implement CI/CD Workflows by using Red Hat OpenShift Pipelines


Objectives:

  • Describe the architecture and components of Red Hat OpenShift Pipelines.

  • Create multi-step CI/CD workflows for multi-container applications by using Red Hat OpenShift Pipelines.

Red Hat OpenShift Pipelines Architecture and Components

CI/CD

Red Hat OpenShift Pipelines

Main resources used to define pipelines

Actions and entities flow in OpenShift Pipelines

Pipeline screen in the web console

Differences with Jenkins

Quiz: Red Hat OpenShift Pipelines Architecture and Components

Creating CI/CD Workflows by Using Red Hat OpenShift Pipelines

Creating CI/CD Workflows by Using Red Hat OpenShift Pipelines

Defining Custom Tasks

Defining Pipelines

Sharing Data With Workspaces

Viewing Task and Pipeline Details

Task and Pipeline Runs

Guided Exercise: Creating CI/CD Workflows by Using Red Hat OpenShift Pipelines

Lab: Continuous Deployment by Using Red Hat OpenShift Pipelines

Summary

  • Continuous integration and continuous delivery/deployment (CI/CD) practices enable fast delivery cycles, high reliability, short feedback loops, and low lead times.
  • The foundation of OpenShift Pipelines is Tekton, an open source, cloud-native framework for implementing CI/CD pipelines.
  • A pipeline is a series of actions that typically build, test, release, and deploy applications.
  • OpenShift Pipelines uses custom resources to manage the main building blocks of pipelines, such as Pipeline and Task.

Chapter 8: Comprehensive Review

Comprehensive Review

Reviewing Red Hat OpenShift Developer II: Building Kubernetes Applications

Lab: Building and Deploying a Full-stack Cloud-native Application

Lab: Implementing Continuous Integration and Deployment with OpenShift Pipelines

DO288-OCP4.12-en-2-20231002