100% found this document useful (4 votes)
24 views

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

The document promotes the ebook 'Kubernetes Fundamentals: A Step-by-Step Development and Interview Guide' by Himanshu Agrawal, available for download on ebookmeta.com. It includes links to various other recommended digital products and outlines the structure of the book, including its focus on containerization and Kubernetes technology. The content covers fundamental concepts, architecture, and installation of Kubernetes, among other topics.

Uploaded by

senkoergerin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
24 views

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

The document promotes the ebook 'Kubernetes Fundamentals: A Step-by-Step Development and Interview Guide' by Himanshu Agrawal, available for download on ebookmeta.com. It includes links to various other recommended digital products and outlines the structure of the book, including its focus on containerization and Kubernetes technology. The content covers fundamental concepts, architecture, and installation of Kubernetes, among other topics.

Uploaded by

senkoergerin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Get the full ebook with Bonus Features for a Better Reading Experience on ebookmeta.

com

Kubernetes Fundamentals: A Step-by-Step


Development and Interview Guide 1st Edition
Himanshu Agrawal

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

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Kubernetes Fundamentals: A Step-by-Step Development and


Interview Guide 1st Edition Himanshu Agrawal

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

ebookmeta.com

Law Dissertations: A Step-by-Step Guide Laura Lammasniemi

https://ebookmeta.com/product/law-dissertations-a-step-by-step-guide-
laura-lammasniemi/

ebookmeta.com

Pro Tableau: A Step-by-Step Guide 1st Edition Seema


Acharya

https://ebookmeta.com/product/pro-tableau-a-step-by-step-guide-1st-
edition-seema-acharya/

ebookmeta.com

Collaborative Intelligence Towards the Social Organization


1st Edition Marco Minghetti

https://ebookmeta.com/product/collaborative-intelligence-towards-the-
social-organization-1st-edition-marco-minghetti/

ebookmeta.com
Representations Material and Immaterial Modes of
Communication in the Bronze Age Aegean 1st Edition John
Bennet
https://ebookmeta.com/product/representations-material-and-immaterial-
modes-of-communication-in-the-bronze-age-aegean-1st-edition-john-
bennet/
ebookmeta.com

The Art of Measuring in the Thermal Sciences 1st Edition


Josua Meyer Editor Michel De Paepe Editor

https://ebookmeta.com/product/the-art-of-measuring-in-the-thermal-
sciences-1st-edition-josua-meyer-editor-michel-de-paepe-editor/

ebookmeta.com

The Racehorse: A Veterinary Manual 2nd Edition Piet Ramzan

https://ebookmeta.com/product/the-racehorse-a-veterinary-manual-2nd-
edition-piet-ramzan/

ebookmeta.com

Gustave Flaubert 1st Edition Anne Green

https://ebookmeta.com/product/gustave-flaubert-1st-edition-anne-green/

ebookmeta.com

The Routledge Handbook of Properties (Routledge Handbooks


in Philosophy) 1st Edition A R J Fisher

https://ebookmeta.com/product/the-routledge-handbook-of-properties-
routledge-handbooks-in-philosophy-1st-edition-a-r-j-fisher/

ebookmeta.com
A Field Guide To Lies Daniel J Levitin

https://ebookmeta.com/product/a-field-guide-to-lies-daniel-j-levitin/

ebookmeta.com
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 [email protected], 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 [email protected]; for
reprint, paperback, or audio rights, please e-mail [email protected].
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
Other documents randomly have
different content
“Well, I didn’t mean to,” responded Janet. “I was wondering what
you were going to do with the shovel.”
“I’m going to dig a hole,” and Ted was very particular to put his g on
the ends of words this time, though he forgot oftener than did his
sister.
“A hole! What for?” asked Janet. “Are you going to plant something,
as grandpa does at Cherry Farm?”
“Nope. I’m just going to dig a big hole and see how deep I can make
it. Then it won’t seem so long waiting until it’s time to go to
grandpa’s.”
“Oh! Let me help?” begged Jan. “I love to dig!”
“I’ll let you shovel away the dirt I dig,” promised her brother. “But
don’t let Trouble see us.”
“Why not?”
“Because he might fall down the hole, and if I make it deep maybe
we couldn’t get him out.”
“Nora took him to the store with her,” answered Janet. “He won’t
bother us for awhile.”
“All right. Then we’ll dig.”
Part of the Martin yard was the children’s playground, where they
were allowed to do about as they pleased. Ted was fond of digging
in the sandy soil, and he often made forts, tunnels and cities in the
earth, Jan helping in this play.
Picking out a spot where the soil was soft, Ted began to dig.
“You poke the dirt away when I shovel it up,” Ted ordered his sister,
for though she sometimes told him what to do, like a “little mother”
when it came to anything like this Ted was the “boss.”
It was not hard digging, and Ted soon had a hole deep enough for
him to stand in, being down in it as far as his knees. As he was
shoveling out the dirt, which Janet pushed to one side, the iceman
came along.
“Hello, Curlytop!” he called to Ted. “What are you doing?”
“Digging a hole.”
“So I see,” and the iceman jingled his tongs. “Are you going clear
through to China?”
“Where’s China?” asked Jan.
“It’s where the laundryman does daddy’s shirts,” explained Ted.
“No, I mean the country where the Chinese laundrymen come from,”
went on the iceman with a laugh. “It’s supposed to be straight down
through this earth on the other side, you know. So, if you dig deep
enough, you may come to China,” and he passed on.
“I’m going to do it,” said Ted after a bit, during which time he had
dug so deep that only his shoulders were out of the ground.
“Do what?” asked his sister.
“Dig to China. And when I get the hole all the way through I’ll take
you with me.”
“I—I guess I don’t want to come,” said Janet slowly.
“Why not?”
She thought for a minute while Ted looked at her over the edge of
the hole.
“’Cause what are you going to stand on when you get all the way
through the hole to China? There won’t be anything there and you’ll
fall. I don’t want to fall.”
Teddy thought this over a minute and then said:
“Well, maybe I won’t go all the way to China. I forgot about falling
through. But I’ll dig a deep hole anyhow.”
And he did—so deep that at last Jan had to stand on the very edge
of it and look down in it before she could see her brother.
“Don’t go down any farther,” she begged. “You maybe can’t get out
again.”
“Yes I can,” declared Ted. “You get the little ladder we play light
street-lamps with, an’ I can climb out.”
This ladder was a side from an old wooden crib that Trouble no
longer slept in, and Ted and Jan often used it in their games.
When Jan brought this and put it down in the hole, Ted could easily
climb out.
“I guess I won’t dig any more now,” he said. “I’ll cover up the hole
with some boards, and maybe to-morrow I’ll go deeper.”
Jan helped her brother put some pieces of wood over the hole and
then she went off to play with her doll while Ted found Tom Taylor,
and the two boys played marbles in the shade.
That night, just as the Curlytops were going to bed, there was a
queer howling in the yard.
“What’s that?” asked their mother.
“It sounds like Skyrocket,” said Daddy Martin.
“Oh, it is our dog!” cried Ted. “Something has bit him.”
“Maybe he has bit some person, or maybe a cat,” said his father. “I’ll
go and see what it is.”
The Curlytops waited anxiously until their father came back. When
he did he was laughing, and he carried Skyrocket in his arms.
“I found him down in a big hole in the yard,” said Mr. Martin. “Poor
Skyrocket couldn’t get up. He had fallen through the boards that
were over the hole. I wonder how it got there?”
“I was going to dig through to China,” explained Ted, “but I didn’t
finish. Is Skyrocket hurt?”
“No,” answered Daddy Martin. “But I guess he was pretty badly
scared. Don’t dig such deep holes any more, Teddy.”
Ted promised he would not, and after he and his sister had petted
their dog they went to bed.
A few days later everything was ready for the start to Grandpa
Martin’s home in the country. Ted and Jan, dressed and ready to
start for the railroad station, were out on the front porch taking care
of Trouble.
“Well, well! you look very spruce this morning!” called the postman
as he passed the house. “Where are you going, Curlytop—you and
your brother and sister all dressed up so stylish?” and he patted
Ted’s hair, which seemed more tangled than ever.
“We’re going to grandpa’s Cherry Farm,” Ted answered.
“Save me some cherries,” begged the postman. “I love ’em, but
nobody ever sends me any in the letters I deliver.”
“I guess they’d squash and the juice would run all over if they did,”
laughed Jan.
“I guess so,” agreed the postman. “Well, good-bye, Curlytops, and
Trouble too! I hope you have a good time!”
“Good-bye!” they called to him.
A little while after this they were in the train and on the way to
Elmburg. Many of the passengers in the car looked more than once
at the curly, tousled heads of Jan and Ted, and one woman
remarked:
“Did you ever see such wonderful hair?”
“It must be a task to comb it,” said another.
“No wonder the conductor called them what he did as he passed
through,” said the first woman.
“What was it?” asked the second.
“He named them the ‘Curlytops.’ But I suppose they’re used to that
by this time. I never saw such tight curls!”
Nothing much happened on the trip, except that Trouble wanted a
number of drinks of water. Ted or Jan brought them to him in cute,
little, white paper cups, and Baby William thought they were fine to
play with, after he had emptied them.
“P’ease, Teddy, det me a dwink,” Trouble begged for about the
eighth time. “I’s fwirsty!”
So Ted brought the paper cup full of water.
“Dat’s dood! bring me annuver!” demanded Trouble, as soon as he
had drained the last drop, and piled the cup up with others on the
window-sill. “I ’ikes water!”
“Better look out or you’ll have to swim to grandpa’s if you drink
much more,” laughed Daddy Martin.
Then Mother Martin took Baby William on her lap and talked to him,
telling him a little story that sent him to Slumberland, thus giving
Ted and Jan a rest from going up and down the car aisle after drinks
of water for their little brother.
In the afternoon the train reached the village, and there was
Grandpa Martin smiling and looking eagerly at each coach to get the
first glimpse of his loved ones.
“Well, well! Here you are! Here you are!” he cried as he saw them.
“Right over this way is the team! Pile in! Pile in!”
The patient horses stood waiting. The big wagon held the whole
family, trunks and all. Jan and Ted looked curiously at their
grandfather at first, as if to see whether his trouble had changed
him any. But if he was worrying, he did not show it, and the two
Curlytops breathed easier.
“Is the farm there all right?” Jan could not help asking, as grandpa
turned the horses down the shady road.
“All there—what the high water didn’t wash away,” he answered with
a laugh, and hearing this the children felt better.
“And how is Trouble?” asked grandpa, looking at the baby. “Did he
cut up any coming down?”
“No, he was pretty good,” laughed the baby’s mother, and then she
and daddy and grandpa talked, while Jan and Ted looked at houses
and other things along the road, trying to remember what they had
seen on their last visit to the country.
“Oh, there’s the house!” cried Ted as the horses trotted around a
turn in the highway.
“And there’s grandma waving to us!” added Jan. “Oh, I’m so happy!”
“Bless your hearts!” cried grandma, as she kissed them all, snuggling
her withered cheeks—like well-kept apples—down on the chubby
face of Baby Trouble. “Bless your hearts—every one!”
“You dot any bossy-cows?” Trouble demanded when everyone had
seen everyone else, and it was quiet for a minute in the old
farmhouse. “I want a bossy-cow.”
“What does he mean?” asked grandma.
“Oh, I guess he’s thinking of the time he gave some watercress to a
cow that was in our brook,” explained Ted, telling how Trouble had
been stuck in the mud.
“Bossy-cow splashed milk on me,” went on Trouble. “I like milk.”
“But I don’t want you taking any more baths in it,” laughed his
mother. “You may go out and play with him,” she added to the two
Curlytops. “Be careful he doesn’t get into mischief!”
“Come on!” cried Jan. “We’ll go outside and have some fun,
Trouble!”
“Trouble!” exclaimed Grandma Martin. “What a name for a dear,
sweet little baby!”
“Well, he’s a dear, sweet, little bunch of trouble—sometimes,”
laughed Daddy Martin.
“We see bossy-cow?” asked William, as he took hold of his sister’s
hand on one side, and Ted’s on the other.
“Yes, if we can find one,” promised Jan. “Come on!”
Trouble was very willing to go. He toddled along down the side path
out toward the barn. Some chickens, in their wire-fenced yard where
they were kept so they could not scratch the garden, cackled at the
children, and an old rooster crowed.
“Dat our roosterfer?” asked William, making the name a little longer
than it needed to be.
“No, that isn’t our roosterfer,” laughed Jan. “It’s one just like ours,
though. Oh, Trouble, you mustn’t throw a stick at the nice rooster!”
she cried, for her little brother had let go of her hand and had
tossed a stick over into the chicken yard, making the fowls scatter
about with many a surprised cluck.
“What are you doing, Trouble?” asked Ted.
“Make roosterfer crow see if he got cold like our roosterfer,” was the
answer. “Trouble want hear roosterfer crow.”
“Oh, never mind about the roosterfer,” beguiled Jan. “Let’s go to see
the bossy-cows.”
This was what William wanted, so away he toddled, leaving the
chickens in peace. The children went out to the barn, where some of
the horses, which the men were not using at different places on the
farm, were eating hay or grain in their stalls. Ted and Jan always
liked to look at the horses. Sometimes one would put its head over
the lower half of the closed stall door and look at the little boy and
girl, letting them rub its velvety nose.
While Jan and Ted were doing this of course they could not keep
hold of Trouble’s hands, nor did they watch him very closely. So,
when they looked for him a little later, they did not see their small
brother.
“Oh, where can he have gone?” gasped Janet. “And mother told us
to be so careful in watching him!”
“He can’t be very far off,” answered Ted. “He was here a little while
ago. Come on, we’ll look!”
They went out of the barn, one of the horses calling, or whinnying,
after them. The door had been left open when they went into the
barn, and of course Trouble could have gone out that way.
But when Jan and Ted looked around the barn, near the corncrib, up
past the smoke-house and in near-by hiding places, where they,
themselves, often hid, they did not find Trouble.
“Oh, where can he be?” said Jan again and again.
“We’ll find him!” Ted declared.
But this time Trouble seemed to have hidden himself very carefully.
Nor did he answer to the calls Jan and Ted gave. They did not want
to call their father or mother, for they were not yet quite ready to
give up and admit that they, themselves, could not find their little
brother.
“Let’s look down in the lane,” said Ted after a bit.
This lane was a long, grassy one between two big meadows, and
was a sort of driveway leading to a far-off part of Cherry Farm.
Other farmers besides Grandpa Martin sometimes used it, though it
belonged to him and came to an end near his barns.
So down the lane went Jan and Ted, calling for their little brother.
They walked on a little way and then stopped to listen.
“Hark!” called Ted suddenly, when his sister had finished her last cry
for the missing child.
From behind some bushes a little way ahead of them came a baby
voice saying:
“I found de bossy-cow! I found de bossy-cow! But he’s a ’ittle bit
one. Such a ’ittle bit!”
“There’s Trouble!” cried Jan joyously.
“Yes. But I wonder what he has,” said Ted.
They ran ahead, and there, behind the bush, they saw Baby William
sitting on the ground and holding to the horns of a big goat that was
standing in front of Trouble, looking at him as though in great
surprise.
“Why Trouble Martin! What are you doing?” cried Jan. “Come away
from that goat this minute! He may hook you!”
“Dis a bossy-cow!” Trouble murmured, holding with one hand to the
long horns of the animal and with the other stroking the chin
whiskers. “Nice bossy-cow!”
“It’s a goat!” cried Ted, walking toward the child and wondering if
the goat would butt him if he lifted Trouble out of the way.
“Dis a bossy-cow!” insisted Trouble. “Bossy-cow got horns. Dis got
horns. Dis bossy-cow!”
“Get up off the ground,” ordered Jan. “How did you get there?”
“Nice bossy-cow push me down here,” said Trouble.
“I think the goat must have butted him a little,” said Ted. “But the
goat is a gentle one, I guess. He didn’t hurt Trouble. Get up!” he
said. “Come here, Trouble.”
“No! Can’t.”
“You can’t come! Why not?” asked Ted in surprise. “Why can’t you
come away from the goat—I mean bossy-cow, Trouble?”
“’Cause Trouble am a hen now. Trouble goin’ to sit on hen’s nest and
watch for ’ittle chickens. De bossy-cow he push me in chickie’s nest
an’ I goin’ to be hen! I dess I didn’t break all de eggs!” He moved a
little to one side, still keeping hold of the goat’s horn, and showed
Ted and Jan that he was, indeed, sitting in the midst of the whites
and yellows of the broken eggs of a hen’s nest which had been
made under the bush.
“Oh my!” gasped Ted. “He is right in with the eggs! Oh, what a mess
he’ll be! Oh, Trouble!”
“Such trouble!” echoed Jan.
“Dat me. I’s Trouble!” cheerfully observed Baby William. “An’ I’s dot
a bossy-cow!”
CHAPTER IV
THE GOAT WAGON

The Curlytops stood and looked at their little brother. That was all
they could do for a few seconds. It all seemed so very queer and
funny. There sat Trouble right in the middle of the hen’s nest, and he
had sat down so hard, or rather, the goat had pushed him down so
quickly, that many of the eggs were broken.
“I’s a chickie—dat’s what I is,” said Trouble. “An’ I dot a bossy-cow.
He’s all mine—I ketched him. He was jumpin’ over de grass like a
grasshopper an’ I ketched him. I got him now!”
“Yes, he has got him,” remarked Ted. “It’s a fine goat, too. I wonder
whose he is?”
“Dis a bossy-cow, an’ I ketched him,” said Trouble again. “I’s a hen,
too, an’ I’s goin’ to have ’ittle chickies!”
“Chickens can’t come out of broken eggs—anyhow not till after the
hen sits on ’em and the chickens break the shells themselves,”
explained Jan. “I saw a chickie break out of the shell once. But, oh,
Trouble! you are such a sight! What will mother say, I wonder?”
“She like de bossy-cow,” answered the little fellow.
“It isn’t a cow. That’s a goat,” said Ted. “And it’s a wonder he didn’t
butt you and hurt you.”
“I guess he’s tame,” remarked Jan. “He looks like a nice goat.”
Ted went up to the animal Trouble was holding by the horns and
patted it. The goat made a soft bleating sound, like a sheep, and
seemed to like being rubbed.
“He is a nice goat,” went on Ted. “I wish we could keep him.”
“He’s mine,” announced Trouble. “He’s a ’ittle bossy-cow, isn’t him?”
“Well, you can call him that,” laughed Jan. “Let go of him, Trouble,
and let’s see if he’ll run away.”
Baby William let his chubby hands slip from the goat’s horns, and
the animal backed away a few steps but did not leave the place.
Instead he came close to Ted and rubbed his little black nose on the
boy’s hand.
“He likes you,” said Jan. “Oh, wouldn’t it be great if we could keep
him for our own, and hitch him to a pony cart, Ted?”
“A pony cart would be too big. It would have to be a goat cart.”
“I’s got a go-cart at home. We can put de ’ittle goat-bossy-cow in
dat an’ div him a wide,” put in Trouble in his own peculiar language.
“Brother Ted means a goat cart—not a baby-carriage go-cart,”
explained Jan. “Oh, Trouble, wouldn’t it be nice if we could keep the
goat?”
“Yes. Him’s my goat,” said Trouble, but he was more interested just
then in himself. He had pulled himself to his feet by taking hold of
some of the branches of the bush over his head, and now he turned
half around to look at the seat of his little bloomers.
“Oh, Trouble!” cried Ted, laughing, “you look just like a fried egg!”
“Or an omelet!” added Jan. “What shall we do with him?”
Ted did not know. Nearly always when his little brother fell in the
mud, or got dirty from playing in the yard, his mother or Nora took
charge of him. Neither of them was at hand how. What could be
done?
“We could let him ride home on the goat,” said Ted, scratching his
head as he had seen his father do when he was trying to think.
“Oh! are you going to take him home—to grandpa’s?” asked Jan.
“We’ve got to. Can’t leave him here. He’s got to be washed and
dressed and——”
“I was talking about the goat,” laughed Jan.
“Oh! I meant Trouble. But we’ll take the goat home, too. He may
belong to somebody else, but maybe we can keep him a little while
and have some fun. Wonder what his name is?”
“Bossy,” said Trouble. “Him’s a bossy!”
“No; that’s a cow’s name, and this is a goat,” explained Jan. “We’ll
have to think up a name for him. But, oh, Trouble! how are we ever
going to get you clean? Those eggs are so messy!”
“That’s what I meant by letting him ride the goat,” went on Ted.
“Most of the whites and yallers would come off on the goat.”
“Then we’d have to wash it,” said Jan.
“That would be easy,” declared Ted. “All we’d have to do would be to
let him swim in the brook.”
“Dere’s a brook over here,” said Trouble, waving his hand to show
where he meant. “I frowed stones in it, an’ den I found de bossy-
cow-goat. I wash myse’f in de brook.”
“Oh!” exclaimed Jan. “Maybe we can wash off some of the egg
before mother sees him, Ted. She’ll blame us for not keeping watch
of him.”
“He ran out of the barn before I saw him,” said Teddy. “Well, come
on, let’s go to the water. Wait, though. I don’t want this goat to get
away. I’ll tie a piece of string to his horns and lead him along with
us.”
Ted found a piece of thin cord among the many things in his
pockets, and fastened a bit to the horns of the goat. If the animal
had not wanted to go along with the children the string would not
have pulled him, for it could have easily been broken. However the
goat seemed to have taken a liking to the Curlytops, and it followed
Jan and Ted as they led their little brother toward the brook.
It was not far from where Trouble had sat down in the hen’s nest,
and then, tying the goat to an old stump near by, Ted and Jan
started to clean Baby William’s bloomers of the egg stains. They
stood him on the edge of the brook, and by using bunches of grass
for wash cloths they got off some of the sticky whites and yellows.
Trouble was kept quiet while this was going on by being allowed to
pet the goat which came and stood near him.
“Him’s a nice goat,” said Trouble, and Ted and Jan thought the same
thing.
Jan was scrubbing rather hard with a bunch of grass at a very eggy-
yellow spot on one leg of Trouble’s bloomers when, all of a sudden,
the little fellow slid backwards, and before his brother or sister could
catch him he sat down “splash!” in the shallow water of the brook.
“Oh, oh!” gasped Ted, almost slipping into the stream himself, he
was so surprised.
“Oh, Trouble!” murmured Jan. “Oh, dear!”
“Dere! Now ’ook what you did!” said Trouble himself, never offering
to get up. “You pushed me in! But I get nice an’ clean now!” and he
smiled joyously, for the water was warm and Trouble always liked to
have his bath, more than once jumping into the tub before all his
clothes were off.
“Yes, I guess you will get nice and clean,” laughed Ted. “Don’t you
care, Jan,” he said to his sister. “This is the best way to wash off
those eggs. Come on, Trouble, get up, and we’ll squeeze as much
water out of you as we can. Then we’ll take you home.”
“Will you wide me on de bossy-goat?”
“Yes, we’ll ride you on the goat if he’ll let you stay on his back.”
Jan and Ted wrung as much water as they could from Trouble’s
bloomers. They were very wet, but falling into the brook had taken
out most of the egg stains. Then the little chap was lifted to the
back of the goat. The animal did not mind in the least.
“He’s been ridden like this before,” decided Ted. “And I guess he’s
been hitched to a wagon, too.”
“Oh, if we only could do that!” sighed Jan. “It would be such fun!”
“Maybe we can,” her brother told her as he held Trouble on the
goat’s back with one hand and guided the animal with another hand
on one horn. Jan did the same on the other side.
THE LITTLE CHAP WAS LIFTED TO THE BACK OF THE
GOAT.
The Curlytops at Cherry Farm Page
50
“Where can we get a wagon?” Janet asked.
“Make one,” said her brother. “There’s lots of old wood around
grandpa’s barn. Wait till we get home.”
On the way, riding on the goat’s back, Trouble told how he had
slipped out of the barn and how, after throwing stones in the brook,
he had seen what he thought was a “’ittle bossy-cow.” He had taken
the goat by the horns. This the animal, being very gentle, let him do
without offering to butt him. Then Trouble led the goat along until,
half by accident and half in playfulness, the goat had shoved Baby
William backward into the nest of the hen that had stolen away from
the chicken yard to lay her eggs under the bush.
“Oh, my dear children! what in the world have you been doing?”
cried Mother Martin as she saw the little procession come down the
path toward the house. “Where have you been?”
“Oh, Mother! Trouble found a goat, and we’re going to keep him!”
cried Ted.
“’Ittle bossy-goat,” put in Trouble.
“And he sat down in a hen’s nest, but we washed him off!” added
Jan.
“Who, the goat or Trouble?” asked Daddy Martin with a laugh.
“Trouble,” answered Ted. “He was all whites and yallers, but he’s
pretty clean now, and please may we keep him?”
“Who, Trouble or the goat?” asked Grandpa Martin.
“Both,” laughed Jan.
“He’s an awful nice goat, and Trouble just loves him,” went on Teddy.
Then the older children told what had happened, and Trouble was
carried away, kicking and crying, to have clean, dry clothes put on
him. He wanted to stay and play with the goat, but Nora promised
he should see his new pet in a little while.
“I think I know whose goat that is,” said Grandpa Martin, after
looking at the animal. “They moved away and couldn’t take the goat
with them. They left him with Farmer Emery, but I did hear that
Emery didn’t want him, because Billy was always wandering off.
“I guess the goat must be lonesome for children, because the folks
that owned him had half a dozen. They were always riding or driving
him. Emery hasn’t any young folks on his farm, and the goat has run
away once or twice. Emery doesn’t care much about him.”
“Then may we keep him?” begged Ted.
“Well, we’ll see,” half-promised grandpa. “If Emery doesn’t want him,
and the family that used to own the goat doesn’t claim him, I guess
we’ve got room for him here. He’s a good and gentle animal,” went
on the old gentleman to Mrs. Martin, who seemed a bit worried.
“Ted and Jan can manage him all right.”
“I wouldn’t want them to get hurt,” said Mother Martin.
“This goat wouldn’t hurt even Trouble,” declared Ted. “He’s awful
nice. Aren’t you, Nicknack?” he asked, patting the new pet.
“Nicknack! Is that his name?” asked Daddy Martin.
“I named him that,” explained Ted. “He ate so many things when we
were riding Trouble home on his back—grass, weeds, some paper
from an old tin can. It was just like the nicknack crackers you buy in
the store—all different kinds. So I called him Nicknack.”
“It’s a nice name,” said Janet. “We call our goat Nicknack.”
“Better wait until you’re sure he’s yours,” suggested her father.
“Oh, I guess they can keep him,” put in Grandpa Martin.
And he was right. Mr. Emery had no use for the goat. The family
who had left him could not be found, having moved far away, and,
as Grandpa Martin said, there was plenty of room at Cherry Farm for
the goat.
“Well, our Curlytops have been here only one night,” said Mother
Martin the next morning, “and they’ve found a goat. If they keep
this up, by the time we leave Cherry Farm, we’ll have a regular
circus.”
“Never mind, as long as they have a good time,” returned her
husband, smiling.
The children, even Trouble, were out before breakfast to look at the
goat that had been put in a colt’s box stall for the night. Nicknack
was glad to see his little friends, and bleated softly as they opened
the door of his new home. One of the farm hands had given him
some hay and oats to eat.
“And now to build the goat wagon,” said Ted, after breakfast. “May
we take some old boards and wheels if we can find them in the
barn, Grandpa?”
“Yes, take anything you like.”
“I’s going to have a bossy-goat ride!” laughed Trouble, who, it
seemed, did not get over the idea that the goat was part cow. I
suppose it was because both animals have horns.
Feeling quite happy now that they were going to have a real goat for
their very own, and feeling very glad at the chance of having some
rides in a wagon that Nicknack would pull, Ted, Janet and Trouble
started for the barn.
“Do you really think you can make a wagon?” asked Janet of her
brother.
“Course I can,” he answered. “Didn’t I make a house, lots of times—
a playhouse that we had fun in?”
“But a wagon is different,” said the little girl. “A playhouse stays in
one place, but a wagon has to go around and around on its wheels.”
“I know,” said Ted, as if he had thought it all out long before, “a
wagon has to have wheels on it, and I’m going to put wheels on this
one. Then Nicknack can pull us all over the farm.”
“Will he pull me, too?” asked Trouble.
“Of course he will,” laughed Janet, giving her small brother a big
hug. “You can have a nice ride.”
“On his back?” asked Trouble. “Like I see in pictures!”
“He means those cowboy pictures—like in the Wild West,” put in Ted.
“Oh, no, I don’t guess you could ride that way, William,” went on
Janet. “You might fall off. It’s lots nicer to ride in the wagon.”
“Couldn’t I ride on Nicknack’s back if you holded me on?” Trouble
wanted to know.
“Well, maybe. We’ll see,” said Janet, who did not want to make any
promises. Baby William was always sure to remember them no
matter if everyone else forgot.
“I ’ikes a goat,” murmured the little fellow, as he walked along
beside his brother and sister. “I ’ikes a goat—much!”
“Yes, Nicknack is a fine goat. I hope he’ll always live with us,” said
Ted.
They were almost at the barn now, when, all at once, the children
heard someone shouting.
“What’s that?” asked Janet.
“Maybe the barn’s on fire!” cried Ted, starting to run.
“Wait for me!” begged Janet.
“An’ me, too!” added William, for Ted had let go of his hand as he
started off.
The shouting kept up, and the children could hear one of the men
who worked on the farm calling:
“Look out! Look out! He’s loose! He’s running away!”
Ted stopped running and looked back at his sister and little brother.
“Oh, what is it?” asked Janet, her eyes big with wonder.
“I—I guess maybe the bull has got loose,” said Teddy. A few days
before, a farmer who lived some miles away from the children’s
grandfather had asked Mr. Martin if a bull, which the farmer had
bought, could not be kept for a while in the barn on Cherry Farm.
Mr. Martin had said it could be, and the animal, which was quite
wild, had been shut up in a distant part of the stable, where he
bellowed all day long.
“Oh, if it’s that bad bull,” said Janet, “we’d better go into the house
and stay there.”
“Maybe it’s only one of the horses,” said Teddy, after thinking it over
a bit, and listening to the calls of the man in the barnyard. “If it’s
only a horse we don’t have to be scared.”
The truth was that Ted wanted to see what was going on, even if
the bull had gotten loose, and he did not want to have to go back to
the house with his sister and Trouble.
“Well, if it’s a horse I’m not afraid,” said Janet. “Let’s go on.”
“Could I have a ride on a horse?” asked Trouble.
“Oh, not now!” cried Janet. “He’s running away, maybe, and he
might run away with you!”
Trouble shook his head. He would not like that. He took hold of his
sister’s hand on one side, and Ted’s on the other, and together the
three children started on toward the barn once more. They could still
hear the cries:
“He’s loose! He’s loose! Look out!”
All at once Ted cried:
“Oh, it’s our goat Nicknack! He’s the one that’s loose! Look at him!”
And, as he pointed, Janet and Trouble saw the goat running about
the barnyard with a farmhand chasing after him with a stick. Around
and around ran the goat, and around and around after him ran the
man, calling:
“Whoa! Whoa there, nice goat! Don’t run away!”
But the goat was running away, and he didn’t “whoa” when the man
told him to.
“You stay here,” directed Ted to his sister and little brother.
“What you going to do?” asked Janet.
“I’m going to help catch that goat,” answered Teddy.
“Oh, maybe he’ll butt you!” exclaimed Janet.
“No, he won’t do that,” went on Ted. “That goat knows me, and he
don’t know that man. That’s why he’s scared, I guess.”
“Is the man scared?” asked Janet, as she saw him chasing around
after the goat.
“No, but I guess Nicknack is,” answered Teddy. “I’ve got to help
catch him so he won’t be scared. You stay here with Trouble,” and
he led his sister and Baby William to a place near a corner of the
barnyard fence where he thought nothing could hurt them.
“I wants to come wif you!” begged Trouble, as Teddy started off.
“No, you stay with sister and I’ll give you a nice ride in the goat
wagon when brother makes it,” promised Janet.
“I wants a wide now,” said Trouble, as he watched the goat running,
“I ’ikes to wide fast.”
“Not as fast as that, I guess,” replied Teddy, with a laugh, for
Nicknack was fairly flying around the barnyard. “You’d fall off,
Trouble, and bump your nose.”
Baby William didn’t want anything like that to happen, so he did not
again ask to ride on the goat.
The farmhand kept on chasing Nicknack, calling him to stop, but the
goat would not. Then, as Ted came near, and opened the gate of the
yard around the barn, to go in, Nicknack saw what was going on.
Suddenly the goat made a dash for the open gate.
“Look out! He’s coming! He’ll try to get loose, and if he gets out
maybe you’ll never catch him again!” cried the hired man.
Ted tried to close the gate, but he was not quick enough. Right past
him ran the goat, knocking the little boy down, but not hurting him,
I’m glad to say.
“Ugh!” grunted Ted as he struck the ground. His breath seemed to
be knocked out of him, as it once was when he was struck by a
football.
“Oh, Ted! are you hurt?” cried Janet, who saw what had happened.
“No. I’m all right,” he answered.
The hired man, who ran out of the gate after the goat, stopped to
pick up Teddy and brush some of the dirt off his clothes.
“I never did see such a goat!” cried the man. “Look at him go!”
The goat had run out of the barnyard now, jumped over a low fence
and was running down the road.
“Come on!” cried Ted. “We’ve got to get him! What made him run
out of the stall?”
“I did; but I didn’t mean to,” explained the man. “I was taking him
some more water, for he seemed very thirsty, when I stumbled and
dropped the pail. The water splashed all over him, and he got
scared, I guess. He gave his head a yank, broke the strap and ran
out.
“I ran after him, but I couldn’t catch him. Then you opened the
gate, and there he goes!”
“But we’ve got to get him!” cried Ted, who was all right again after
being knocked down by Nicknack. “We’ve got to get him. Come on!”
He and the hired man ran down the road after the goat. They were
glad to see, a little distance down, that Nicknack had now stopped
and was nibbling the grass.
“Now we can get him,” declared Ted.
“You’d better go up to him yourself,” said the hired man. “He might
be mad at me, thinking I spilled that water on him purposely. You go
up to him, and I’ll stay back.”
So Teddy, holding out his hand, walked toward Nicknack, calling
gently:
“Come here, Nicknack! Come here, nice goat!”
The goat stopped nibbling the grass and looked up. He seemed to
know Ted, and did not run any farther. The hired man hid behind a
tree so the goat would not see him.
Slowly Ted walked toward his new pet. Still Nicknack did not run,
and he let the small boy take hold of the broken strap by which
Nicknack had been tied in the stall.
“Now he’s all right,” Teddy said as he led the goat along the road
and back into the barnyard. Nicknack did not try to run any more.
He really had been frightened when the water was spilled, and all he
thought of was running away. But he seemed to know that Ted
would be kind to him.
“Oh, I’m so glad you got him back,” said Janet as she walked to
meet her brother.
“Where’s Trouble?” asked Ted, as he looked for Baby William.
“Oh, I forgot all about him!” exclaimed Janet. “There he goes!” and
she pointed to him, walking toward a little brook that ran across one
end of the barnyard.
“Catch him ’fore he wades in and gets his feet wet!” cried Ted, as he
led Nicknack on.
Janet ran after her little brother, whom she had let stray away while
she watched Ted go after the goat, and caught Baby William just in
time. He was about to paddle in the water.
Then Nicknack was put back in the stable, and he seemed glad to be
at rest once more.
“Now we can make our cart,” said Ted.
“I think you had better go and put on your play clothes before you
start to make your cart,” said their mother, who had come out just at
the end of the trouble with the runaway goat.
This the children did, but were quickly out at the barn again.
Wearing their old clothes, so that a little dirt would not hurt, and
having promised not to let Trouble stray away this time, Jan and Ted
started to build the goat wagon. In the barn were many odds and
ends of boards that Ted felt sure would be just what he wanted. He
knew how to hammer, nail and saw, for his father had given him a
chest of tools one Christmas. Jan, too, could nail two boards
together, even if some of the nails did go in crooked.
Ted found part of an old little express wagon that he had played with
a year or two before while at Cherry Farm. Only two wheels were
left, but one from a broken wheelbarrow made another for the goat
cart, and for a fourth wheel he found an iron one that had been on a
churn.
The wheels were of three different sizes, but Ted said he didn’t think
that would matter any.
“It’ll be all the more fun,” declared Jan. “It’ll be such a funny, wiggily
motion when we ride that it’ll be like sailing in a boat on dry land.”
“We’ll ride out first and see how fast the cherries are getting ripe,”
proposed Ted, as he hammered away at the goat wagon.
“And when they get ripe and are ready to pick, we’ll help grandpa
cart ’em in and sell ’em. Then maybe he’ll have lots of money and
won’t have to lose the farm,” said Jan.
“Do you think he will lose it?” asked her brother anxiously.
“I don’t know. But I know there’s some kind of trouble, and grandpa
and grandma are worried. I heard them talking with mother and
daddy quite late last night. There’s some trouble about Cherry
Farm.”
“Yes, here I is. I hasn’t runned away!” called Baby William.
“Oh, we were talking about another kind of trouble, not you!”
laughed Jan as she hugged and kissed him.
Then she helped Ted make the goat wagon, while Trouble looked on.
CHAPTER V
UPSIDE DOWN

With hammer and saw and nails, with bits of rope and string, here a
piece of tin and there a board, the goat wagon was finally built. It
did not look very spick and span. Rather it looked like some of the
funny things the circus clowns make when they do their queer tricks
in the ring.
But there were four wheels, even if they were of different sizes, to
the wagon Jan and Ted had made, and there was a seat for them,
with room in between for Trouble. And, as Jan said, the uneven
wheels gave the wagon such a queer, wobbly motion that it was ever
so much more fun riding in that than in a regular store wagon.
“Maybe we’ll get a new wagon after we learn to drive the goat,” said
Jan, as she watched Trouble combing out Nicknack’s whiskers with a
pine-cone he had picked up.
“Maybe,” assented Ted.
“I like the way this wagon rides. It’s part like a swing and the other
part is like a seesaw,” observed Jan, when Ted, pulling the cart
himself, had given her a ride about the front yard, to see how the
wagon rode before they hitched the goat to it.
“It will do until we get a new one,” her brother agreed.
“How are you going to hitch Nicknack to it?” Jan suddenly
demanded.
“Oh, I can make a harness. There’s lots of old straps in the barn.”
“But what about a bit? And reins? Haven’t you got to have an iron
bit for Nicknack’s mouth, like grandpa has for his horses?”
“I think I can put a strap around his nose, with reins on each side of
it. I saw a camel harnessed that way in the circus,” answered Ted. “I
don’t like to put a bit in a goat’s mouth.”
Ted had been told by his grandfather that a goat’s mouth is not hard
like a horse’s.
“Maybe a strap would be better,” agreed Jan.
And while Trouble sat in the rebuilt wagon and pretended to drive
Nicknack with a string tied to the goat’s horns, Jan and her brother
patched together a sort of harness. Grandpa and Daddy Martin
helped them some, but the children could easily tell that something
was wrong at Cherry Farm. Never before, in all their visits, had they
seen the faces of Grandpa Martin and Grandma Martin so sad, and
the two men did not talk and laugh as they used to do.
But the Curlytops did not think long about this sadness, for they
were too eager to have fun; though they would have done anything
in the world, if they could, to help their own dear daddy and their
mother, and, of course, grandpa and grandma.
“Just wait until the cherries are ripe,” said Ted, as he put the
finishing touches to the harness. “Then we’ll help pick them and cart
them to market. As soon as we hitch up Nicknack we’ll go over to
the cherry grove and see how big the green ones are.”
The goat seemed very willing to be hitched to the queer wagon Jan
and Ted had made from odds and ends. True, it might not be like
the smart cart and real harness he was used to, but Nicknack was a
good goat, and he did not mind pretending that this queer rig was
just the finest ever made. At least he might have made-believe, if
goats ever do such things, of which I am not quite sure.
“All aboard now!” called Ted one afternoon, when the wagon and
harness were ready. “All aboard!”
“Anybody would think this was a boat!” laughed Jan, as she led
Trouble down off the back steps, ready for a ride.
“Well, it does wobble like one,” laughed Ted. “You wait and see!
That’s why I called ‘All aboard!’ Come on. Get in!”
“Me goin’ to drive!” shouted Trouble.
“No, not at first,” answered his brother. “I’ll have to wait and see
how Nicknack behaves. I’ll let you drive after a bit.”
“Then me holler ‘giddap!’” insisted Baby William, who was eager to
do something.
“Yes, you may make Nicknack giddap,” agreed Jan, lifting him into
the wagon.
Mother and Grandma Martin, as well as Nora, who had come to the
farm, too, came out to see the children start off.
“How cute they look,” said grandma.
“Yes. I hope nothing happens—that that queer contraption holds
together,” remarked Mother Martin.
“Well, if anything does happen I have a nice picture of them,” put in
Nora, who had a little camera. She had “snapped” the trio as they
started off in the wagon drawn by Nicknack. “It’ll come out lovely, I
think.”
Along the shady, grassy lane Ted drove Nicknack. The lane led to the
cherry grove where hundreds of trees had been in blossom.
Now the blossoms had fallen off, and in place of each one was a
little round green ball, that, when the sun had warmed it and the
rain had wet it, would turn into a beautiful, big black or red cherry.
Grandpa Martin’s cherries were known all around Elmburg, and even
on the other side of Clover Lake, as the best in that part of the
country.
“And maybe we can ride to Clover Lake after we go to the cherry
grove,” said Jan, as they jogged along the lane where the yellow
dandelions looked like spots of gold in the green, velvet grass.
“Maybe,” assented her brother. “I don’t know whether Nicknack is
afraid of water or not.”
“He wasn’t the day Trouble sat down in it after he broke the eggs,”
laughed Jan. “Besides, this wagon is so like a boat that maybe it will
float on the lake.”
“Maybe!” agreed Ted.
It surely was a queer cart, with two hind wheels alike, but with two
different sizes for the front ones. As it rolled along first the left front
end would rise up and then the right would do the same. If one had
stood back of them and looked at the two Curlytops, with Trouble
seated between his brother and his sister, one would have thought
them on the back of a camel or an elephant. That was the way the
goat cart swayed, up and down and sidewise.
But the wheels stayed on, which was more than Ted’s father and
grandfather had dared to hope at first. And the harness, though
much patched and made from many bits of straps and ropes, stayed
on the back of Nicknack. So that the goat pulled the cart along after
a fashion.
“And he guides good, too,” said Ted, as he pulled first on the left-
hand cord and then on the right. “See how easy it is, Jan.”
A sort of muzzle of straps had been put around Nicknack’s nose, and
on either side of it was a long cord. The cords were the reins, Ted
not having been able to find light leather straps that were long
enough. But the cord-reins did very well.
“Yes, he does guide nice,” agreed Jan, for when she pulled on the
left cord Nicknack turned that way, and when she pulled on the right
cord he went that way.
“Me want to drive de bossy-goat!” insisted Trouble, and they let him
pull gently first on one cord and then on the other. He laughed and
kicked his heels against the bottom of the cart when he found the
goat would turn aside for him.

You might also like