100% found this document useful (1 vote)
9 views

Kubernetes Fundamentals: A Step-by-Step Development and Interview Guide 1st Edition Himanshu Agrawal instant download

The document provides information on various ebooks available for download, including 'Kubernetes Fundamentals: A Step-by-Step Development and Interview Guide' by Himanshu Agrawal. It contains links to multiple titles across different subjects, emphasizing the accessibility of high-quality educational resources. The document also includes details about the authors, publication rights, and a brief overview of the content structure of the featured books.

Uploaded by

kireikurtes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
9 views

Kubernetes Fundamentals: A Step-by-Step Development and Interview Guide 1st Edition Himanshu Agrawal instant download

The document provides information on various ebooks available for download, including 'Kubernetes Fundamentals: A Step-by-Step Development and Interview Guide' by Himanshu Agrawal. It contains links to multiple titles across different subjects, emphasizing the accessibility of high-quality educational resources. The document also includes details about the authors, publication rights, and a brief overview of the content structure of the featured books.

Uploaded by

kireikurtes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

Download the full version and explore a variety of ebooks

or textbooks at https://ebookmass.com

Kubernetes Fundamentals: A Step-by-Step


Development and Interview Guide 1st Edition
Himanshu Agrawal

_____ Follow the link below to get your download now _____

https://ebookmass.com/product/kubernetes-fundamentals-a-
step-by-step-development-and-interview-guide-1st-edition-
himanshu-agrawal/

Access ebookmass.com now to download high-quality


ebooks or textbooks
We have selected some products that you may be interested in
Click the link to download now or visit ebookmass.com
for more options!.

Kubernetes Fundamentals: A Step-by-Step Development and


Interview Guide 1st Edition Himanshu Agrawal

https://ebookmass.com/product/kubernetes-fundamentals-a-step-by-step-
development-and-interview-guide-1st-edition-himanshu-agrawal-2/

Roblox Lua Scripting Essentials: A Step-by-Step Guide 1st


Edition Coutinho

https://ebookmass.com/product/roblox-lua-scripting-essentials-a-step-
by-step-guide-1st-edition-coutinho/

Academic Conference Presentations: A Step-by-Step Guide


Mark R. Freiermuth

https://ebookmass.com/product/academic-conference-presentations-a-
step-by-step-guide-mark-r-freiermuth/

The Experimentation Field Book: A Step-by-Step Project


Guide Jeanne Liedtka

https://ebookmass.com/product/the-experimentation-field-book-a-step-
by-step-project-guide-jeanne-liedtka/
Microsoft Project 2019 Step by Step (Step by Step
(Microsoft)) Cindy Lewis & Carl Chatfield & Timothy
Johnson [Lewis
https://ebookmass.com/product/microsoft-project-2019-step-by-step-
step-by-step-microsoft-cindy-lewis-carl-chatfield-timothy-johnson-
lewis/

The OKRs Field Book Ben Lamorte

https://ebookmass.com/product/the-okrs-field-book-ben-lamorte/

How to Conduct Surveys: A Step-by-Step Guide 6th Edition –


Ebook PDF Version

https://ebookmass.com/product/how-to-conduct-surveys-a-step-by-step-
guide-6th-edition-ebook-pdf-version/

Web API Development for the Absolute Beginner: A Step-by-


step Approach to Learning the Fundamentals of Web API
Development with .NET 7 1st Edition Irina Dominte
https://ebookmass.com/product/web-api-development-for-the-absolute-
beginner-a-step-by-step-approach-to-learning-the-fundamentals-of-web-
api-development-with-net-7-1st-edition-irina-dominte/

The Absolute Beginner's Guide to HTML and CSS: A Step-by-


Step Guide with Examples and Lab Exercises 1st Edition
Kevin Wilson
https://ebookmass.com/product/the-absolute-beginners-guide-to-html-
and-css-a-step-by-step-guide-with-examples-and-lab-exercises-1st-
edition-kevin-wilson/
Kubernetes
Fundamentals
A Step-by-Step Development
and Interview Guide

Himanshu Agrawal
Foreword by Krishna Prasad P
Kubernetes Fundamentals: A Step-by-Step Development and
Interview Guide
Himanshu Agrawal
Pune, India

ISBN-13 (pbk): 978-1-4842-9728-5 ISBN-13 (electronic): 978-1-4842-9729-2


https://doi.org/10.1007/978-1-4842-9729-2

Copyright © 2023 by Himanshu Agrawal


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Divya Modi
Development Editor: James Markham
Copyeditor: Kimberly Wimpsett
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York,
1 New York Plaza, Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201)
348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media,
LLC is a California LLC and the sole member (owner) is Springer Science + Business Media
Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for
reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub (github.com/apress). For more detailed information, please visit
https://www.apress.com/gp/services/source-code.
Paper in this product is recyclable
For my mother, my sister, and my Pittar Baavji.
Love you, Papa, Unnat, Yashi, Jiju, Bittu, Shanu, Kanak,
Mamaji, Mamiji, and Naaniji.
कर्मण्येवाधिकारस्ते मा फलेषु कदाचन।
मा कर्मफलहेतुर्भूर्मा ते सङ्गोऽस्त्वकर्मणि॥
Bhagavad Gita Chapter 2, Verse 47:
You are only entitled to act (karma),
not to the fruits of your act.
Do not become attached to the fruits of your actions. At the
same time, do not become attached to inaction (no karma).
Table of Contents
About the Author������������������������������������������������������������������������������xvii

About the Technical Reviewer�����������������������������������������������������������xix

Acknowledgments�����������������������������������������������������������������������������xxi

Introduction�������������������������������������������������������������������������������������xxiii

Foreword���������������������������������������������������������������������������������������� xxvii

Chapter 1: Welcome to The World of Containers!���������������������������������1


Fundamental Questions We Need to Ask��������������������������������������������������������������2
How Has Application Deployment Evolved?����������������������������������������������������2
What Is a Hypervisor?��������������������������������������������������������������������������������������4
What Is Virtualization?�������������������������������������������������������������������������������������6
What Is Distributed Design?����������������������������������������������������������������������������7
What Are Different Application Design Architectures in
Distributed Design?�����������������������������������������������������������������������������������������8
What Is Cloud Computing?����������������������������������������������������������������������������10
What Is Containerization?������������������������������������������������������������������������������12
What Are the Advantages of Containerization Over Virtualization?����������������13
Can Containerized Applications Run on a Cloud Infrastructure?�������������������16
What Is the Microservices Architecture?�������������������������������������������������������16
How Is Containerization Different from the Microservices Architecture?������19
What Is the Future of Containerization?��������������������������������������������������������19
Understanding Key Container Technologies��������������������������������������������������������20
What Is Docker?��������������������������������������������������������������������������������������������20

v
Table of Contents

What Is Kubernetes?�������������������������������������������������������������������������������������21
What Is Red Hat’s OpenShift Container Platform?�����������������������������������������21
What Does Being “Cloud-Native” Mean?�������������������������������������������������������22
What Is Serverless?���������������������������������������������������������������������������������������23
Why Use Docker and Kubernetes?����������������������������������������������������������������24
Comparing Key Container Technologies��������������������������������������������������������������25
What Are the Alternatives to Docker?������������������������������������������������������������25
What Are the Alternatives to Kubernetes?�����������������������������������������������������26
How Are Kubernetes and Docker Related?����������������������������������������������������27
How Is Kubernetes Different from Docker Swarm?���������������������������������������27
How Is Kubernetes Different from Red Hat OpenShift,
Google Kubernetes Engine, and Others?�������������������������������������������������������28
Summary������������������������������������������������������������������������������������������������������������28

Chapter 2: Kubernetes Deep Dive�������������������������������������������������������31


History of Kubernetes�����������������������������������������������������������������������������������������32
How Did Kubernetes Come into Existence?��������������������������������������������������32
What Is the Linux Foundation?����������������������������������������������������������������������34
What Is the Cloud Native Computing Foundation?����������������������������������������34
Kubernetes Architecture�������������������������������������������������������������������������������������35
What Is the Architecture of Kubernetes?�������������������������������������������������������35
What Are the Key Features of Kubernetes?���������������������������������������������������36
What Is Kubernetes Not?�������������������������������������������������������������������������������38
Master Node (Control Plane)�������������������������������������������������������������������������������39
What Does the Master Node Do?�������������������������������������������������������������������40
What Are the Different Components of the Master Node?�����������������������������41
What Is the API Server (kube-apiserver)?������������������������������������������������������41
What Is the Scheduler (kube-scheduler)?�����������������������������������������������������42

vi
Table of Contents

What Is the Controller Manager (kube-controller-­manager)?������������������������42


What Is etcd?�������������������������������������������������������������������������������������������������43
What Is cloud-controller-manager?���������������������������������������������������������������43
Can the Master Node and Worker Nodes Run on the Same Machine?����������44
Worker Node�������������������������������������������������������������������������������������������������������44
What Are the Components of a Worker Node?����������������������������������������������45
What Is the Node Agent kubelet?������������������������������������������������������������������45
What Is the Node Agent kube-proxy?������������������������������������������������������������46
What Is the Container Runtime?��������������������������������������������������������������������46
What Is the Container Runtime Interface?�����������������������������������������������������47
Communication Between Worker Nodes and Master Nodes�������������������������������48
How Does the Worker Node Communicate with the Master Node?��������������48
How Does the Master Node Communicate with the Worker Node?��������������48
Object Management and Garbage Collection������������������������������������������������������49
What Are Objects in Kubernetes?������������������������������������������������������������������50
What Are the Important Elements of a Kubernetes Object?��������������������������50
How Do You Manage Objects in Kubernetes?������������������������������������������������54
What Is Garbage Collection in Kubernetes?��������������������������������������������������56
Installing Kubernetes������������������������������������������������������������������������������������������58
What Are Several Kubernetes Installation Configurations?���������������������������58
What Are Several Options for Running a Kubernetes Cluster on
Any Local Box?����������������������������������������������������������������������������������������������59
What Is Kubeadm?����������������������������������������������������������������������������������������59
What Is Minikube?�����������������������������������������������������������������������������������������59
Summary������������������������������������������������������������������������������������������������������������64

Chapter 3: Fundamental Objects in Kubernetes Clusters�������������������67


Containers�����������������������������������������������������������������������������������������������������������68
What Is a Container and a Container Image?������������������������������������������������69

vii
Table of Contents

Are Containers Immutable and Stateless?����������������������������������������������������69


Can Containers Self-Heal?�����������������������������������������������������������������������������70
Which Kubernetes Component Creates Containers Within a Pod?����������������70
Do We Always Need to Pull the Container Image?�����������������������������������������70
How Do I Create a Pod with a Single Container?�������������������������������������������71
What Are Container Life-Cycle Hooks?����������������������������������������������������������73
What Are the Possible Container Life-Cycle States?�������������������������������������75
What Are Init Containers?������������������������������������������������������������������������������76
Explain Ephemeral Containers�����������������������������������������������������������������������79
What Are Different Multicontainer Pod Patterns?������������������������������������������80
Pods��������������������������������������������������������������������������������������������������������������������81
What Is a Pod?�����������������������������������������������������������������������������������������������81
Can a Pod Have More Than One Container Running Inside It?����������������������82
Is It Recommended to Have More Than One Container in a Pod?�����������������82
Can You Add a New Container After the Pod Has Been Created?������������������83
Can Pods Self-Heal?��������������������������������������������������������������������������������������84
Do Containers Inside a Pod Share Resources like IP Addresses?�����������������84
Within a Pod, Can Containers Have the Same Names?���������������������������������84
What Is the Threshold for the Number of Pods You Can Create
on a Node?����������������������������������������������������������������������������������������������������85
What Are the Different Pod Life-Cycle Phases?���������������������������������������������85
Pod Status vs. Pod Phase Status�������������������������������������������������������������������87
What Are the Different Pod Conditions?��������������������������������������������������������87
How Do You Control Container Restarts Within a Pod?����������������������������������88
How to List Pods from All Namespaces?�������������������������������������������������������89
What Is Pod Networking?������������������������������������������������������������������������������89
Within the Same Pod, Can Containers Share the Pod’s Storage Volume?�����90
How Are Pods Created or Managed?�������������������������������������������������������������90

viii
Table of Contents

What Are Static Pods?�����������������������������������������������������������������������������������90


What Happens to Pods When a Node Dies, and Can the Same
Pod Get Rescheduled to Another Node?��������������������������������������������������������91
What Happens to Terminated Pods?��������������������������������������������������������������91
Can the Pod Be Forcefully Deleted?��������������������������������������������������������������92
What Are Affinity and Anti-affinity in Kubernetes?����������������������������������������92
What Happens When More Than One Node Selection Term Is
Specified with Node Affinity?������������������������������������������������������������������������97
What Happens When More Than One Match Expression Is Specified
with Node Affinity?����������������������������������������������������������������������������������������98
How Will You Make Sure That a Certain Pod Gets Created on a Certain
Node?������������������������������������������������������������������������������������������������������������98
How Will You Make Sure That Your Pod Gets Scheduled Only on a
Node That Is Already Running a Certain Pod?���������������������������������������������101
How Will You Ensure That Two Pods Get Scheduled on the Same Node?����101
How Can You Control Pod Security?������������������������������������������������������������105
What Is the Runtime Class?�������������������������������������������������������������������������106
Summary����������������������������������������������������������������������������������������������������������107

Chapter 4: Advanced Objects In Kubernetes Clusters����������������������109


Workload Resources�����������������������������������������������������������������������������������������110
What Are Workload Resources?�������������������������������������������������������������������110
What Are Several Built-in Workload Resources?�����������������������������������������110
DaemonSet and StatefulSet������������������������������������������������������������������������������111
What Is DaemonSet?�����������������������������������������������������������������������������������111
What Is a DaemonSet Object?���������������������������������������������������������������������111
What Is StatefulSet?������������������������������������������������������������������������������������114
Can You Explain a StatefulSet Object?��������������������������������������������������������114
How Does StatefulSet Different from Deployment?������������������������������������116
How Do You Delete a DaemonSet and StatefulSet?������������������������������������117

ix
Table of Contents

ReplicaSet: Providing a Stable Set of Running Pods�����������������������������������������118


What Is ReplicaSet, and What Is Its Purpose?���������������������������������������������119
What Is a ReplicaSet Object?����������������������������������������������������������������������119
How Do You List All ReplicaSets from All Namespaces?�����������������������������121
How Do You Delete a ReplicaSet?���������������������������������������������������������������122
How Does ReplicaSet Work?�����������������������������������������������������������������������122
Is ReplicaSet Self-Healing?�������������������������������������������������������������������������123
Which Kubernetes Object Creates a ReplicaSet?����������������������������������������123
Do You Need to Explicitly Create a ReplicaSet?�������������������������������������������123
Can ReplicaSet Be Used Independently of the Deployment Object?�����������123
When Do You Explicitly Use ReplicaSet?�����������������������������������������������������124
Deployment�������������������������������������������������������������������������������������������������������124
What Is the Kubernetes Deployment Workload?�����������������������������������������124
Can You Explain Several Elements of the Deployment Specification?���������125
Can You Explain a Simple Deployment Object?�������������������������������������������127
How Do You List All Deployments from All Namespaces?���������������������������129
How Do You Delete a Deployment?�������������������������������������������������������������130
Is a New ReplicaSet Created Each Time a Deployment Is Created?������������130
What Are Deployment Rollout and Revision?����������������������������������������������130
What Are the Different Deployment Life-­Cycle Statuses?���������������������������132
How Can You Restart a Deployment?����������������������������������������������������������134
What Is a Rolling Update?���������������������������������������������������������������������������136
How Can You Roll Back a Deployment?�������������������������������������������������������142
How Can You Scale a Deployment?�������������������������������������������������������������144
What Is Horizontal Autoscaling?������������������������������������������������������������������145
How Can You Pause and Resume a Deployment?���������������������������������������146
Can You Delete a Pod from a Running Deployment, and What
Happens Then?��������������������������������������������������������������������������������������������146

x
Table of Contents

Can You Update a Deployment While an Existing Deployment Is


Rolling Out?�������������������������������������������������������������������������������������������������146
What Is the Difference Between the matchLabels and labels Fields
of Any Object’s Template?���������������������������������������������������������������������������147
What Are Common Deployment Strategies?������������������������������������������������148
What Is the Blue-Green Deployment Strategy?�������������������������������������������149
What Is a Canary Deployment?�������������������������������������������������������������������151
How Do You Deploy a Feature with Zero Downtime in Kubernetes?�����������154
Summary����������������������������������������������������������������������������������������������������������155

Chapter 5: Objects Important For A Secure Kubernetes Cluster������157


Jobs: Seeing the Task to Completion����������������������������������������������������������������158
What Is a Job in Kubernetes?����������������������������������������������������������������������158
How Do Jobs Differ from Other Workload Resources?��������������������������������159
Can You Use a Job to Run Multiple Pods in Parallel?����������������������������������159
Where Can a Kubernetes Job Be Used?������������������������������������������������������159
What Are Alternatives to Kubernetes Jobs?������������������������������������������������160
What Is a Simple Nonparallel Job Object?��������������������������������������������������160
How Do You Specify How Many Tries the Job Controller Should
Make to Finish the Job?������������������������������������������������������������������������������162
How Do You Specify the Maximum Time for Which a Job Should Run?������164
How Do You Delete a Job?���������������������������������������������������������������������������166
What Are Parallel Jobs?�������������������������������������������������������������������������������167
What Is a Cron Job?������������������������������������������������������������������������������������173
How Do You Delete a Cron Job?������������������������������������������������������������������175
What Happens If a Cron Job Is Already Running and It Is Time for
the Next Job?����������������������������������������������������������������������������������������������176
How Do You Control the History of Cron Job Execution?�����������������������������177
Namespaces: Virtual Clusters Within Kubernetes Clusters�������������������������������177
What Is a Namespace?��������������������������������������������������������������������������������177

xi
Table of Contents

Can You Have Multiple Objects with the Same Name in


One Namespace?����������������������������������������������������������������������������������������178
How Do You Create a New Namespace?�����������������������������������������������������178
How Do You Create an Object in a Particular Namespace?�������������������������179
How Do You Delete a Namespace?��������������������������������������������������������������181
How Can You List All the Namespaces?������������������������������������������������������182
Which Namespaces Are by Default Present in the Kubernetes System?����182
Do All Kubernetes Resources Fall Under Some Namespace?���������������������184
How Can You Explicitly Set the Default Namespace?����������������������������������185
Labels and Label Selectors: All About Filtering and Selection��������������������������187
What Are Object Names and Object UIDs?��������������������������������������������������188
Labels����������������������������������������������������������������������������������������������������������188
Label Selectors��������������������������������������������������������������������������������������������191
What Are Annotations?��������������������������������������������������������������������������������196
Authentication, Authorization, and Admission Control��������������������������������������198
How Does Access Control Work in Kubernetes?������������������������������������������198
What Is Authentication?�������������������������������������������������������������������������������199
What Is Authorization?���������������������������������������������������������������������������������204
What Is Admission Control?�������������������������������������������������������������������������207
Summary����������������������������������������������������������������������������������������������������������209

Chapter 6: Networking In Kubernetes����������������������������������������������211


Fundamentals of Kubernetes Networking��������������������������������������������������������212
Basic Computer Networking Concepts��������������������������������������������������������212
What Is Kubernetes Networking?����������������������������������������������������������������215
What Are the Fundamental Restrictions in Kubernetes Networking?����������216
How Do Two Containers Within the Same Pod Interface with
Each Other?�������������������������������������������������������������������������������������������������217
How Do Two Containers, Running in Different Pods, Interface
with Each Other?�����������������������������������������������������������������������������������������217

xii
Table of Contents

How to Expose Applications Inside and Outside of the Cluster?�����������������218


Service: Exposing Applications to the Outside World����������������������������������������219
What Is Service, and Why Do We Need It?���������������������������������������������������219
What Are Endpoints and EndpointSlice?������������������������������������������������������220
What Are a Service Object and Pod Selection?�������������������������������������������221
What Are the Different Service Types?��������������������������������������������������������226
What Is the ClusterIP Service?��������������������������������������������������������������������227
What Is the ExternalName Service?������������������������������������������������������������232
Can You Expose Two Ports in the Same Service?����������������������������������������234
How Can You Add Session Affinity to Your Service?������������������������������������235
What Are the Service Discovery Mechanisms in Kubernetes?��������������������235
Ingress: Consolidate Routing Rules�������������������������������������������������������������������235
What Is Ingress and the Ingress Controller?������������������������������������������������236
What Is an Ingress Object?��������������������������������������������������������������������������237
What Are the Possible Values of the Path Type, and How
Does Path Matching Work?�������������������������������������������������������������������������242
What Are the Different Ingress Types?��������������������������������������������������������243
Summary����������������������������������������������������������������������������������������������������������246

Chapter 7: Kubernetes Storage System��������������������������������������������249


Volumes: Store Your Data����������������������������������������������������������������������������������250
What Is a Volume in Kubernetes, and Why Is It Needed?����������������������������250
What Is the Ephemeral Volume Type?����������������������������������������������������������252
What Is the Persistent Volume Type?�����������������������������������������������������������255
What Are PersistentVolume and PersistentVolumeClaim?��������������������������257
What Are the PersistentVolume and PersistentVolumeClaim Objects?�������260
Can You Demonstrate the Creation and Use of Persistent Volumes?����������264
How Do You Delete PersistentVolume and PersistentVolumeClaim
Objects?�������������������������������������������������������������������������������������������������������267

xiii
Table of Contents

ConfigMap: Store Configuration Data in Plain Text��������������������������������������������268


What Is ConfigMap, and What Is Its Purpose?���������������������������������������������269
What Are Several Ways to Create a ConfigMap Object?������������������������������269
How Can You Use ConfigMap Inside a Pod?������������������������������������������������274
Is ConfigMap Data Immutable?�������������������������������������������������������������������278
Secrets: Store Configuration Data in Encrypted Format�����������������������������������279
What Is Secret, and What Is Its Purpose?����������������������������������������������������279
What Are Several Ways to Create a Secret Object?�������������������������������������280
How Can You Use Secret Inside a Pod?�������������������������������������������������������286
What Is the Difference Between ConfigMap and Secret?����������������������������290
Summary����������������������������������������������������������������������������������������������������������290

Chapter 8: Manage Your Kubernetes Cluster Efficiently�������������������293


Probes: Health Check Your Containers��������������������������������������������������������������294
What Is a Probe?�����������������������������������������������������������������������������������������294
What Are Several Mechanisms for Performing a Probe?�����������������������������294
What Are Some Outcomes of a Probe?��������������������������������������������������������295
What Are Several Types of Probes?�������������������������������������������������������������295
What Are Important Configuration Parameters for Probes?������������������������298
Can You Create an exec Liveness Probe?����������������������������������������������������299
What Is a httpGet Liveness Probe?��������������������������������������������������������������303
What Is a tcpSocket liveness Probe?����������������������������������������������������������305
Can You Create a Readiness Probe?������������������������������������������������������������306
Resource Management: Requests, Limits, and Quotas�������������������������������������312
What Are Requests and Limits?�������������������������������������������������������������������313
What Are Resource Quotas?������������������������������������������������������������������������317
What Are Limit Ranges?������������������������������������������������������������������������������320
Can You Create a Pod with Explicit CPU and Memory Requests and
Limits?���������������������������������������������������������������������������������������������������������323

xiv
Table of Contents

What Happens When You Create a Pod with Unreasonably High


Requests and Limits?����������������������������������������������������������������������������������325
What Happens When You Create a Pod That Breaches Resource
Quota Limits?����������������������������������������������������������������������������������������������326
How to Automatically Assign Default Requests and Limits for Pods?���������328
How Do You Define Minimum and Maximum CPU and Memory
Constraints for Pods?����������������������������������������������������������������������������������330
What Happens When You Create a Pod Without Any Explicit CPU
and Memory Requests and Limits?�������������������������������������������������������������333
What Is Pod Priority, and How Is It Useful?��������������������������������������������������334
Taints and Tolerations���������������������������������������������������������������������������������������338
What Are Taints and Tolerations?�����������������������������������������������������������������338
What Are the Different Effects of Taints And Tolerations?���������������������������342
Can a Node Have More Than One Taint?������������������������������������������������������342
Summary����������������������������������������������������������������������������������������������������������346

Chapter 9: Docker Overview And Kubernetes Best Practices�����������349


Docker: All You Need to Know to Get Started����������������������������������������������������350
Fundamentals of Docker�����������������������������������������������������������������������������350
Understanding Primary Technologies in Docker������������������������������������������364
Primary Docker Commands�������������������������������������������������������������������������369
Docker Best Practices���������������������������������������������������������������������������������������373
What Are Docker Development Best Practices?������������������������������������������373
What Are Dockerfile Best Practices?�����������������������������������������������������������375
What Are Docker Security Best Practices?��������������������������������������������������377
Kubernetes Best Practices��������������������������������������������������������������������������������378
What Are Kubernetes Development Best Practices?�����������������������������������378
What Are the Best Practices for Large Clusters?�����������������������������������������381

xv
Table of Contents

What Are the General Security Best Practices?�������������������������������������������381


What Are the Secret Configuration Security Best Practices?����������������������383
Summary����������������������������������������������������������������������������������������������������������384

Chapter 10: kubectl: The Command-Line Tool����������������������������������385


Fundamentals of kubectl����������������������������������������������������������������������������������385
What Is kubectl?������������������������������������������������������������������������������������������385
How Does kubectl Find the Details of the Kubernetes Cluster?������������������386
Can You Explain a Sample kubeconfig File?������������������������������������������������387
What Is the General kubectl Syntax?�����������������������������������������������������������388
Important kubectl Commands: A Cheat Sheet��������������������������������������������������392
General Commands�������������������������������������������������������������������������������������393
Namespace Commands�������������������������������������������������������������������������������396
Pod Commands�������������������������������������������������������������������������������������������397
Commands to Customize the kubectl Output����������������������������������������������398
Workload Resource Commands�������������������������������������������������������������������401
Deployment Commands������������������������������������������������������������������������������402
Jobs and CronJobs Commands�������������������������������������������������������������������404
Networking Commands�������������������������������������������������������������������������������406
Storage Commands�������������������������������������������������������������������������������������407
Node Commands�����������������������������������������������������������������������������������������408
Summary����������������������������������������������������������������������������������������������������������410

Index�������������������������������������������������������������������������������������������������413

xvi
About the Author
Himanshu Agrawal is an accomplished IT
professional with more than a decade of
experience in designing and implementing
complex solutions with JEE technologies. He
is a technical reviewer for a published book on
JVM and specializes in niche technical areas
such as JVM, Multithreading, TLS, Apache,
and Kubernetes, to name a few. Himanshu
has certifications from prestigious universities
such as Harvard and MIT.
Himanshu is an Oracle Certified Java
Developer, an Oracle Certified Web Component Developer, and certified
by Google Cloud for Architecting with the Google Kubernetes Engine.
Himanshu has also worked on .NET technologies in his early career and is
a Microsoft Certified Professional.
Currently Himanshu works as an Associate Consultant with CGI,
counted among the largest IT and business consulting services firms in
the world. He is a distinguished engineer and a recognized professional
within CGI, having received many quarterly and annual awards. Himanshu
extends his technical expertise to teams primarily in the finance and
telecom domains.
Himanshu actively contributes to online technical communities
including StackOverflow.com. In his spare time, Himanshu enjoys
watching movies and reading books.

xvii
About the Technical Reviewer
Nikhil Jain is an Ansible expert with more
than a decade of DevOps experience. He has
been contributing to and using Ansible since
its inception. He currently works closely with
Ansible engineering.
He is an open-source enthusiast and is part
of the Ansible Pune meetup-­organizing team.
He has presented multiple Ansible sessions
at various global and local events. In addition
to automating things using Ansible, he loves
watching sports and is a regular player on the
local cricket team.

xix
Acknowledgments
I would like to thank Apress and its editorial team for giving me the
opportunity to write this book.
A special thanks to Divya Modi, acquisition editor, for working with
me throughout the project. Without her, this book would not have seen
the light of day. Thanks to the book’s production editor, Sowmya Thodur.
Thanks also to the book’s development editor, James Markham, and the
technical reviewer, Nikhil Jain, for their feedback.
I would like to thank God for everything He has given me.
Finally, I would like to thank my parents, my sister, and my Pittar
Baavji, without whom I would not have gotten this far in my life.

xxi
Introduction
This book is a step-by-step development guide designed with an
interview-driven approach. This book will walk you through the breadth
of Kubernetes concepts required to develop, deploy, and manage
applications on Kubernetes, and as you do so, you will be getting ready for
job interviews. Each concept in the book is presented in the form of a Q&A,
with questions being framed exactly as they would be in an interview. This
book can be of great advantage if you are preparing for a job interview that
involves working with Kubernetes.
Specifically, in Chapter 1, “Welcome to The World of Containers!”
you will understand how application development and deployment have
evolved over the decades and led to containerization. We will discuss a
broad range of concepts such as virtualization, hypervisors, microservices,
and more.
In Chapter 2, “Kubernetes Deep Dive,” we will enter the world of
Kubernetes. We will start our discussion with the Kubernetes architecture
and how all its components work together to form a Kubernetes cluster.
You will also be taken through the history and evolution of Kubernetes.
In Chapter 3, “Fundamental Objects in Kubernetes Clusters,” and
Chapter 4, “Advanced Objects in Kubernetes Cluster,” you will learn about
all the important Kubernetes objects: containers, pods, deployments,
ReplicaSets, and more. We will go into detail about how to work with each
of them to maximize their potential. We will also go through Kubernetes
deployment strategies and concepts related to rollout and rollback.
In Chapter 5, “Objects Important for a Secure Kubernetes Clusters,”
you will learn about Kubernetes objects such as namespaces, jobs, etc.,
that play a pivotal role in creating a secure Kubernetes cluster. You will

xxiii
Introduction

learn how labels, label selectors, and annotations work in Kubernetes. You
will also understand Kubernetes access control mechanisms, covering
authentication, authorization, and admission control.
In Chapter 6, “Networking in Kubernetes,” and Chapter 7, “The
Kubernetes Storage System,” you will learn about two critical components
in any computing ecosystem: networking and storage. We will discuss
Kubernetes services and ingress. We will also go over the various storage
options available in Kubernetes for both normal and confidential data.
In Chapter 8, “Manage Your Kubernetes Cluster Efficiently,” you will
gain an understanding of how to manage a Kubernetes cluster using health
checks, probes, resource quotas, and resource limits. You will also learn
about taints and tolerations.
In Chapter 9, “Docker Overview and Kubernetes Best Practices,” you
will get an overview of Docker. We will also cover some best practices for
using Kubernetes and Docker together.
In Chapter 10, “kubectl: The Command-Line Tool,” you will be
introduced to the kubectl command-line tool. We will also provide a
summary of key kubectl commands.
Over the course of the book, you can expect to learn about the
following:
• How application design and deployment have evolved
over the past decades, including all the related
technologies such as virtualization, hypervisor,
distributed computing, containerization, microservices
architecture, and more

• The architecture and history of Kubernetes

• The two most fundamental objects of Kubernetes:


containers and pods

xxiv
Introduction

• Advanced Kubernetes objects and workload resources:


Deployment, ReplicaSet, StatefulSet, DaemonSet, Job,
and CronJob

• Kubernetes deployment strategies

• Creating virtual clusters within the same Kubernetes


cluster, using the Namespace object

• Access control in Kubernetes, covering authentication,


authorization, and admission control

• Filtering, selection, and tagging using labels, label


selectors, and annotations

• The Kubernetes networking and storage system

• Managing a Kubernetes cluster using health checks,


probes, resource quotas, and resource limits

• The kubectl command-line tool and a cheat sheet of


important kubectl commands

xxv
Foreword
The technological landscape is evolving at an unprecedented pace. Over
the last three decades, I have seen a lot of advancements and am more
excited and optimistic about technological advancements now than ever.
We are making momentous, responsible progress across the technological
spectrum, from human intelligence to machine learning and artificial
intelligence, manual tasks to automation and RPA, distributed ledgers to
blockchains, on-premise to cloud computing, and so on. They all have one
thing in common: a piece of software, an application, on top of the stack
that requires a container to run on.
Along with these technological advancements, we are also making a
significant shift in application design and deployment strategies. Moving
from a monolithic to a microservices architecture is no longer a choice
but rather a fundamental need, a strategic decision in order to maintain
a competitive edge in a world where scalability and resilience are the
foundations of customer expectations. This is where containerization
comes into play. It is expected that, eventually, all production-grade large
to medium-sized applications will be migrated to a containerized platform.
Kubernetes as the best container orchestrator is almost becoming
cliché. Kubernetes sits in the center of any greenfield or brownfield
application architecture and is changing the way applications are
developed and maintained. Container orchestrators such as Kubernetes
are also critical components of the DevOps architecture. And today we
cannot imagine a production design that is not woven with the fabric
of DevOps. This brings us to our central point: Kubernetes is quickly
becoming an indispensable technology for application development and
deployment, and it is a must-learn for anyone working in the field.

xxvii
Foreword

Himanshu begins his book Kubernetes Fundamentals by discussing


how application design and deployment have evolved over time,
eventually leading to containerization. Then he delves into Kubernetes
application development concepts in depth. Himanshu is a distinguished
engineer who has grown from being a software engineer to a technical
architect and is well-known within CGI and various technology forums for
his technical expertise. Himanshu has brought his best knowledge to this
essential book on Kubernetes.
I am pleased to present Himanshu Agrawal’s Kubernetes
Fundamentals.

Krishna Prasad
Vice President Consulting Delivery, CGI

xxviii
CHAPTER 1

Welcome to The World


of Containers!
In this chapter, we will lay some solid groundwork by introducing key
technologies involved in the evolution of containerization. We will start
by covering how application deployment has evolved over the decades.
We will discuss what virtualization is and how hypervisors are key to the
process of virtualization. We will extend that discussion to understand
distributed architecture, cloud computing models, and how virtualization
and distributed architecture are at the core of cloud computing. We will
also discuss the microservices architecture and how containerization is
different from the microservices architecture.
Next, we will start our discussion of two key containerization
technologies: Docker and Kubernetes. We will explain why container
orchestrators like Kubernetes and Red Hat’s OpenShift Container
Platform (OCP) are needed, what it means to be “cloud-native,” and what
serverless is.
Lastly, we will review some popular alternatives to Docker and
Kubernetes and explain how these technologies are related to each other.
We will also compare and contrast two popular container orchestration
platforms: Kubernetes and Docker Swarm.
With those expectations in mind, let’s begin!

© Himanshu Agrawal 2023 1


H. Agrawal, Kubernetes Fundamentals, https://doi.org/10.1007/978-1-4842-9729-2_1
Chapter 1 Welcome to The World of Containers!

Fundamental Questions We Need to Ask


In this section, we will go through several fundamental concepts related
to how application design and deployment have evolved over the past
several decades, as well as key technologies involved in the evolution of
containerization.

How Has Application Deployment Evolved?


We can categorize the evolution of application deployment into three
deployment models: the traditional deployment model, the virtualized
deployment model, and the containerized deployment model. Figure 1-1
depicts the evolution of the application deployment model.

Figure 1-1. Application deployment models

Traditional Deployment Model


In the traditional deployment model, the application runs directly on the
operating system, and the OS runs on the hardware. This deployment
model clearly has a problem because a bad application can end up
hogging most of the server’s resources while other applications are starved

2
Chapter 1 Welcome to The World of Containers!

for the server’s resources. A typical solution used for this problem is to
run each application on a different physical server, but running a set of
physical servers is expensive even for big organizations.
Suppose we have four applications and a 5GB physical server (for easy
understanding, we are only considering RAM size). So, to overcome the
problem, we would deploy our application on different physical servers of
1GB each, guaranteeing a fixed set of server resources to each application.

Virtualized Deployment Model


In the virtualized deployment model, an application runs on a (guest)
OS, and the (guest) OS, instead of running on the hardware as in the case
of the traditional deployment model, runs inside a VM. The VM runs
on a hypervisor, the hypervisor runs on an OS, and the OS runs on the
hardware. The only major problem with this deployment model is that
virtual machines are too heavy, and therefore scalability and performance
become bottlenecks.
Using the same example as before, in the virtualized deployment
model, we would create four 1GB virtual machines on our 5GB physical
server and then deploy each of our four applications in a separate virtual
machine.

Containerized Deployment Model


In the containerized deployment model, an application runs inside a
container, and the container runs on a container runtime (like Docker).
Now, this container runtime runs either on an operating system, as in the
case of a traditional deployment model, or on a (guest) operating system,
as in the case of a virtualized deployment model. In this deployment
model, the container runtime virtualizes the operating system.
Using the same example as before, in the containerized deployment
model, we would deploy our four applications in different containers and
assign 1GB of server resources to each container.

3
Chapter 1 Welcome to The World of Containers!

This is the best and most flexible deployment model because if, at any
point in time, we think that one of our applications needs only 500MB of
server resources, then we can make this adjustment within seconds by
reconfiguring the container to use only 500MB of server resources, thereby
freeing up 500MB of server resources that can then be used somewhere
else. And these adjustments are possible because containers are very
lightweight.

What Is a Hypervisor?
A virtual machine is an emulation of a physical computer, and a hypervisor
is software that creates and runs VMs. A hypervisor virtualizes a host
system’s hardware by emulating CPU, memory, and networking resources
so that these resources can be divided and several virtual machines can be
created from them. Since the hypervisor provides hardware virtualization,
each virtual machine can have a different operating system.
Primarily, hypervisors are of two types: type-1 and type-2. Figure 1-2
shows a graphical depiction of type-1 and type-2 hypervisors.

Figure 1-2. Type-1 versus type-2 hypervisor

4
Chapter 1 Welcome to The World of Containers!

Type-1 (Native or Bare-Metal) Hypervisor


A type-1 hypervisor runs on bare metal (or the host’s hardware), so we can
say that a hypervisor type-1 is an abstraction of the hardware. And since
type-1 hypervisors run on bare metal, they have complete control of the
computer resources, and hence type-1 hypervisors can perform resource
management and allocation without interfacing with the host OS.
The stack for the type-1 hypervisor will look like this: at the bottom,
there is bare metal or hardware; on top of the hardware, there is a
hypervisor; and on top of the hypervisor, there are many different virtual
machines.
IBM z/VM, Oracle VM Server for SPARC, Microsoft Hyper-V, etc., are
type-1 hypervisor examples.

Type-2 (Hosted) Hypervisor


A type-2 hypervisor runs on a host operating system, and the host
operating system runs on the hardware. And since type-2 hypervisors
don’t run directly on the hardware, they cannot perform complete
resource allocation and management; instead, the system administrator
performs resource allocation and management and distributes them to the
required number of VMs.
The stack for the type-2 hypervisor will look like this: at the bottom,
there is bare metal or hardware; on the hardware, there is a host OS; on
the host OS, there is a hypervisor; and on the hypervisor, there are many
different VMs.
VirtualBox (a product of Oracle), VMware Player, etc., are some type-2
hypervisor examples.

5
Chapter 1 Welcome to The World of Containers!

What Is Virtualization?
Virtualization is a broad concept that means creating a virtual representation
of something. In the world of IT, virtualization is a technology that allows
us to virtualize computing resources such as servers, networks, storage,
etc. By hardware virtualization, we get virtual machines (VMs). Two core
entities in the concept of virtualization are hypervisors and virtual machines.
Hypervisors were already discussed in the previous section, and virtual
machines are nothing but byproducts of hypervisors.

What Are Different Virtualization Types?


As mentioned, virtualization is a broad concept through which we can
create a virtual representation of something. In terms of IT, different
virtualization types can be as follows:

• Virtualization of server

• Virtualization of storage

• Virtualization of network

• Virtualization of data

• Virtualization of desktop

How Are Virtualization and Cloud Computing Different?


Cloud computing is nothing but the delivery of computing resources
on an on-demand basis, and virtualization is the technology that makes
cloud computing possible. Without virtualization technologies, there
would be no cloud computing. In cloud computing, when you create a
compute instance, technically it is nothing but a virtualized instance of the
physical server.
Another backbone of cloud computing is distributed architecture.

6
Chapter 1 Welcome to The World of Containers!

What Is Distributed Design?


A distributed design, also known as distributed computing or distributed
system or distributed architecture, is a group of computing systems spread
across multiple computing nodes that work together to achieve a common
goal. These computing systems could be software processes or hardware
devices.
A distributed design is in contrast to a centralized design, where
the complete state of the system lies on a central node or a central node
that plays the role of the master. In a centralized design, since all key
decisions are centralized, there are always chances of bottlenecks and
the failure of one node resulting in complete system failure. Chances of
such bottlenecks or cascading failure are greatly reduced with distributed
designs.

Figure 1-3. Distributed design versus centralized design

As shown in Figure 1-3, both in distributed systems and in centralized


systems, there are many nodes (computing systems), but the difference is
that in the case of a centralized system, one node will play the role of the

7
Chapter 1 Welcome to The World of Containers!

master, managing all other worker nodes, while in the case of a distributed
system, there is no such master node. This master node of the centralized
system can result in a cascading failure of nodes, and since this master
node is absent in the distributed system, there is no single point of failure,
making distributed systems very resilient.
In simple words, having a distributed system or design just means
that your system is designed in such a way that there is no single point of
failure.
Cloud computing, the microservices architecture, and
containerization, in some way or another, are all practical examples of
distributed systems.

 hat Are Different Application Design


W
Architectures in Distributed Design?
Depending on how you are designing your application, there can be four
application architectures in distributed computing:

• An architecture with one client and one server

• An architecture with three tiers


• An architecture with n tiers

• An architecture involving peer-to-peer communication

An Architecture with One Client and One Server


This is the most basic type of distributed computing architecture, which
consists of one server and one or more clients. The server is responsible
for providing a service, and the clients consume the service by making
requests to the server. Most commonly, these requests are made using a
lightweight protocol like HTTP. Email servers, web servers, and file servers
are good examples of a client-server architecture.

8
Chapter 1 Welcome to The World of Containers!

And since client-server architecture is a centralized architecture,


it is prone to issues of a centralized architecture like communication
bottlenecks and single points of failure.

An Architecture with Three Tiers


In an architecture with three tiers, on the server side, there is more
than one tier: one tier representing application servers and one tier
representing database servers.
The tier representing application servers commonly plays the role of
the middle tier, sitting between clients and database servers. They contain
all the application and business logic needed for running the application.
The tier representing database servers commonly plays the role of the
data tier that is responsible for data storage and management. There is no
direct communication with this third tier from the client tier; the third tier
communicates only with the middle tier.
The advantage of a three-tier architecture is that it reduces
communication bottlenecks and single points of failure and improves
distributed computing performance.

An Architecture with n Tiers


In an architecture with n tiers, which is commonly known as a multitier
architecture, is an upgrade of the architecture with three tiers in which
server responsibilities are further divided into layers or tiers and each layer
has a specific responsibility.
Suppose the application design is broken down into five parts; then it
becomes a five-tier application architecture. The three-tier architecture is
an example of n-tier architecture.

9
Chapter 1 Welcome to The World of Containers!

Peer-to-Peer
The peer-to-peer architecture eliminates the roles of client and server
because, in this architecture, there is no separate node that performs the
role of a server and there is no separate node that performs the role of a
client; any node can have the role of a client or a server.
The peer-to-peer architecture is the closest form of a decentralized
system. In peer-to-peer architecture, since any node can play the role of a
server or client, the scalability of peer-to-peer architecture is the highest.
Blockchain and instant messaging are the best examples of a peer-to-peer
architecture.

What Is Cloud Computing?


Simply put, cloud computing is the delivery of computing resources on an
on-demand basis, and the client pays on a usage basis. These computing
resources could be ready-to-use applications, servers (either physical or
virtual machines), storage, networking, etc. A cloud provider hosts these
computing resources at a remote data center and makes them available
over the Internet on an on-demand basis.
The cloud computing model is in contrast to the traditional on-­
premises IT model, where organizations either pay huge up-front costs to
purchase the expensive infrastructure or pay heavy monthly bills for all
the infrastructure they have rented or leased, irrespective of whether it is
used. In this way, cost savings are among the many advantages of cloud
computing. Another big advantage of the cloud computing model is that it
makes infrastructure provisioning very rapid. With cloud computing, the
provisioning of resources can be achieved in just a couple of mouse clicks
and within a few seconds or minutes, which is in contrast to the traditional
on-premises IT model, where clients need not go through a tiresome
bureaucratic process and wait for days or weeks to get the requested
infrastructure resources.

10
Chapter 1 Welcome to The World of Containers!

Virtualization and distributed architecture are enablers of cloud


computing. And, containerization and the microservices architecture are
complementary technologies that, when combined, provide a very cost-­
effective, scalable, and fault-tolerant application ecosystem.

What Are the Types Of Cloud Deployment Models?


Broadly, cloud deployment models can be categorized as follows:

• Public cloud model

• Private cloud model

• Hybrid cloud model

A public cloud is a cloud deployment model in which a cloud provider


makes all the computing resources available to users over the Internet.
Google Cloud by Google, Azure by Microsoft, and AWS by Amazon are
examples of public clouds. A private cloud is a cloud deployment model
in which a cloud provider makes all computing resources available to the
client on-premises in the client’s data center. Many companies opt for
private clouds for security and regulatory compliance reasons. A hybrid
cloud deployment model is a cloud deployment model that combines both
public clouds and private clouds.

What Are the Types of Cloud Services?


Broadly, cloud deployment models can be categorized as follows:

• Infrastructure as a Service (IaaS)

• Platform as a Service (PaaS)

• Software as a Service (SaaS)

In IaaS, complete infrastructure—storage, networking, physical


servers, etc.—is rented, and the client is responsible for setting up and
managing everything. In PaaS, infrastructure is managed by the cloud

11
Chapter 1 Welcome to The World of Containers!

provider, and the client gets an environment for developing and delivering
applications. In SaaS, the client gets on-demand access to ready-to-use
applications over the Internet.

What Is Containerization?
Containerization is a form of virtualization, because they both allow for full
isolation of applications from underlying infrastructure so that they can
be operational in different types of environments. With containerization,
we can bundle all of the components of an application needed to run the
code into a single lightweight executable called a container and run it in an
isolated user space on the same shared operating system.
The idea of containerization and process isolation has been around
for a long time, but the architectural shift to microservices and the release
of the open-source Docker Engine accelerated the widespread adoption
of this idea. Another major reason for the widespread adoption of
containerization is that it makes the application totally portable. Once we
have packaged all the components of an application into a single container
image, we can run this image in any environment as long as there is a
container runtime in that environment. The way the JVM makes the Java
platform independent, similarly containerization makes applications
“write once and run anywhere.”
There are many use cases for containerization, but the most popular
ones are microservices and multicloud deployment.

What Is the Open Container Initiative?


The Open Container Initiative (OCI) is an open governance framework
created specifically to develop an open and common industry standard for
container runtimes.

12
Chapter 1 Welcome to The World of Containers!

The rapid growth in interest and use of container-based solutions


has necessitated the development of container technology standards
and methods to bundle the application code. Docker and other
container industry leaders established the OCI in June 2015. The runtime
specification, image specification, and distribution specification are
the three specifications that currently make up the OCI. The image
specification outlines standards for the creation of a container image. The
OCI image specification contains an image index, an image manifest, a set
of file system layers, and a configuration. The distribution specification
outlines how to facilitate and standardize the distribution of content.
The advantage of the OCI standard is that you can easily move your
application between OCI-compliant container runtimes.

 hat Are the Advantages of Containerization


W
Over Virtualization?
Figure 1-4 illustrates the advantages of containerization over virtualization,
which we will explore in detail in this section.

Figure 1-4. Containerization versus virtualization

13
Chapter 1 Welcome to The World of Containers!

These are the advantages:

• Portability: One of the biggest advantages of


containerization over virtualization is portability.
A containerized application will run the same in
all environments, whether it is development or
production, as long as there is an underlying container
runtime running in that environment. And that is
because a containerized application has everything it
needs to run. This is much like how the JVM makes the
Java code platform independent.

• Isolation and allocation: In the case of virtualization,


you cannot put applications in certain resource
boundaries. But with containerization, you can specify
the resource limits of containers, thereby putting
resource boundaries on the application itself. Please
note that here the comparison is between virtualization
and containerization technologies to provide resource
limits directly on the applications; this comparison is
not with runtimes like JVM, which provide an option
to limit memory usage. And even if we compare it with
runtimes like the JVM, with JVM there is no option
to specify CPU and other resource limits, which is
possible in the case of containerization.

• Better fit for microservices: Containerized applications


are an excellent fit for the microservice architecture
because we can deploy and scale containers
individually. So, with the microservices architecture,
we can decompose our application into smaller
services and run each of these services inside a
container that can be scaled up or down as per request
traffic requirements.

14
Chapter 1 Welcome to The World of Containers!

• Scalability and speed: Containers can be created,


replicated, or destroyed much faster as compared to
hypervisors because the OS kernel is shared among
applications. Please note that how fast a container
can start will depend on the size of the application,
but typically containers can start within a few seconds
while virtual machines can take a couple of minutes.
And since containers are lightweight and faster to re-­
create, scaling containers is much easier than scaling
virtual machines.

• Resource efficient: Since containers (container images,


to be more precise) include only the applications
really needed to run, they are much smaller in size as
compared to a virtual machine, and this allows the
underlying machine (whether physical or virtual) to
run more containers on the same server capacity.

• Fault isolation: Each container running on a


container runtime runs in isolation from other
running containers; therefore, if one container fails,
then it doesn’t impact the working of other running
containers. In fact, this is an advantage in the sense
that if we have an e-commerce application with three
services (in turn, containers): account, billing, and
catalog. If for whatever reason the account container
has crashed, then users can still do cataloging and
billing. Please note that fault isolation is not the same
as fault tolerance. Containers themselves don’t provide
fault tolerance, but container orchestration systems like
Kubernetes do.

15
Chapter 1 Welcome to The World of Containers!

• Automation: Designing an automation solution that


would work seamlessly across different platforms and
resources is easier with containerization as compared
to virtualization.

 an Containerized Applications Run


C
on a Cloud Infrastructure?
Yes. Containerized applications don’t depend on the type of hardware
infrastructure. Underlying hardware infrastructure can be our own laptop
or cloud infrastructure spread across multiple data centers.

What Is the Microservices Architecture?


Microservices (or the microservices architecture) is a cloud-native
architectural approach in which an application is decomposed into many
loosely coupled and independently deployable services.
The microservices architecture has many characteristics, but the
following are the most essential characteristics of any microservices
architecture-based application:
• Each application service should be independently
deployable.

• There should not be any tight coupling between the


services of the application. This basically means that if
a change is needed in one service, then another service
should not be significantly impacted.

• Each service should be built around a single business


function or use case.

16
Chapter 1 Welcome to The World of Containers!

• Each service should be designed for failure without


bringing down the complete application. This basically
means that if a service crashes or fails, then the entire
application should not come down.

• Each service should communicate with the other using


a lightweight protocol like HTTP and a lightweight data
exchange format like JSON.

• Preferably, all interfacing with all the services should


pass through some API Gateway.

Figure 1-5 is a simple graphical depiction of the microservices


architecture.

Figure 1-5. Microservices architecture

The microservices architecture has many advantages, but the following


are some fundamental ones:

• Easier to build: The whole idea behind the


microservices architecture is to break down a big
application into smaller pieces, so it gets easier to build
smaller pieces. Different teams can work on each piece
with a total focus on a single business function.
17
Chapter 1 Welcome to The World of Containers!

• Easier to deploy: Since services in a microservices


architecture are smaller, they will have fewer
environmental dependencies and other complications
related to deploying a large application, making them
easier to deploy.

• Easier to maintain: If a bug arises in a large application,


then it can become a major challenge because of so
many moving parts, but if the application size is small,
then it becomes easier to find issues and maintain the
application.

• Higher performance and scalability: Most commonly,


each of the services of the microservices architecture
gets deployed on a containerized platform, and
containers inherently provide performance and
scalability.

Microservices vs. Monolithic


The microservices architectural approach is in contrast to the
monolithic architectural approach, in which everything is bundled into
one application and shipped as a single deployable unit. The biggest
disadvantage of monolithic architectural approach is that if one part of the
application fails or crashes, it brings down the entire application because
everything is tightly coupled. The microservices architecture remedies this
problem by promoting cohesion and loose coupling.

Microservices vs. SOA


The microservices architectural approach is also contrasted with the
service-oriented architecture (SOA) architectural approach, in which
reusable components are designed via service interfaces. The central
component of SOA architecture that performs integrations between

18
Chapter 1 Welcome to The World of Containers!

applications is an enterprise service bus (ESB). The biggest disadvantage


of this architectural approach is that over time, the system can become
more and more complex and end up with several interdependencies
between services. To sum up, SOA architecture is around integration and
has enterprise-wide scope, while microservices are around application
design architecture and have application-wide scope.

 ow Is Containerization Different from the


H
Microservices Architecture?
I think it is incorrect to compare containerization and the microservice
architecture. Containerization and the microservices architecture are not
competing technologies but rather complementing technologies. Using
a microservices architecture, an application is broken down into smaller
services, and then each service is deployed in a separate container that can
be scaled up and down as per the requirements.
A container is a key component of the microservices architecture, and
other key components and technologies are Kubernetes, API gateways,
and messaging.

What Is the Future of Containerization?


Even though containerization has taken center stage in the last decade,
I still think the future of containerization is just getting warmed up.
Eventually, almost all applications (whether enterprise applications or
small applications) will get containerized to take maximum advantage
of the cost benefits offered by the cloud computing model and ease of
application maintenance and scalability.
Many prominent technology research firms have done numerous polls,
and all of the results agree that containerization is the way of the future.

19
Chapter 1 Welcome to The World of Containers!

Understanding Key Container Technologies


In this section, we will understand two key container technologies: Docker
and Kubernetes. We will also discuss Red Hat’s OpenShift Container
Platform (OCP) and what is it means to be “cloud-native.”

What Is Docker?
Docker is an open-source platform that allows you to develop, run, and
ship containerized applications. Simply put, Docker is a container runtime
that enables you to package all your application code along with its
dependencies (external as well as system) into an image and then create
containers by running the image.
A container runtime is a piece of software that knows how to run a
container from a container image. Docker is one of the most popular
container runtimes. There are other popular container runtimes, such as
the following:

• CRI-O: A Kubernetes Container Runtime Interface


(CRI) implementation that makes it possible to use
runtimes that are compliant with OCI standards.

• containerd: A Cloud Native Computing Foundation


(CNCF) project and another open-source container
runtime, which was introduced as an alternative
to Docker with its significant focus on simplicity,
robustness, and portability.

Before Kubernetes v1.24, there was a direct integration with Docker


Engine using a component named Dockershim. Kubernetes v1.27 requires
that you use a runtime that conforms to the Container Runtime Interface.

20
Chapter 1 Welcome to The World of Containers!

What Is Kubernetes?
Kubernetes allows you to deploy, scale, and manage containerized
applications in a regulated and automated manner. Simply put,
Kubernetes is a container orchestrator. Within the technical community,
Kubernetes is also referred to as K8s. Using container runtimes like
Docker, you can package your code, dependent libraries, and runtime into
an image and run it to create containers, but containers are transient; if
your container crashes, you will need to ensure that another container
is created automatically, so these are the kinds of things that a container
orchestrator like Kubernetes does. Kubernetes also enables you to do
resource management, group the containers to create clusters, etc.
There are many technologies and projects that are built on Kubernetes,
for example, Kubeflow. The Kubeflow project aims to simplify the overall
design, portability, and scalability of machine learning (ML) workflow
deployments on Kubernetes.

What Is Red Hat’s OpenShift Container Platform?


The OpenShift Container Platform (OCP) is a highly scalable Kubernetes
platform by Red Hat that allows you to develop and run containerized
applications. Using OCP, you can quickly scale an OCP cluster from a
handful of servers to hundreds of thousands of servers.
The OpenShift Container Platform has its foundation in Kubernetes,
and it integrated very well with other Red Hat technologies, which allows
you to quickly extend and move your application from a single server
or VM to any cloud environment. The OCP provides enterprise-level
enhancements to Kubernetes, such as the following:

• Hybrid cloud deployments: You can deploy your OCP


clusters in a variety of cloud deployment models.

21
Other documents randomly have
different content
here, a friendless, helpless girl--a girl whom nobody but you could
help loving for the goodness that is in her. She brought sunshine into
this house, which was gloomy enough without her. She had no
mother, no father, no friends, and you were her only protector. How
have you fulfilled your duty towards her? Shall I answer for you? You
have behaved like a tyrant, in whom all human feeling was
deadened. When she strove to love you, you compelled her, by
harsh words and cold looks and repellent acts, to hate you. She has
good cause for her feelings towards you now, for you did your best
to make every hour and every day of her life a misery to her. She
told me herself that she was only happy out of the house; so that
you did your work well. If you saw faults in her which no one else
saw, and which had their birth in your own hard unfeeling nature,
what right had you to torture her in the way you did? She was but a
child, and you are an old man. Why could you not have dealt
tenderly and gently by her? Ask my mother--ask Miss West--ask any
of her friends--if there is anything in her character that might not be
turned to good account? But you could not see it. Lightheartedness
and an innocent flow of spirits are crimes in your eyes. You made
her pay bitterly for the shelter you gave her; you have shown the
generosity of your nature in its fullest light by making her say, after
a long experience of you, that she would starve rather than enter
your house again. When you told us the story of your life, you said
you wished me to hear it because I might learn something from it. I
have learnt something--but not the lesson you wished me to learn. I
have learnt that such a life as yours, such a nature as yours, brings
desolation upon every life and nature within its influence, and that it
would be a happier fate for me to drop down dead this minute than
live as you have lived, a torture to all around you.'

'Chris, Chris!' implored my mother, with streaming eyes, and with


a gesture of entreaty towards uncle Bryan, who sat before me now,
with his head bowed upon his hands. Remember, my dear child,
remember!'
'Remember what, mother?' I cried pitilessly. 'That he has robbed
me of all that can make life dear to me--of all that is dear to me?
You should ask me rather to forget when you point to him, whom I
would teach a different lesson if he were not an old man, with one
foot in the grave. Shall I remember that he has no belief in goodness
here or hereafter--that he believes neither in God nor man? Will such
remembrances as these plead in his favour? One thing I will and do
remember--that I owe him money for the food he has given me and
you. But I will pay him to the last farthing, so that nothing may
remain between us but what I owe him for having brought misery
into my life. That is a debt that can never be wiped out. And Jessie
will pay him also; she told me she would. But for that resolve she
would not, for a long time past, have eaten a meal at his expense.
Are these the things you wish me to remember?'

I knew that I was striking him hard with every word I uttered, but
I would not spare him. I ransacked my mind to hurt him.

'And you, mother,' I said pitilessly, do you think you are just to me
in pleading for him, and in disguising the opinion you have of him?
When, knowing that all my hopes were set on Jessie, and that it was
impossible for her and him to live happily in the same house, I
proposed to make a home elsewhere where we could live in
happiness without him, did you show your love for me by saying that
we must never leave him, and that, wherever our home was, he
must share it? When he told us his story, for the purpose, as I now
see, of setting us more and more against Jessie, and I asked you
afterwards if you would like me to look on things as he does, what
was your answer? "God forbid!" you said; "it would take all the
sweetness out of your life."' (Uncle Bryan removed his hand from his
eyes at this, and raised them for one moment to my mother's white
face; there was no reproach in them, but a look of humble grateful
affection.) 'In what was Jessie wrong that she should have been
driven from us? In wishing him to go to church with us? Ask your
own heart, mother, for an answer to that, and remember what
occurred on the first Sunday night we were in this house. If I had
known then what I know now, I would have starved rather than
have accepted the shelter of his roof. Remember how, for days and
weeks together, Jessie has been submissive and tender to him,
striving by every means in her power to win his affection; and
remember how her efforts were received and rewarded. But for him
Jessie might have been my wife; you loved her, and she loved you.
How often have you told me that you saw nothing in her but what
was good! I think at one time she would have consented to share
my lot, but that dream is over now. There was an influence strong
enough to turn love into hate, and to poison all our lives. I will
remember that to my dying day, which I hope may not be far off. I
have nothing worth living for. But one thing I am resolved upon--that
while I live, those who love me shall choose between me and him.'

Josey West caught my arm suddenly and sharply.

'Are you mad?' she cried. 'Learn the lesson you want to teach
others. Look at your mother.'

She let go my arm, and stepped swiftly to my mother's side, in


time to save her from falling to the ground. Uncle Bryan made a
movement towards her, but I stood before him, and he shrank back.
My mother's strength had given way, and she had fainted. I
supported her in my arms, while Josey West loosened her dress and
bathed her face. She opened her eyes presently, and, recognising
me, pressed me convulsively to her breast.

'O my child, my child,' she sobbed, 'my heart is almost broken!'

I looked round for uncle Bryan; he was gone.

'What I did,' moaned my mother, 'I did for the best. I prayed and
hoped that time would set all things right. I see now that it was
impossible, and that I was a weak foolish woman. But I loved you,
my darling, and I would shed my heart's blood for you. What sin
have I committed that I should be punished by the loss of my dear
child's love?'
'No, no, mother,' I cried remorsefully, 'you must not say that. You
have not lost it. God forbid that it should ever be so!'

I think she did not hear me, for she slid from my arms and knelt
before me, imploring me with sobs and broken words to forgive her.
Many minutes passed before I succeeded in calming her, and then
Josey West and I assisted her upstairs to her room, to the room
which Jessie had made bright by her innocent devices.

'Jessie will never sleep here again,' I thought, with a choking


sensation in my throat. This was her room, Josey,' I said aloud.

Josey nodded gravely, and whispered to me that my mother must


go to bed, and that she ought to see a doctor. 'I hope she will not
have a fever,' said Josey.

My mother's eyes were wandering around her in a strange way;


once or twice she looked at me as if she did not know me. The
simple sound of my voice, however, recalled her to herself.

'Yes, dear child,' she said, with a smile so sad and sweet as to
bring the tears into my eyes.

'Mother,' I whispered, 'you know what has occurred?'

She considered for a moment or two; I assisted her memory.

'Jessie,' I said.

'I know now,' she replied, with a look of distress. 'Jessie has
gone.'

'Will you be strong for my sake, mother?'

'I will do anything you tell me, my darling child,' she said humbly.

'First I will go and send a doctor to you. Then I want to try and
find Jessie.'
'Dear child, do you know where she is?'

'No; and I have no hope of inducing her to return. I know she will
never come back, but I cannot rest without doing something. I shall
go mad if I stop in the house all night and make no effort to discover
her.'

'Go, then, dear child,' she said; and added imploringly, You will
come back, my darling, will you not? You will not desert me after all
these years?'

'How can you think it, mother? I will come back, but it may be
late.'

'I will keep awake for you, my darling. Say nothing more to your
uncle. Promise me that, dear child.'

'I will not speak another word to him.'

I turned to Josey West; she divined what I was about to say.

'I'll stop with your mother, if you must go. Run round to my house
first, and say I sha'n't be home to-night. And look here. If Turk's
there, you'd best take him with you. I suppose you are going to Mr.
Rackstraw's?

'That was my intention,' I said.

'Of course you know the office will be closed; but I daresay it will
relieve your feelings to thump at the door.' She spoke fretfully; but
her tone changed when she said, 'Don't think only of yourself. Have
some thought for your mother.'

'One word, Josey. You have no idea where Jessie is?'

'Not the slightest,' she replied. 'And you didn't know she was
going away?'
'I had no more idea of it than you had.'

'That night,' I said hesitatingly, 'when Mr. Glover was at your


house----'

'Oh,' she interrupted in a sharp tone, Mr. Glover! Well, what


night?'

'A little while ago, when Jessie was there, and I was not. Did he
pay her great attention?'

'Of course he did.'

'Did he seem fond of her?'

'It wouldn't have been natural otherwise,' she replied, with a


suspicious look at me. 'Of course he seemed fond of her. Anything
more?'

'No,' I said, with a sigh; 'that's all.'

I kissed my mother, and left the room. Her loving eyes followed
me to the door.

CHAPTER XXXVII.

TURK MAKES A CONFESSION.

I found Turk at his sister's house. He jumped up at once on my


proposing that he should take a walk with me.
'I am glad of the opportunity, Chris, my boy,' he said; 'for I want
to talk to you.'

I answered, in as lively a tone as I could command, that I was at


his service.

'Like a true friend as you are. The subject I want to talk about is
spelt with four letters--s-e-l-f. Such a subject needs no overture; up
with the curtain, then. I start with a self-evident proposition. A man
must live. What do you say to that?'

I had nothing to say in contradiction.

'Very well, then. To live, one must have money; to have money
(barring the silver spoon), one must work for it. Granted?'

'Granted,' I assented listlessly. He looked at me in surprise at my


despondent tone.

'Ah,' he said, 'there's more in that than meets the eye.'

'More in what, Turk? In your proposition?'

'No, Chris, my boy. In your face. You are in trouble.'

'I am, Turk; in the deepest, most terrible trouble. I am utterly,


utterly wretched. I have nothing in the world worth living for.'

'It's bad when it comes to that,' he said, with an expression of


deep concern. 'Money?'

'No, Turk.'

'Heart?'

My silence was a sufficient answer.


Is the trouble of such a nature that it may be confided to a friend-
-to a friend with a kindred soul, Chris, my boy?'

'I will tell you about it presently, Turk. Go on with your own story
first.'

'In one act, then. Without detail. Since that ever-to-be-


remembered night when a strong verdict was pronounced against
me on the other side of Temple Bar--in which direction, by the bye, I
see we are walking now--and when I determined to relinquish the
profession in which I glory--I do, Chris, I glory in it; and you can
hardly have an idea of the sacrifice I have made in giving it up--I
have been looking about me. Not having been born with that silver
spoon in my mouth, I can't afford to be idle. Well, to be brief,
something that will suit me has come in my way, and I have
snatched at the chance. The affair will be settled to-morrow. Near
the theatre in which I made my first and last appearance in the new
and original drama which was played for the first and last time is a
theatrical wig and hair shop, with a shaving connection attached. To-
morrow that shop and that connection will be mine. That's the head
and front of my story. But there's something more. I have a friend of
yours to thank for it all.'

'A friend of mine!'

'Two, I may say--one fair, one dark. I do perceive here a divided


duty. But we'll speak of that anon.'

'No; tell me now. What friends do you mean? I haven't many.'

'You have one who stands for a host. If she were such a friend to
me, I wouldn't call the king my uncle.'

'She!'

'I see you must hear it. Briefly, then, this was the way of it. The
business was for sale, Chris, my boy. Money had to be paid for it--
not much, but too much for a poor actor whose purse has always
resembled a sieve. I had saved a little, but not more than half what
was required for the purchase of the goodwill. I mention this in the
presence of these friends of yours----'

I interrupted him.

'Don't let us have any mystery, Turk. Who are they?'

'Jessie the peerless and Mr. Glover.'

I started. Turk continued:

'I mention this in their presence, and lament my impecuniosity.


Jessie sympathises with me--wishes that she had money, so that she
might help me. She has a heart of gold, Chris, my boy, a heart of
gold. Two or three days afterwards, Mr. Glover sends for me--says he
has been considering the matter, and that he is disposed to assist
me. He goes further than being disposed to do it--he does it. In
short, he provides half the purchase-money, and there we are. It is a
matter of business, Chris, my boy. I asked him to make a matter of
business of it, and he said he intended to do so; and he has. Mr.
Glover is a moneylender, and he lends me the money at ten per
cent. But there's one thing I'm certain of. He wouldn't have done it
but for Jessie.'

I reflected with some bitterness on this information.

'Are you certain of that, Turk?'

'Morally certain, that is all. For when I thanked Jessie, she


modestly averred that all that she did was to express a wish that she
had a friend who would assist me. And now, Chris, my boy, unbosom
yourself. What's your trouble?'

'Jessie has left our house, Turk.'


He gave me a look of deep concern. 'What do you mean by that,
Chris, my son?'

'She has left us, never to return--left us suddenly, without


explanation.'

And then I narrated to him, in detail, all that had occurred,


omitting only what had passed between me and uncle Bryan. Still
when I mentioned his name, which was necessary several times in
the course of my narration, I spoke of him with sufficient bitterness
to make Turk aware of the terms upon which we stood to each
other.

Turk, growing more and more serious as I proceeded, listened to


me without interruption, and pondered deeply. By the time I had
finished he had become very serious indeed, and there was an air of
gloom upon him which somewhat soothed me.

'There is more in this than meets the eye,' he said; and added,
somewhat unnecessarily as I thought, 'Bear with me a little while,
Chris, my boy,' for I felt that such a request more properly belonged
to me than to him. But he explained his meaning presently.

'You have given me your confidence, Chris, my boy, and you want
me to stand by you.'

'I do, Turk.'

'And I will stand by you, as you have stood by me--I don't forget
the big stick you bought, Chris, to assist me on a certain eventful
night'--(here I was stung reproachfully by the remembrance of my
cowardly behaviour on that night); 'nor other occasions at the Royal
Columbia when you led the applause like a true friend. I'll stand by
you, my boy, but you must first hear my confession.'

I did not wish to hear his confession; I wished to continue talking


only of myself and Jessie, but I was bound to listen.
'As before, Chris, in a very few words. I knew that you loved
Jessie, but I scarcely thought that your passion was as strong as it
is--as powerful, as deep----'

'No words can express its strength and depth, Turk,' I said, in a
tone of gloomy satisfaction.

He nodded, as if he fully understood me, and continued: Well,


others may love as well as you, Chris.' I looked at him in jealous
curiosity. 'I shouldn't be true to you nor to myself if I didn't confess
it before we proceed to the consideration of the state of affairs. I
love her, also.'

I started, and let go his arm.

'Don't do that, Chris, my boy,' said the honest fellow; 'it's


nobody's fault but my own. I know that I can't stand in comparison
with you. You are ten years younger than I am--you are handsome,
clever, bright; and I--well, I am a failure. That's what I am, Chris; a
failure. Even if you were out of the way, which I don't for one
moment wish, curious as it may sound, I think I should stand but a
poor chance with such a beautiful creature as she is. I am not a
hundredth part good enough for her.'

'No one is, Turk,' I said, somewhat mollified.

'No; I won't say that. I think that some one whom I know is good
enough' (he pressed my arm sympathisingly); 'and besides, you
have a claim upon her. You mustn't be surprised or hurt at my loving
her, Chris; I could mention half a dozen others who are in the same
boat. You see, one can't help loving her, she is so bright and
winsome. Why, if she were mine--which she isn't, and never will be--
I think I should take a pride in knowing it, for it would make her all
the more precious to me. That is how the matter stands with me,
Chris, and I think it's right that you should know it. I give her up, not
without a pang, my boy, but freely; I am used to disappointments,
and I shall bear this as I have borne others.'
'But you never had any hope, Turk,' I said, disposed, after his
magnanimous conduct, to argue the matter with him.

'No, not to speak of,' he replied, with a melancholy sigh. 'If I can't
be Jessie's lover--don't be angry with me for using the word--I can
be her friend, and yours. It rests with you to say the word. If you
know enough of Turk West to trust him, say so, Chris, and he
pledges himself to act faithfully in your interest. He may be of more
use to you than you imagine. Well?'

'I should be an ungrateful brute not to say that I accept your offer
thankfully, Turk.'

'That's settled, then. Shake hands on it. And now, Chris, we'll be
silent for just two minutes, and then we'll go into the matter.'

At the end of that time he resumed.

'I said that there was more in your story than meets the eye,
Chris, my boy; and there is. Jessie disappears on your birthday,
suddenly, without any forewarning. This morning everything was
nice and pleasant with all of you at home.'

'With the exception of uncle Bryan,' I interrupted; 'you mustn't


forget that.'

'I don't forget it, but then he is the same as he usually is, and
there's nothing unusual in that. She is affectionate to you; she is
affectionate to your mother; and I think that she couldn't have
avoided seeing that there was to be a little celebration of her
birthday to-night. Well, it is plain to me that this morning she had no
idea of going away. Now what has occurred since this morning to
cause this sudden change in her? That's the first thing to consider.'

I could not think of anything. Jessie had not been out of our
house.
'There's something I have not told you, Turk, but I don't see what
it can have to do with Jessie's going from us. We were talking
together once, when Jessie said that she wondered that I had never
asked her any questions about herself--she meant about herself
before she came to live with us. I answered that mother had desired
me not to do so, because uncle Bryan might not like it.'

'What had he to do with it? asked Turk.

'I don't know, but mother said he might have secrets which he
would not wish us to discover. When I told this to Jessie, she said
that she had a secret, but didn't then know what it was. It was in a
letter which she was not to open until she was eighteen years of
age--until to-day. Then she said she would tell me everything.'

'There's a mystery somewhere,' said Turk, pondering; in that


letter perhaps.'

But I could not agree with him. Eager as I was to receive any
impressions which would divert my suspicions from the current in
which they were running, I could not see the slightest connection
between the circumstance I had just mentioned and Jessie's
absence. By this time we were at Temple Bar.

'Where are we going?' asked Turk.

'To Mr. Rackstraw's,' I answered. 'Jessie has been taking lessons


of him, you know. He may be able to tell us something about her.'

Turk shook his head. 'There are two strong reasons against the
realisation of that expectation, Chris. First, Jessie has not been there
to-day, according to your own statement; second, Mr. Rackstraw's
office closes at five o'clock.'

But we may be able to discover where Mr. Rackstraw lives.'

'Well?'
'Well?' I echoed, irritated at his seeming discouragement of my
plan. 'Turk, can't you see that I'm almost mad with misery. I thought
you were a friend----'

'And am I not? That's news to Turk. What good can you do by


finding out Mr. Rackstraw's private address?'

'He may tell me where Mr. Glover lives.'

'And then?' demanded Turk, in a grave and sorrowful tone.

I turned from him petulantly. 'If you do not care to understand


me,' I said, 'I had best go alone.'

I walked swiftly onwards towards Mr. Rackstraw's office, Turk


following me at a distance of a few paces.

Mr. Rackstraw's office was situated in a quiet narrow street in the


rear of Covent-garden. It was closed, as I expected it would be, and
although I rang all the bells on the door for fully ten minutes, I
received no answer. Turk stood quietly near me, without speaking. I
was heartily ashamed of myself for my treatment of him, and I made
an attempt at reconciliation by holding out my hand to him as I
turned disconsolately from Mr. Rackstraw's door. He took my hand
with affectionate eagerness.

'I can't find it in my heart,' he said with rough tenderness, 'to be


angry with you; but I ought to be.'

'I am ashamed of myself for behaving so badly to you, Turk, but I


couldn't help it. I think I am ready to do any mad or foolish thing.'

'Oh, I don't care about myself. I have a stronger reason for being
angry with you. Who of we two should be Jessie's champion? You, I
should say. Yet I am obliged to defend her from your suspicions. If
you were ten years older than you are, I should quarrel with you,
Chris; I would with any other man who dared to say a word against
her.'

'Who has said anything against her?' I demanded hotly.

'You, in coupling her name with Mr. Glover--you, even in the


expression of the idea that Mr. Glover has had anything to do with
her disappearance. I don't want you to be ashamed of yourself for
treating me badly, but you ought to be for your suspicions of her.'

'You don't know what I know, Turk. I am bringing no charge


against Jessie--God forbid that I should; I love her too well, and
think of her too highly. But Mr. Glover has been paying court to her
from the first day he set eyes on her.'

'What if he has? Is that her fault? Aren't you old enough yet to
know that there are hundreds of men always ready to run after a
pretty girl? Now, I daresay it has hurt you to hear that Mr. Glover
has helped me into my new business because Jessie expressed a
wish that she had a friend who would assist me. Why, what was
more natural than that she should say so, out of her kind heart, and
what was more natural than that he should be glad of the
opportunity of obliging her, and of doing a fair stroke of business at
the same time? It isn't a large sum that he advances--a matter of
seventy-five pounds only, and he has a bill of sale, and goodness
knows what, all for security. Now you are better satisfied perhaps. I
can't say that I am over-fond of Mr. Glover, but he is said to be an
honourable, straightforward man. I'll tell you what I'll do, if you must
see him----'

'I must,' I said firmly.

'I don't know where he lives, but I'll take you to a theatre that he
often pops into of an evening; he may be there. The acting-manager
is one of my new friends, and will pass us in, I daresay, or will be
able to tell us if Mr. Glover is in the theatre.'
CHAPTER XXXVIII.

MR. GLOVER DECLINES TO SATISFY ME.

The friend to whom Turk referred was, fortunately for us, in the
lobby of the theatre, and as the two were engaged in conversation,
the man I came to seek lounged towards us. He seemed surprised to
see me, but approached me quite affably, and asked what I was
doing in his part of the world so late in the night. I made some sort
of awkward, bungling answer, and then he recognised Turk.

'You, too, Turk,' he said in his slow way; 'but that is natural, for
these are your quarters now. Let me see. You take possession to-
morrow?'

'Yes,' Turk answered, everything was settled, and he went into his
new place of business early in the morning.

'And how is business with you?' asked Mr. Glover, directing his
attention to me again.

I answered that it was very good, and that I had nothing to


complain of in that respect.

'You have nothing to complain of in that respect,' he said,


glancing from me to Turk and from Turk to me, and appearing to be
seeking for some solution of the circumstance that we were in
company together. When he was in any doubt, he had an irritating
habit of repeating the last words spoken by the person he was
conversing with, which gave him time to think of his own words in
reply. 'That must be very satisfactory. I hear good accounts of you.
You will get on, I should say, if you are steady and straightforward,
and if you keep a good name. That is everything in this world. A
good name--a good name. But what brings you out to-night? Have
you business in this quarter too?'

'No,' I said; 'I did not come out for business.'

'You did not come out for business. For pleasure, then. Well,
young men will be young men.'

'To tell you the truth, sir,' I said----

'That's right, always tell the truth,' he interrupted, speaking from


a height, slowly, and coolly, and patronisingly, as though he were
truth's conservator, and was glad to hear that it was being practised.
'Yes, to tell me the truth----'

'I came out partly for the purpose and in the hope of seeing you.'

With his hand playing with his moustache, he looked not at me,
but at Turk, for an explanation. Turk, however, had nothing to say.

'You came out for the purpose and in the hope of seeing me. Yes.
Have you brought me any message?'

'Did you expect one, sir?' I asked quickly.

'Did I expect one? No, I cannot really say that I did; but I should
not have been surprised. Go on,' he said, with gentle
encouragement.

There were some persons passing us occasionally, and I moved to


a more retired spot. I saw that he was curious, and I saw that his
curiosity increased at this movement.
'You seem agitated,' he said. 'Turk, our young friend here seems
agitated. Take your time--take your time. If you are going to beg a
favour, I shall be glad to assist you in any way in my power--in any
way in my power.'

'I have not come to beg any favour of you, sir. I only came to ask-
---'

But I hesitated here; the justice of Turk's reproach came upon me


with great force, and I was conscious that the words I was about to
utter might be construed into an ungenerous suspicion of Jessie. If
they reached her ears from the lips of one who was not well
disposed towards me, I should sink for ever in her esteem.

'Take time--take time,' said Mr. Glover, outwardly quite at his ease.

Turk came to my rescue here. He divined my thoughts, and the


cause of my hesitation.

'Perhaps, Mr. Glover,' said Turk, 'if you would not mind regarding
what passes as confidential, and not to be mentioned to any one
else, Christopher would be more at his ease.'

I gave Turk a grateful look.

'Christopher would be more at his ease,' repeated Mr. Glover. 'This


really is very mysterious. I don't see any objection. Then you know
what he is going to say?'

'I know the subject he wishes to speak upon--but I was not aware
of it when I first came out with him to-night.'

'Is it such a subject as ought to be spoken of in confidence


between us?'

He totally ignored me, as if my opinion on the point were of the


smallest possible value.
'I think so,' replied Turk, 'if it be spoken of at all.'

'You have your doubts as to the judiciousness of the


communication our young friend is about to make?'

'I have; and I have told him so.'

'Oh, you have told him so.'

He appeared to me to debate within himself whether, under such


circumstances, he should listen any further; but his curiosity
overcame his evident wish to baulk me.

'You may go on,' he said to me, with a condescending wave of his


hand.

'It is understood, then,' I said, somewhat more boldly, 'that what


we say to each other is quite private and will not be repeated?'

He stared at me very haughtily, and bent his head, and stood


before me, with his fingers to his lips, waiting for me to speak. A
singular fancy occurred to me at this moment as I gazed at him--a
fancy which need not here be mentioned; it lingered in my mind
then and afterwards, although I strove to dismiss it on this occasion
as being utterly wild and out of all reason. But, in conjunction with
another circumstance, which came to light in the course of time, it
led to a strange discovery.

'I have not come to make any communication,' I said; 'I have only
come to ask a question. I can speak more freely now, as you are a
gentleman, and as what I say will not reach her ears.' (His lips
repeated 'Her ears,' but he did not repeat the words aloud.) 'It is
about Miss Trim'----

'About Jessie,' he said, in a lighter tone. 'Yes; what about her?'

'Do you know where she is?'


His looks were disturbed now, although he strove to be cool.

'Do I know where she is?' he repeated, with a contraction of his


eyes.

'That is what I have come to ask.'

'Oh, that is what you have come to ask.'

'There is no need for me to repeat the question, I suppose,' I


said, controlling my desire to strike at him, for his manner was in the
last degree contemptuous, notwithstanding that the interest he took
in the conversation was evidently strengthened.

'No; I understand the English language, and you will be kind


enough to understand that I am not in the habit of being
questioned. There is no need for you to repeat the question, but
there is a need for my asking why it is put to me.'

'Then you do not know?'

He would not give me the satisfaction of a simple answer.

'Let me see,' he said, in a musing tone, 'to-day is her birthday.'

'You do know that.'

'She told me herself; these things are not guessed at.'

'You have not answered my question,' I said, trembling from


passion and from a sense of helplessness.

'You have not answered mine,' he replied. 'I ask you why you put
it to me?'

Turk motioned to me that I ought to tell him, but I could not


speak.
'Perhaps I had best explain,' Turk then said. 'This is Jessie's
birthday, as you know, and Christopher and his mother had prepared
a little feast in honour of it.'

'After the manner of such people,' observed Mr. Glover, with a


sneer and a laugh, which set my pulses beating more quickly. Turk
took no notice of the observation.

'My sister Josey was invited, to please Jessie, and Chris had a
little present to give her----'

'Exceedingly pretty and pathetic,' interrupted Mr. Glover. 'It would


make a charming domestic scene in poor life, if it was placed on the
stage. These commonplace circumstances tickle the fancy, and
please sentimental persons, whenever they are presented in an
unreal form. In real life, of course, there is nothing very attractive in
them--often the reverse, I should say. But the picture you have
drawn would be a failure even on the stage, if there was nothing
exciting to follow. We want a "situation," Turk.'

'We have one ready,' responded Turk. 'Without warning, and most
strangely and suddenly, Jessie leaves her home. Her friends suppose
she has gone out for a walk, and are waiting for her with
uneasiness, which grows stronger as the time goes on and Jessie
does not return. While they are waiting, a letter comes----'

'Are you concocting a plot?' asked Mr. Glover.

'I am telling you exactly what has occurred. A letter is received


from Jessie, in which she says that she has gone away, and never
intends to return. Chris, in his anxiety, has come to see you, in the
hope--or the fear--of hearing some news of her.'

I had been watching Mr. Glover's face all the time Turk was
speaking, but it was impossible for me to decide whether he was
acting or not. The only change I observed in him occurred during
Turk's last words; then a little light came into his eyes, which might
have been construed into an expression of triumph.

'And Chris, in his anxiety,' he said, has come to see me in the


hope--or the fear--of hearing some news of her. Which is it?' he
asked, turning to me; 'hope or fear?'

'Fear,' I replied unhesitatingly.

'What do you suspect me of?' he continued politely; 'running


away with her? You don't answer. Afraid to put it into words. But
that's the plain English of it, isn't it? You did a wise thing in
stipulating that what passes between us is to be kept private, or I
might have been tempted to tell the young lady in question
something which would not be pleasant for her to hear. Had you
known what is due to a gentleman from one in your station of life, I
might have been induced to satisfy your inexplicable anxiety
concerning her; as it is, I decline to do so. She would be both
amused and angry to learn that you have set up some sort of a
claim upon her, as if there could be any community of feeling
between you. You seem to forget that she is a lady, and that you--
well, that you are not a gentleman. Take this piece of advice from
one who is competent to give it--go home and stick to your bench,
and don't presume to cast your thoughts on what is not only beyond
your reach, but immeasurably above you. Good-night, Turk.'

And with a contemptuous glance at me, Mr. Glover walked away


in a very leisurely manner.

CHAPTER XXXIX.
A NEW FEAR.

I walked home in the most sorrowful of moods. Turk accompanied


me part of the way, but when he began to speak in Mr. Glover's
favour, I said that I would prefer to walk by myself. The good fellow
took the hint, and would not notice my churlishness.

'I know, I know, old fellow,' he said, shaking hands with me; 'but
you might count me as nobody. Never mind, Chris, my boy, you
won't find many better friends than Turk West; and he's not to be
shaken off, let me tell you.'

I reflected with bitterness that I had not one friend who thought
as I thought. Everybody was against me, and I was distrusted and
misunderstood even by those who should have held to me most
closely. I walked for miles out of my way, almost blindly, seeing
nothing, hearing nothing, feeling nothing, but my own despair and
grief. The streets were very still as I approached our house, and I
lingered about the spots where Jessie and I had lingered and talked
in the days that were gone.

Josey West opened the door for me. Her face was very grave.

'Well?' she said.

'I have heard nothing, Josey. She has not come home?'

'No.'

A peculiar accent in her voice struck me.

'How is mother?' I asked.

She closed her lips firmly, and looked at me seriously and


reproachfully. I rebelled against that look; my heart was full almost
to bursting.

'Why don't you and those who were my friends say what you
think of me?' I demanded bitterly. 'Why don't you say at once that I
am to blame for all that has occurred, and that I, and I only, am the
cause of all this misery?'

'I don't say so,' she replied gently, 'because I don't think so.'

'But you look at me as if it were so,' I said loudly; 'you and all the
others. You have fair words and fair excuses for every one but me---
-'

She placed her fingers on her lips. 'Hush!' she said; 'don't be cruel
as well as unjust.'

Her hand was on my arm, and I shook it off roughly. 'Who is the
just one? Uncle Bryan? I will talk to you no more. How is mother?'

'Go up and see; but tread softly. You are not the only sufferer--
remember that.'

I went upstairs, and into my mother's room, softly. Josey West


followed me.

'Mother,' I said.

She opened her eyes and looked at me vacantly. She did not
know me; even when I took her hand, and fondled it in mine, she
showed no sign of recognition. Then a feeling of desolation, more
terrible than any pain I had yet suffered, entered my heart, and I fell
on my knees by her side. Was I to lose her next? It seemed so. Her
white pitiful face, her parched restless lips, her mournful eyes gazing
on vacancy, her hot skin, were like so many tongues reproaching me
for my selfishness.
'For God's sake tell me, Josey,' I whispered, 'how long has she
been like this?'

'The change came a little while after the doctor left. She bore up
while he was here, and tried to answer him cheerfully; but when he
was gone, she broke down.'

'Did she speak, Josey.'

'A little at first.'

'What about?'

'Only about you, Chris; but I cannot tell you what she said. They
were only broken words of tenderness----' Josey turned from me,
and could not continue for her tears.

'Did you not go for the doctor again, Josey?'

'I could not leave her, Chris.'

'Uncle Bryan might have gone--'

I knocked at his door, and called him again and again; but I got
no answer.'

I went at once to his room, and knocked, but no answer came. I


tried the handle, and found that the door was unlocked. I entered
the room, and struck a light. Uncle Bryan was not there, and his bed
had not been lain upon. I went downstairs into my own bedroom,
and searched the house swiftly; uncle Bryan was not in it.

Did you see him go out, Josey?'

'No; I have not seen him since you left.'

'I must run for the doctor. Will you stop here?'
'I'll stop, Chris, and do all I can to help you.'

I pressed her hand, and within half an hour the doctor was at my
mother's bedside. I waited below until he came down.

'If you will walk back with me,' he said, will give you some
medicine for your mother.'

'Is she very ill, sir?'

'Very.'

My heart sank as I asked, 'Dangerously?'

'I think so, but we shall know more in a day or two.'

'Then there is no immediate danger, sir?'

'I think not--I think not; but we must be prepared for the worst.'
He said something more than this, but I did not hear him. A mist
stole upon my senses, for his quiet tone portended the worst. 'Bear
up, Mr. Carey,' he said; 'you must not give way. We will do our best.
A great deal will depend upon good nursing. That is a sensible little
woman who is with her now.'

This doctor was a man who was deservedly worshipped by the


poor in our neighbourhood; his life was really one of self-sacrifice,
for he was a capable man, was paid badly, worked hard, and did his
duty bravely.

'Can you tell me what she is suffering from, sir?'

'I was about to ask you that question Mr. Carey,' was his reply. 'All
that I know at present is that she is in a high state of fever, that her
blood is thin and poor, and that she is as weak as a human being
dare be who requires strength to battle successfully with disease. It
appears to me that she must have been suffering for some time, for
a very long time probably--but I am in the dark as to that--and that
she has at length given way. If you put upon a beam a pressure
greater than it can bear, the beam must break.'

'But I do not think my mother has worked too hard, sir.'

The mind has acted upon the body. Hard physical work itself
seldom, if ever, kills. In the case of this beam----you follow me?'

'Yes sir.'

'In the case of this beam, there have been secret inroads upon its
power of resistance, and the wood has rotted. I have seen stout
planks cut through, and colonies of little insects bared to the light
which have been steadily and surely eating away its strength. I am
speaking plainly, because I think it is the best course in all these
cases, and when I am speaking to a sensible man.'

'Thank you, sir; I should prefer to hear the truth, terrible though
it be.'

'Outwardly, these planks seem capable of bearing any pressure,


but when a great trial comes, they must give way. There are
thousands and thousands of human beings walking about, in
seemingly good health, in precisely the same condition. Has your
mother suffered any great trouble?'

'A great trouble has come upon us within the last few hours.'

'An unexpected trouble?'

'Totally unexpected, sir.'

'For which you were quite unprepared?'

'Quite, sir.'
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookmasss.com

You might also like