Learn OpenShift

Book Description

Gain hands-on experience of installing OpenShift Origin 3.9 in a production configuration and managing applications using the platform you built

Key Features

  • Gain hands-on experience of working with Kubernetes and Docker
  • Learn how to deploy and manage applications in OpenShift
  • Get a practical approach to managing applications on a cloud-based platform
  • Explore multi-site and HA architectures of OpenShift for production

Book Description

Docker containers transform application delivery technologies to make them faster and more reproducible, and to reduce the amount of time wasted on configuration. Managing Docker containers in the multi-node or multi-datacenter environment is a big challenge, which is why container management platforms are required. OpenShift is a new generation of container management platforms built on top of both Docker and Kubernetes. It brings additional functionality to the table, something that is lacking in Kubernetes. This new functionality significantly helps software development teams to bring software development processes to a whole new level.

In this book, we'll start by explaining the container architecture, Docker, and CRI-O overviews. Then, we'll look at container orchestration and Kubernetes. We'll cover OpenShift installation, and its basic and advanced components. Moving on, we'll deep dive into concepts such as deploying application OpenShift. You'll learn how to set up an end-to-end delivery pipeline while working with applications in OpenShift as a developer or DevOps. Finally, you'll discover how to properly design OpenShift in production environments.

This book gives you hands-on experience of designing, building, and operating OpenShift Origin 3.9, as well as building new applications or migrating existing applications to OpenShift.

What you will learn

  • Understand the core concepts behind containers and container orchestration tools
  • Understand Docker, Kubernetes, and OpenShift, and their relation to CRI-O
  • Install and work with Kubernetes and OpenShift
  • Understand how to work with persistent storage in OpenShift
  • Understand basic and advanced components of OpenShift, including security and networking
  • Manage deployment strategies and application's migration in OpenShift
  • Understand and design OpenShift high availability

Who this book is for

The book is for system administrators, DevOps engineers, solutions architects, or any stakeholder who wants to understand the concept and business value of OpenShift.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Publisher Resources

Download Example Code

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Learn OpenShift
  3. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  4. Contributors
    1. About the authors
    2. Acknowledgments
    3. About the reviewers
    4. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Containers and Docker Overview
    1. Technical requirements
    2. Containers overview
      1. Container features and advantages
        1. Efficient hardware resource consumption
        2. Application and service isolation
        3. Faster deployment
        4. Microservices architecture
        5. The stateless nature of containers
    3. Docker container architecture
      1. Docker architecture
      2. Docker's main components
      3. Linux containers
    4. Understanding Docker images and layers
      1. Container filesystem
      2. Docker storage drivers
      3. Container image layers
    5. Docker registries
      1. Public registry
      2. Private registry
      3. Accessing registries
    6. Docker Hub overview
    7. Docker installation and configuration
      1. Docker installation
      2. Docker configuration
    8. Using the Docker command line
      1. Using Docker man, help, info
    9. Managing images using Docker CLI
      1. Working with images
      2. Saving and loading images
      3. Uploading images to the Docker registry
    10. Managing containers using Docker CLI
      1. Docker ps and logs
      2. Executing commands inside a container
      3. Starting and stopping containers
      4. Docker port mapping
      5. Inspecting the Docker container
        1. Removing containers
    11. Using environment variables
      1. Passing environment variables to a container
      2. Linking containers
    12. Using persistent storage
    13. Creating a custom Docker image
      1. Customizing images using docker commit
      2. Using Dockerfile build
      3. Using Docker history 
      4. Dockerfile instructions 
    14. Summary
    15. Questions
    16. Further reading
  7. Kubernetes Overview
    1. Technical requirements
    2. Container management systems overview
    3. Kubernetes versus Docker Swarm
    4. Kubernetes key concepts
    5. Kubernetes installation and configuration
    6. Working with kubectl
      1. Getting help
      2. Using the kubectl get command
      3. Running Kubernetes pods
      4. Describing Kubernetes resources 
      5. Editing Kubernetes resources
      6. Exposing Kubernetes services
      7. Using Kubernetes labels
      8. Deleting Kubernetes resources
      9. Kubernetes advanced resources
      10. Creating kubernetes services using YAML and JSON files
    7. Clearing the virtual environment
    8. Kubernetes limitations
    9. Summary
    10. Questions
    11. Further reading
  8. CRI-O Overview
    1. Technical requirements
    2. Container Runtime and Container Runtime Interface
      1. CRI-O and Open Container Initiative
    3. How CRI-O works with Kubernetes
    4. Installing and working with CRI-O
      1. Stopping your virtual environment
    5. Summary
    6. Questions
    7. Further reading
  9. OpenShift Overview
    1. Cloud technology landscape and the role of PaaS
    2. OpenShift as an extension of Kubernetes
    3. Understanding OpenShift's business value
    4. OpenShift flavors
    5. OpenShift architecture
    6. Summary
    7. Questions
    8. Further reading
  10. Building an OpenShift Lab
    1. Technical requirements
    2. Why use a development environment?
    3. Deployment variants
    4. Working with oc cluster up
      1. System requirements and prerequisites
      2. CentOS 7
      3. macOS
      4. Windows
      5. Accessing OpenShift through a web browser
    5. Working with Minishift
    6. Working with Vagrant
      1. Vagrant installation
      2. Installing OpenShift with an all-in-one Vagrant box
    7. Summary
    8. Questions
    9. Further reading
  11. OpenShift Installation
    1. Technical requirements
    2. Prerequisites
      1. Hardware requirements
    3. Overview of OpenShift installation methods
      1. RPM installation
      2. Containerized installation
      3. Deployment scenarios
    4. Environment preparation
      1. Docker
      2. SELinux
      3. Ansible installation
      4. SSH access
    5. Advanced installation
      1. OpenShift Ansible inventory
      2. OpenShift Ansible playbooks
      3. Installation
      4. Validation
    6. Summary
    7. Questions
    8. Further reading
  12. Managing Persistent Storage
    1. Technical requirements
    2. Persistent versus ephemeral storage
    3. The OpenShift persistent storage concept
      1. Persistent Volumes
      2. Persistent Volume Claims
      3. The storage life cycle in OpenShift
    4. Storage backends comparison
    5. Storage infrastructure setup
      1. Setting up NFS
        1. Installing NFS packages on the server and clients
        2. Configuring NFS exports on the server
        3. Starting and enabling the NFS service
        4. Verification
      2. Configuring GlusterFS shares
        1. Installing packages
        2. Configuring a brick and volume
      3. Configuring iSCSI
      4. Client-side verification
        1. NFS verification
        2. GlusterFS verification
        3. iSCSI verification
    6. Configuring Physical Volumes (PV)
      1. Creating PVs for NFS shares
      2. Creating a PV for the GlusterFS volume
      3. PV for iSCSI
    7. Using persistent storage in pods
      1. Requesting persistent volume
      2. Binding a PVC to a particular PV
      3. Using claims as volumes in pod definition
      4. Managing volumes through oc volume
      5. Persistent data for a database container
    8. Summary
    9. Questions
    10. Further reading
  13. Core OpenShift Concepts
    1. Managing projects in OpenShift
    2. Managing users in OpenShift
    3. Creating new applications in OpenShift
    4. Managing pods in OpenShift
    5. Managing services in OpenShift
    6. Managing routes in OpenShift
    7. Summary
    8. Questions
    9. Further reading
  14. Advanced OpenShift Concepts
    1. Technical requirements
    2. Tracking the version history of images using ImageStreams
      1. Importing images
      2. Creating applications directly from Docker images
      3. Manually pushing images into the internal registry
    3. Separating configuration from application code using ConfigMaps
    4. Controlling resource consumption using ResourceQuotas
    5. Controlling resource consumption using LimitRanges
    6. Creating complex stacks of applications with templates
    7. Autoscaling your application depending on CPU and RAM utilization
      1. CPU-based autoscaling
      2. Memory-based autoscaling
    8. Summary
    9. Questions
    10. Further reading
  15. Security in OpenShift
    1. Technical requirements
    2. Authentication
      1. Users and identities
      2. Service accounts
      3. Identity providers
        1. AllowAll
        2. DenyAll
        3. HTPasswd
        4. LDAP
    3. Authorization and role-based access control
      1. Using built-in roles
      2. Creating custom roles
    4. Admission controllers
    5. Security context constraints
    6. Storing sensitive data in OpenShift
      1. What data is considered sensitive?
      2. Secrets
    7. Summary
    8. Questions
    9. Further reading
  16. Managing OpenShift Networking
    1. Technical requirements
    2. Network topology in OpenShift
      1. Tracing connectivity
    3. SDN plugins
      1. ovs-subnet plugin
      2. ovs-multitenant plugin
      3. ovs-networkpolicy plugin
    4. Egress routers
    5. Static IPs for external project traffic
    6. Egress network policies
    7. DNS
    8. Summary
    9. Questions
    10. Further reading
  17. Deploying Simple Applications in OpenShift
    1. Technical requirements
    2. Manual application deployment
      1. Creating a pod
      2. Creating a service
        1. Creating a service using oc expose
        2. Creating a service from a YAML definition
      3. Creating a route
        1. Creating a route by using oc expose
        2. Creating a route from a YAML definition
    3. Using oc new-app
      1. The oc new-app command
      2. Using oc new-app with default options
    4. Advanced deployment
      1. Deploying MariaDB
    5. Summary
    6. Questions
    7. Further reading
  18. Deploying Multi-Tier Applications Using Templates
    1. Technical requirements
    2. OpenShift template overview
      1. Template syntax
      2. Adding templates
      3. Displaying template parameters
      4. Processing a template
    3. Creating a custom template
      1. Developing YAML/JSON template definitions
      2. Exporting existing resources as templates
      3. Using the oc new-app -o command
    4. Using templates to deploy a multi-tier application
      1. The Gogs application template
      2. Creating the Gogs application
    5. Summary
    6. Questions
    7. Further reading
  19. Building Application Images from Dockerfile
    1. Technical requirements
    2. Dockerfile development for OpenShift
    3. Building an application from Dockerfile
      1. A simple Dockerfile build
    4. Dockerfile build customization
    5. Summary
    6. Questions
    7. Further reading
  20. Building PHP Applications from Source Code
    1. Technical requirements
    2. PHP S2I
    3. Building a simple PHP application
    4. Understanding the PHP build process
      1. Starting a new build
    5. Summary
    6. Questions
    7. Further reading
  21. Building a Multi-Tier Application from Source Code
    1. Technical requirements
    2. Building a multi-tier application
      1. WordPress template
      2. Building a WordPress application
    3. Summary
    4. Questions
  22. CI/CD Pipelines in OpenShift
    1. Technical requirements
    2. CI/CD and CI/CD pipelines
    3. Jenkins as CI/CD
    4. Jenkins in OpenShift
      1. Creating Jenkins pipelines in OpenShift
      2. Starting a Jenkins pipeline
      3. Editing Jenkinsfile
      4. Managing pipeline execution
    5. Summary
    6. Questions
    7. Further reading
  23. OpenShift HA Architecture Overview
    1. What is high availability?
    2. HA in OpenShift
      1. Virtual IPs
      2. IP failover
      3. OpenShift infrastructure nodes  
      4. OpenShift masters 
      5. OpenShift etcd
      6. OpenShift nodes  
      7. External storage for OpenShift persistent data
    3. OpenShift backup and restore
      1. Etcd key-value store backup
      2. OpenShift masters 
      3. OpenShift nodes 
      4. Persistent storage  
    4. Summary
    5. Questions
    6. Further reading
  24. OpenShift HA Design for Single and Multiple DCs
    1. OpenShift single-DC HA design
      1. OpenShift infrastructure nodes
      2. OpenShift masters
      3. OpenShift nodes
      4. Etcd key-value store
      5. Persistent storage
      6. Physical placement consideration
      7. Design considerations
    2. OpenShift multi-DC HA design
      1. One OpenShift cluster across all data centers
      2. One OpenShift cluster per data center
        1. Networking
        2. Storage
        3. Application deployment
    3. Summary
    4. Questions
    5. Further reading
  25. Network Design for OpenShift HA
    1. Common network topologies for OpenShift deployments
      1. Data center networks
        1. Access layer switches
        2. Core layer switches
        3. Edge firewalls
        4. Load balancers
        5. Border routers
      2. Cloud networks
        1. SDN
        2. Security groups
        3. Load balancers
        4. Network Address Translation (NAT) gateways
    2. Commonly made mistakes while designing networks for OpenShift
    3. General network requirements and design guidelines for OpenShift deployments
    4. Summary
    5. Questions
    6. Further reading
  26. What is New in OpenShift 3.9?
    1. Major changes in OpenShift 3.9
    2. What to expect from the following OpenShift releases
    3. Summary
    4. Questions
    5. Further reading
  27. Assessments
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
    9. Chapter 9
    10. Chapter 10
    11. Chapter 11
    12. Chapter 12
    13. Chapter 13
    14. Chapter 14
    15. Chapter 15
    16. Chapter 16
    17. Chapter 17
    18. Chapter 18
    19. Chapter 19
    20. Chapter 20
    21. Chapter 21
  28. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product Information

  • Title: Learn OpenShift
  • Author(s): Denis Zuev, Artemii Kropachev, Aleksey Usov
  • Release date: July 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788992329