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

Immediate download Kubernetes Cookbook Practical solutions to container orchestration 2nd Edition Hideto Saito ebooks 2024

The document provides information on the 'Kubernetes Cookbook, 2nd Edition' by Hideto Saito, which offers practical solutions for container orchestration. It includes details on how to download the book, along with links to other related ebooks. The book covers various topics related to Kubernetes, including setting up clusters, managing containers, and working with Kubernetes concepts.

Uploaded by

basilachryso
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
65 views

Immediate download Kubernetes Cookbook Practical solutions to container orchestration 2nd Edition Hideto Saito ebooks 2024

The document provides information on the 'Kubernetes Cookbook, 2nd Edition' by Hideto Saito, which offers practical solutions for container orchestration. It includes details on how to download the book, along with links to other related ebooks. The book covers various topics related to Kubernetes, including setting up clusters, managing containers, and working with Kubernetes concepts.

Uploaded by

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

Visit https://ebookfinal.

com to download the full version and


explore more ebooks

Kubernetes Cookbook Practical solutions to


container orchestration 2nd Edition Hideto Saito

_____ Click the link below to download _____


https://ebookfinal.com/download/kubernetes-cookbook-
practical-solutions-to-container-orchestration-2nd-
edition-hideto-saito/

Explore and download more ebooks at ebookfinal.com


Here are some suggested products you might be interested in.
Click the link to download

Kubernetes Cookbook 1st Edition Saito

https://ebookfinal.com/download/kubernetes-cookbook-1st-edition-saito/

Kubernetes Operators Automating the Container


Orchestration Platform 1st Edition Jason Dobies

https://ebookfinal.com/download/kubernetes-operators-automating-the-
container-orchestration-platform-1st-edition-jason-dobies/

PHP Cookbook Solutions and Examples for PHP Programmers


2nd Edition David Sklar

https://ebookfinal.com/download/php-cookbook-solutions-and-examples-
for-php-programmers-2nd-edition-david-sklar/

Kali Linux Cookbook Effective penetration testing


solutions 2nd Edition Corey P. Schultz

https://ebookfinal.com/download/kali-linux-cookbook-effective-
penetration-testing-solutions-2nd-edition-corey-p-schultz/
MySQL Cookbook 2nd Edition Solutions Examples for Database
Developers and DBAs Paul Dubois

https://ebookfinal.com/download/mysql-cookbook-2nd-edition-solutions-
examples-for-database-developers-and-dbas-paul-dubois/

Keras to Kubernetes 1st Edition Dattaraj Rao

https://ebookfinal.com/download/keras-to-kubernetes-1st-edition-
dattaraj-rao/

Container Gardening For Dummies 2nd Edition Bill Marken

https://ebookfinal.com/download/container-gardening-for-dummies-2nd-
edition-bill-marken/

Digital Dice Computational Solutions to Practical


Probability Problems Paul J. Nahin

https://ebookfinal.com/download/digital-dice-computational-solutions-
to-practical-probability-problems-paul-j-nahin/

Bash Cookbook Solutions and Examples for bash Users 1st


Edition Albing

https://ebookfinal.com/download/bash-cookbook-solutions-and-examples-
for-bash-users-1st-edition-albing/
Kubernetes Cookbook Practical solutions to container
orchestration 2nd Edition Hideto Saito Digital Instant
Download
Author(s): Hideto Saito; Hui-Chuan Chloe Lee; Ke-Jou Carol Hsu
ISBN(s): 9781788836876, 1788836871
Edition: 2
File Details: PDF, 23.59 MB
Year: 2018
Language: english
Kubernetes Cookbook
Second Edition

Practical solutions to container orchestration

Hideto Saito
Hui-Chuan Chloe Lee
Ke-Jou Carol Hsu

BIRMINGHAM - MUMBAI
Kubernetes Cookbook
Second Edition
Copyright © 2018 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form
or by any means, without the prior written permission of the publisher, except in the case of brief quotations
embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented.
However, the information contained in this book is sold without warranty, either express or implied. Neither the
authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to
have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products
mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy
of this information.

Commissioning Editor: Gebin George


Acquisition Editor: Divya Poojari
Content Development Editor: Dattatraya More
Technical Editor: Sayali Thanekar
Copy Editor: Safis Editing
Project Coordinator: Shweta H Birwatkar
Proofreader: Safis Editing
Indexer: Priyanka Dhadke
Graphics: Jisha Chirayil
Production Coordinator: Deepika Naik

First published: June 2016


Second edition: May 2018

Production reference: 1290518

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.

ISBN 978-1-78883-760-6

www.packtpub.com
mapt.io

Mapt is an online digital library that gives you full access to over 5,000 books and videos, as
well as industry leading tools to help you plan your personal development and advance
your career. For more information, please visit our website.

Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos
from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Mapt is fully searchable

Copy and paste, print, and bookmark content

PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a
print book customer, you are entitled to a discount on the eBook copy. Get in touch with us
at service@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters, and receive exclusive discounts and offers on Packt books and
eBooks.
Contributors

About the authors


Hideto Saito has around 20 years of experience in the computer industry. In 1998, while
working for Sun Microsystems Japan, he was impressed by Solaris OS, OPENSTEP, and
Sun Ultra Enterprise 10000 (also known as StarFire). He then decided to pursue UNIX and
macOS operating systems. In 2006, he relocated to southern California as a software
engineer to develop products and services running on Linux and macOS X. He was
especially renowned for his quick Objective-C code when he was drunk. He is also an
enthusiast of Japanese anime, drama, and motorsports, and he loves Japanese Otaku
culture.

Hui-Chuan Chloe Lee is a DevOps and software developer. She has worked in the
software industry on a wide range of projects for over five years. As a technology
enthusiast, she loves trying and learning about new technologies, which makes her life
happier and more fulfilling. In her free time, she enjoys reading, traveling, and spending
time with the people she loves.

Ke-Jou Carol Hsu has three years of experience working as a software engineer and is
currently a PhD student in the area of computer systems. Not only involved programming,
she also enjoys getting multiple applications and machines perfectly working together to
solve big problems. In her free time, she loves movies, music, cooking, and working out.
About the reviewer
Stefan Lapers started his career almost 20 years ago as a support engineer and quickly
grew into Linux/Unix system engineering, security, and network positions. Over the years,
he accumulated experience in developing, deploying, and maintaining hosted applications
while working for great customers, such as MTV and TMF. In his spare time, he enjoys
spending time with his family, tinkering with electronics, and flying model helicopters.

Packt is searching for authors like you


If you're interested in becoming an author for Packt, please visit authors.packtpub.com
and apply today. We have worked with thousands of developers and tech professionals,
just like you, to help them share their insight with the global tech community. You can
make a general application, apply for a specific hot topic that we are recruiting an author
for, or submit your own idea.
Table of Contents
Preface 1
Chapter 1: Building Your Own Kubernetes Cluster 7
Introduction 7
Exploring the Kubernetes architecture 7
Getting ready 8
How to do it... 8
Kubernetes master 9
API server (kube-apiserver) 10
Scheduler (kube-scheduler) 10
Controller manager (kube-controller-manager) 10
Command-line interface (kubectl) 10
Kubernetes node 11
kubelet 12
Proxy (kube-proxy) 12
How it works... 13
etcd 13
Kubernetes network 14
See also 14
Setting up the Kubernetes cluster on macOS by minikube 14
Getting ready 16
How to do it... 16
How it works... 18
See also 21
Setting up the Kubernetes cluster on Windows by minikube 22
Getting ready 22
How to do it... 23
How it works... 27
See also 32
Setting up the Kubernetes cluster on Linux via kubeadm 33
Getting ready 33
How to do it... 35
Package installation 35
Ubuntu 35
CentOS 36
System configuration prerequisites 36
CentOS system settings 37
Booting up the service 37
Network configurations for containers 39
Getting a node involved 40
How it works... 41
Table of Contents

See also 42
Setting up the Kubernetes cluster on Linux via Ansible (kubespray) 43
Getting ready 43
Installing pip 44
Installing Ansible 45
Installing python-netaddr 46
Setting up ssh public key authentication 46
How to do it... 48
Maintaining the Ansible inventory 49
Running the Ansible ad hoc command to test your environment 50
Ansible troubleshooting 51
Need to specify a sudo password 52
Need to specify different ssh logon user 53
Need to change ssh port 53
Common ansible issue 53
How it works... 54
See also 58
Running your first container in Kubernetes 58
Getting ready 58
How to do it... 60
Running a HTTP server (nginx) 61
Exposing the port for external access 62
Stopping the application 63
How it works… 63
See also 66
Chapter 2: Walking through Kubernetes Concepts 67
Introduction 67
An overview of Kubernetes 68
Linking Pods and containers 71
Getting ready 71
How to do it... 72
How it works... 74
See also 77
Managing Pods with ReplicaSets 78
Getting ready 79
How to do it... 80
Creating a ReplicaSet 80
Getting the details of a ReplicaSet 82
Changing the configuration of a ReplicaSet 83
Deleting a ReplicaSet 84
How it works... 85
There's more... 88
See also 88
Deployment API 89
Getting ready 89
How to do it... 91

[ ii ]
Table of Contents

How it works... 94
Using kubectl set to update the container image 95
Updating the YAML and using kubectl apply 96
See also 98
Working with Services 99
Getting ready 100
How to do it... 101
Creating a Service for different resources 102
Creating a Service for a Pod 102
Creating a Service for a Deployment with an external IP 104
Creating a Service for an Endpoint without a selector 105
Creating a Service for another Service with session affinity 107
Deleting a Service 108
How it works... 109
There's more... 111
See also 114
Working with volumes 115
Getting ready 116
How to do it... 116
emptyDir 116
hostPath 119
NFS 120
glusterfs 122
downwardAPI 124
gitRepo 127
There's more... 128
PersistentVolumes 128
Using storage classes 132
gcePersistentDisk 133
awsElasticBlockStore 136
See also 140
Working with Secrets 140
Getting ready 141
How to do it... 141
Creating a Secret 141
Working with kubectl create command line 141
From a file 142
From a directory 143
From a literal value 143
Via configuration file 144
Using Secrets in Pods 144
By environment variables 144
By volumes 145
Deleting a Secret 147
How it works... 147
There's more... 147
Using ConfigMaps 147
Mounting Secrets and ConfigMap in the same volume 149
See also 150

[ iii ]
Table of Contents

Working with names 150


Getting ready 150
How to do it... 151
How it works... 154
See also 155
Working with Namespaces 156
Getting ready 157
How to do it... 158
Creating a Namespace 158
Changing the default Namespace 159
Deleting a Namespace 161
How it works… 162
There's more... 162
Creating a LimitRange 162
Deleting a LimitRange 166
See also 166
Working with labels and selectors 166
Getting ready 167
How to do it... 167
How it works... 170
Equality-based label selector 171
Set-based label selector 172
There's more... 173
Linking Service to Pods or ReplicaSets using label selectors 173
Linking Deployment to ReplicaSet using the set-based selector 175
See also 177
Chapter 3: Playing with Containers 178
Introduction 178
Scaling your containers 178
Getting ready 179
How to do it... 180
Scale up and down manually with the kubectl scale command 180
Horizontal Pod Autoscaler (HPA) 182
How it works... 185
There is more… 185
See also 186
Updating live containers 186
Getting ready 186
How to do it... 187
Deployment update strategy – rolling-update 189
Rollback the update 193
Deployment update strategy – recreate 194
How it works... 195
There's more... 196
See also 198

[ iv ]
Table of Contents

Forwarding container ports 198


Getting ready 199
How to do it... 200
Container-to-container communication 200
Pod-to-Pod communication 204
Working with NetworkPolicy 205
Pod-to-Service communication 209
External-to-internal communication 213
Working with Ingress 214
There's more... 218
See also 220
Ensuring flexible usage of your containers 220
Getting ready 220
How to do it... 222
Pod as DaemonSets 222
Running a stateful Pod 225
How it works... 229
Pod recovery by DaemonSets 229
Pod recovery by StatefulSet 230
There's more... 232
See also 237
Submitting Jobs on Kubernetes 237
Getting ready 237
How to do it... 237
Pod as a single Job 238
Create a repeatable Job 240
Create a parallel Job 241
Schedule to run Job using CronJob 243
How it works... 245
See also 245
Working with configuration files 245
Getting ready 245
YAML 246
JSON 246
How to do it... 247
How it works... 251
Pod 251
Deployment 251
Service 251
See also 252
Chapter 4: Building High-Availability Clusters 253
Introduction 253
Clustering etcd 253
Getting ready 254
How to do it... 255
Static mechanism 256

[v]
Table of Contents

Discovery mechanism 260


kubeadm 264
kubespray 264
Kops 265
See also 265
Building multiple masters 265
Getting ready 267
How to do it... 267
Setting up the first master 268
Setting up the other master with existing certifications 269
Adding nodes in a HA cluster 270
How it works... 271
See also 275
Chapter 5: Building Continuous Delivery Pipelines 276
Introduction 276
Moving monolithic to microservices 276
Getting ready 277
How to do it... 278
Microservices 279
Frontend WebUI 282
How it works... 284
Microservices 285
Frontend WebUI 286
Working with the private Docker registry 289
Getting ready 290
Using Kubernetes to run a Docker registry server 290
Using Amazon elastic container registry 292
Using Google cloud registry 293
How to do it... 293
Launching a private registry server using Kubernetes 294
Creating a self-signed SSL certificate 294
Creating HTTP secret 295
Creating the HTTP basic authentication file 295
Creating a Kubernetes secret to store security files 296
Configuring a private registry to load a Kubernetes secret 297
Create a repository on the AWS elastic container registry 299
Determining your repository URL on Google container registry 300
How it works... 301
Push and pull an image from your private registry 301
Push and pull an image from Amazon ECR 303
Push and pull an image from Google cloud registry 305
Using gcloud to wrap the Docker command 305
Using the GCP service account to grant a long-lived credential 306
Integrating with Jenkins 308
Getting ready 308
How to do it... 309
Setting up a custom Jenkins image 310

[ vi ]
Table of Contents

Setting up Kubernetes service account and ClusterRole 311


Launching the Jenkins server via Kubernetes deployment 312
How it works... 314
Using Jenkins to build a Docker image 316
Deploying the latest container image to Kubernetes 322
Chapter 6: Building Kubernetes on AWS 325
Introduction 325
Playing with Amazon Web Services 325
Getting ready 326
Creating an IAM user 326
Installing AWS CLI on macOS 329
Installing AWS CLI on Windows 330
How to do it... 331
How it works... 332
Creating VPC and Subnets 332
Internet gateway 334
NAT-GW 336
Security group 338
EC2 339
Setting up Kubernetes with kops 343
Getting ready 343
How to do it... 344
How it works... 346
Working with kops-built AWS cluster 347
Deleting kops-built AWS cluster 348
See also 348
Using AWS as Kubernetes Cloud Provider 348
Getting ready 349
How to do it... 350
Elastic load balancer as LoadBalancer service 350
Elastic Block Store as StorageClass 354
There's more... 356
Managing Kubernetes cluster on AWS by kops 357
Getting ready 357
How to do it... 358
Modifying and resizing instance groups 358
Updating nodes 358
Updating masters 360
Upgrading a cluster 361
There's more... 364
See also 364
Chapter 7: Building Kubernetes on GCP 365
Playing with GCP 365
Getting ready 365
Creating a GCP project 366
Installing Cloud SDK 368

[ vii ]
Table of Contents

Installing Cloud SDK on Windows 368


Installing Cloud SDK on Linux and macOS 370
Configuring Cloud SDK 371
How to do it... 372
Creating a VPC 373
Creating subnets 374
Creating firewall rules 375
Adding your ssh public key to GCP 376
How it works... 376
Launching VM instances 377
Playing with Google Kubernetes Engine 381
Getting ready 381
How to do it… 385
How it works… 388
See also 391
Exploring CloudProvider on GKE 392
Getting ready 392
How to do it… 392
StorageClass 392
Service (LoadBalancer) 394
Ingress 397
There's more… 403
See also 403
Managing Kubernetes clusters on GKE 403
Getting ready 404
How to do it… 404
Node pool 404
Multi-zone and regional clusters 410
Multi-zone clusters 410
Regional clusters 411
Cluster upgrades 412
See also 414
Chapter 8: Advanced Cluster Administration 415
Introduction 415
Advanced settings in kubeconfig 416
Getting ready 417
How to do it... 418
Setting new credentials 419
Setting new clusters 420
Setting contexts and changing current-context 421
Cleaning up kubeconfig 422
There's more... 423
See also 423
Setting resources in nodes 423
Getting ready 424
How to do it... 425

[ viii ]
Table of Contents

Configuring a BestEffort pod 426


Configuring a Guaranteed pod 428
Configuring a Burstable pod 429
How it works... 430
See also 432
Playing with WebUI 432
Getting ready 432
How to do it... 433
Relying on the dashboard created by minikube 433
Creating a dashboard manually on a system using other booting tools 433
How it works... 437
Browsing your resource by dashboard 438
Deploying resources by dashboard 441
Removing resources by dashboard 445
See also 445
Working with the RESTful API 445
Getting ready 446
How to do it... 448
How it works... 451
There's more... 452
See also 453
Working with Kubernetes DNS 453
Getting ready 453
How to do it... 454
DNS for pod 454
DNS for Kubernetes Service 456
DNS for StatefulSet 458
How it works... 461
Headless service when pods scale out 462
See also 465
Authentication and authorization 465
Getting ready 465
How to do it... 466
Authentication 467
Service account token authentication 467
X509 client certs 470
OpenID connect tokens 472
Authorization 475
Role and RoleBinding 475
ClusterRole and ClusterRoleBinding 476
Role-based access control (RBAC) 478
Admission control 479
NamespaceLifecycle 480
LimitRanger 480
ServiceAccount 480
PersistentVolumeLabel (deprecated from v1.8) 480
DefaultStorageClass 480
DefaultTolerationSeconds 481

[ ix ]
Table of Contents

ResourceQuota 481
DenyEscalatingExec 481
AlwaysPullImages 481
There's more… 482
Initializers (alpha) 482
Webhook admission controllers (beta in v1.9) 482
See also 483
Chapter 9: Logging and Monitoring 484
Introduction 484
Working with EFK 484
Getting ready 485
How to do it... 485
Setting up EFK with minikube 486
Setting up EFK with kubespray 488
Setting up EFK with kops 491
How it works... 493
There's more... 496
See also 501
Working with Google Stackdriver 501
Getting ready 501
How to do it... 502
How it works... 506
See also 507
Monitoring master and node 508
Getting ready 508
How to do it... 509
How it works... 510
Introducing the Grafana dashboard 511
Creating a new metric to monitor Pod 513
There's more... 516
Monitoring your Kubernetes cluster on AWS 516
Monitoring your Kubernetes cluster on GCP 517
See also 518
Other Books You May Enjoy 520
Index 523

[x]
Preface
With the trend of microservices architecture in the recent years, a monolithic application is
refactored into multiple microservices. Container simplifies the deployment of the
application build from microservices. Container management, automation, and
orchestration have become crucial problems. Kubernetes is here to solve these.

This book is a practical guide that provides step-by-step tips and examples to help you
build and run your own Kubernetes cluster in both private and public clouds. Following
along with the book will lead you to understanding how to deploy and manage your
application and services in Kubernetes. You will also gain a deep understanding of how to
scale and update live containers, and how to do port forwarding and network routing in
Kubernetes. You will learn how to build a robust high-availability cluster with the book's
hands-on examples. Finally, you will build a Continuous Delivery pipeline by integrating
Jenkins, Docker registry, and Kubernetes.

Who this book is for


If you've been playing with Docker containers for a while and want to orchestrate your
containers in a modern way, this book is the right choice for you. This book is for those who
already understand Docker and container technology, and want to explore further to find
better ways to orchestrate, manage, and deploy containers. This book is perfect for going
beyond a single container and working with container clusters, learning how to build your
own Kubernetes, and making it work seamlessly with your Continuous Delivery pipeline.

What this book covers


Chapter 1, Building Your Own Kubernetes Cluster, explains how to build your own
Kubernetes cluster with various deployment tools and run your first container on it.

Chapter 2, Walking through Kubernetes Concepts, covers both basic and advanced concepts
we need to know about Kubernetes. Then, you will learn how to combine them to create
Kubernetes objects by writing and applying configuration files.
Preface

Chapter 3, Playing with Containers, explains how to scale your containers up and down and
perform rolling updates without affecting application availability. Furthermore, you will
learn how deploy containers for dealing with different application workloads. It will also
walk you through best practices of configuration files.

Chapter 4, Building High-Availability Clusters, provides information on how to build High


Availability Kubernetes master and etcd. This will prevent Kubernetes components from
being the single point of failure.

Chapter 5, Building Continuous Delivery Pipelines, talks about how to integrate Kubernetes
into an existing Continuous Delivery pipeline with Jenkins and private Docker registry.

Chapter 6, Building Kubernetes on AWS, walks you through AWS fundamentals. You will
learn how to build a Kuberentes cluster on AWS in few minutes.

Chapter 7, Building Kubernetes on GCP, leads you to the Google Cloud Platform world. You
will learn the GCP essentials and how to launch a managed, production-ready Kubernetes
cluster with just a few clicks.

Chapter 8, Advanced Cluster Administration, talks about important resource management in


Kubernetes. This chapter also goes through other important cluster administration, such as
Kubernetes dashboard, authentication, and authorization.

Chapter 9, Logging and Monitoring, explains how to collect both system and application logs
in Kubernetes by using Elasticsearch, Logstash, and Kibana (ELK). You will also learn how
to leverage Heapster, InfluxDB, and Grafana to monitor your Kubernetes cluster.

To get the most out of this book


Throughout the book, we use at least three servers with a Linux-based OS to build all of the
components in Kubernetes. At the beginning of the book, you could use one machine,
whether it is Linux or Windows, to learn about the concepts and basic deployment. From a
scalability point of view, we recommend you start with three servers in order to scale out
the components independently and push your cluster to the production level.

[2]
Preface

Download the example code files


You can download the example code files for this book from your account
at www.packtpub.com. If you purchased this book elsewhere, you can
visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

1. Log in or register at www.packtpub.com.


2. Select the SUPPORT tab.
3. Click on Code Downloads & Errata.
4. Enter the name of the book in the Search box and follow the onscreen
instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the
latest version of:

WinRAR/7-Zip for Windows


Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https:/​/​github.​com/
PacktPublishing/​Kubernetes-​Cookbook-​Second-​Edition. In case there's an update to the
code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available
at https:/​/​github.​com/​PacktPublishing/​. Check them out!

Download the color images


We also provide a PDF file that has color images of the screenshots/diagrams used in this
book. You can download it here: https:/​/​www.​packtpub.​com/​sites/​default/​files/
downloads/​KubernetesCookbookSecondEdition_​ColorImages.​pdf.

Conventions used
There are a number of text conventions used throughout this book.

[3]
Preface

CodeInText: Indicates code words in text, database table names, folder names, filenames,
file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an
example: "Prepare the following YAML file, which is a simple Deployment that launches
two nginx containers."

A block of code is set as follows:


# cat 3-1-1_deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx

When we wish to draw your attention to a particular part of a code block, the relevant lines
or items are set in bold:
Annotations: deployment.kubernetes.io/revision=1
Selector: env=test,project=My-Happy-Web,role=frontend
Replicas: 5 desired | 5 updated | 5 total | 5 available | 0
unavailable
StrategyType: RollingUpdate

Any command-line input or output is written as follows:


//install kubectl command by "kubernetes-cli" package
$ brew install kubernetes-cli

Bold: Indicates a new term, an important word, or words that you see onscreen. For
example, words in menus or dialog boxes appear in the text like this. Here is an example:
"Installation is straightforward, so we can just choose the default options and click Next."

Warnings or important notes appear like this.

Tips and tricks appear like this.

[4]
Preface

Sections
In this book, you will find several headings that appear frequently (Getting ready, How to do
it..., How it works..., There's more..., and See also).

To give clear instructions on how to complete a recipe, use these sections as follows:

Getting ready
This section tells you what to expect in the recipe and describes how to set up any software
or any preliminary settings required for the recipe.

How to do it...
This section contains the steps required to follow the recipe.

How it works...
This section usually consists of a detailed explanation of what happened in the previous
section.

There's more...
This section consists of additional information about the recipe in order to make you more
knowledgeable about the recipe.

See also
This section provides helpful links to other useful information for the recipe.

Get in touch
Feedback from our readers is always welcome.

General feedback: Email feedback@packtpub.com and mention the book title in the
subject of your message. If you have questions about any aspect of this book, please email
us at questions@packtpub.com.

[5]
Preface

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you have found a mistake in this book, we would be grateful if you would
report this to us. Please visit www.packtpub.com/submit-errata, selecting your book,
clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we
would be grateful if you would provide us with the location address or website name.
Please contact us at copyright@packtpub.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in
and you are interested in either writing or contributing to a book, please
visit authors.packtpub.com.

Reviews
Please leave a review. Once you have read and used this book, why not leave a review on
the site that you purchased it from? Potential readers can then see and use your unbiased
opinion to make purchase decisions, we at Packt can understand what you think about our
products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.

[6]
1
Building Your Own Kubernetes
Cluster
In this chapter, we will cover the following recipes:

Exploring the Kubernetes architecture


Setting up a Kubernetes cluster on macOS by minikube
Setting up a Kubernetes cluster on Windows by minikube
Setting up a Kubernetes cluster on Linux by kubeadm
Setting up a Kubernetes cluster on Linux by Ansible (kubespray)
Running your first container in Kubernetes

Introduction
Welcome to your journey into Kubernetes! In this very first section, you will learn how to
build your own Kubernetes cluster. Along with understanding each component and
connecting them together, you will learn how to run your first container on Kubernetes.
Having a Kubernetes cluster will help you continue your studies in the chapters ahead.

Exploring the Kubernetes architecture


Kubernetes is an open source container management tool. It is a Go language-based
(https:/​/​golang.​org), lightweight and portable application. You can set up a Kubernetes
cluster on a Linux-based OS to deploy, manage, and scale Docker container applications on
multiple hosts.
Building Your Own Kubernetes Cluster Chapter 1

Getting ready
Kubernetes is made up of the following components:

Kubernetes master
Kubernetes nodes
etcd
Kubernetes network

These components are connected via a network, as shown in the following diagram:

The preceding diagram can be summarized as follows:

Kubernetes master: It connects to etcd via HTTP or HTTPS to store the data
Kubernetes nodes: It connect to the Kubernetes master via HTTP or HTTPS to
get a command and report the status
Kubernetes network: It L2, L3 or overlay make a connection of their container
applications

How to do it...
In this section, we are going to explain how to use the Kubernetes master and nodes to
realize the main functions of the Kubernetes system.

[8]
Building Your Own Kubernetes Cluster Chapter 1

Kubernetes master
The Kubernetes master is the main component of the Kubernetes cluster. It serves several
functionalities, such as the following:

Authorization and authentication


RESTful API entry point
Container deployment scheduler to Kubernetes nodes
Scaling and replicating controllers
Reading the configuration to set up a cluster

The following diagram shows how master daemons work together to fulfill the
aforementioned functionalities:

There are several daemon processes that form the Kubernetes master's functionality, such
as kube-apiserver, kube-scheduler and kube-controller-manager. Hypercube, the
wrapper binary, can launch all these daemons.

In addition, the Kubernetes command-line interface, kubect can control the Kubernetes
master functionality.

[9]
Building Your Own Kubernetes Cluster Chapter 1

API server (kube-apiserver)


The API server provides an HTTP- or HTTPS-based RESTful API, which is the hub between
Kubernetes components, such as kubectl, the scheduler, the replication controller, the etcd
data store, the kubelet and kube-proxy, which runs on Kubernetes nodes, and so on.

Scheduler (kube-scheduler)
The scheduler helps to choose which container runs on which nodes. It is a simple
algorithm that defines the priority for dispatching and binding containers to nodes. For
example:

CPU
Memory
How many containers are running?

Controller manager (kube-controller-manager)


The controller manager performs cluster operations. For example:

Manages Kubernetes nodes


Creates and updates the Kubernetes internal information
Attempts to change the current status to the desired status

Command-line interface (kubectl)


After you install the Kubernetes master, you can use the Kubernetes command-line
interface, kubectl, to control the Kubernetes cluster. For example, kubectl get cs
returns the status of each component. Also, kubectl get nodes returns a list of
Kubernetes nodes:
//see the Component Statuses
# kubectl get cs
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok nil
scheduler Healthy ok nil
etcd-0 Healthy {"health": "true"} nil

//see the nodes


# kubectl get nodes

[ 10 ]
Building Your Own Kubernetes Cluster Chapter 1

NAME LABELS STATUS AGE


kub-node1 kubernetes.io/hostname=kub-node1 Ready 26d
kub-node2 kubernetes.io/hostname=kub-node2 Ready 26d

Kubernetes node
The Kubernetes node is a slave node in the Kubernetes cluster. It is controlled by the
Kubernetes master to run container applications using Docker (http:/​/​docker.​com) or rkt
(http:/​/​coreos.​com/​rkt/​docs/​latest/​). In this book, we will use the Docker container
runtime as the default engine.

Node or slave?

The term slave is used in the computer industry to represent the cluster
worker node; however, it is also associated with discrimination. The
Kubernetes project uses minion in the early version and node in the
current version.

The following diagram displays the role and tasks of daemon processes in the node:

The node also has two daemon processes, named kubelet and kube-proxy, to support its
functionalities.

[ 11 ]
Building Your Own Kubernetes Cluster Chapter 1

kubelet
kubelet is the main process on the Kubernetes node that communicates with the Kubernetes
master to handle the following operations:

Periodically accesses the API controller to check and report


Performs container operations
Runs the HTTP server to provide simple APIs

Proxy (kube-proxy)
The proxy handles the network proxy and load balancer for each container. It
changes Linux iptables rules (nat table) to control TCP and UDP packets across the
containers.

After starting the kube-proxy daemon, it configures iptables rules; you can use iptables
-t nat -L or iptables -t nat -S to check the nat table rules, as follows:

//the result will be vary and dynamically changed by kube-proxy


# sudo iptables -t nat -S
-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
-N DOCKER
-N FLANNEL
-N KUBE-NODEPORT-CONTAINER
-N KUBE-NODEPORT-HOST
-N KUBE-PORTALS-CONTAINER
-N KUBE-PORTALS-HOST
-A PREROUTING -m comment --comment "handle ClusterIPs; NOTE: this must be
before the NodePort rules" -j KUBE-PORTALS-CONTAINER
-A PREROUTING -m addrtype --dst-type LOCAL -m comment --comment "handle
service NodePorts; NOTE: this must be the last rule in the chain" -j KUBE-
NODEPORT-CONTAINER
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT -m comment --comment "handle ClusterIPs; NOTE: this must be
before the NodePort rules" -j KUBE-PORTALS-HOST
-A OUTPUT -m addrtype --dst-type LOCAL -m comment --comment "handle service
NodePorts; NOTE: this must be the last rule in the chain" -j KUBE-NODEPORT-
HOST
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 192.168.90.0/24 ! -o docker0 -j MASQUERADE
-A POSTROUTING -s 192.168.0.0/16 -j FLANNEL
-A FLANNEL -d 192.168.0.0/16 -j ACCEPT

[ 12 ]
Building Your Own Kubernetes Cluster Chapter 1

-A FLANNEL ! -d 224.0.0.0/4 -j MASQUERADE

How it works...
There are two more components to complement Kubernetes node functionalities, the data
store etcd and the inter-container network. You can learn how they support the Kubernetes
system in the following subsections.

etcd
etcd (https:/​/​coreos.​com/​etcd/​) is the distributed key-value data store. It can be accessed
via the RESTful API to perform CRUD operations over the network. Kubernetes uses etcd
as the main data store.

You can explore the Kubernetes configuration and status in etcd (/registry) using the
curl command, as follows:

//example: etcd server is localhost and default port is 4001


# curl -L http://127.0.0.1:4001/v2/keys/registry
{"action":"get","node":{"key":"/registry","dir":true,"nodes":[{"key":"/regi
stry/namespaces","dir":true,"modifiedIndex":6,"createdIndex":6},{"key":"/re
gistry/pods","dir":true,"modifiedIndex":187,"createdIndex":187},{"key":"/re
gistry/clusterroles","dir":true,"modifiedIndex":196,"createdIndex":196},{"k
ey":"/registry/replicasets","dir":true,"modifiedIndex":178,"createdIndex":1
78},{"key":"/registry/limitranges","dir":true,"modifiedIndex":202,"createdI
ndex":202},{"key":"/registry/storageclasses","dir":true,"modifiedIndex":215
,"createdIndex":215},{"key":"/registry/apiregistration.k8s.io","dir":true,"
modifiedIndex":7,"createdIndex":7},{"key":"/registry/serviceaccounts","dir"
:true,"modifiedIndex":70,"createdIndex":70},{"key":"/registry/secrets","dir
":true,"modifiedIndex":71,"createdIndex":71},{"key":"/registry/deployments"
,"dir":true,"modifiedIndex":177,"createdIndex":177},{"key":"/registry/servi
ces","dir":true,"modifiedIndex":13,"createdIndex":13},{"key":"/registry/con
figmaps","dir":true,"modifiedIndex":52,"createdIndex":52},{"key":"/registry
/ranges","dir":true,"modifiedIndex":4,"createdIndex":4},{"key":"/registry/m
inions","dir":true,"modifiedIndex":58,"createdIndex":58},{"key":"/registry/
clusterrolebindings","dir":true,"modifiedIndex":171,"createdIndex":171}],"m
odifiedIndex":4,"createdIndex":4}}

[ 13 ]
Building Your Own Kubernetes Cluster Chapter 1

Kubernetes network
Network communication between containers is the most difficult part. Because Kubernetes
manages multiple nodes (hosts) running several containers, those containers on different
nodes may need to communicate with each other.

If the container's network communication is only within a single node, you can use Docker
network or Docker compose to discover the peer. However, along with multiple nodes,
Kubernetes uses an overlay network or container network interface (CNI) to achieve
multiple container communication.

See also
This recipe describes the basic architecture and methodology of Kubernetes and the related
components. Understanding Kubernetes is not easy, but a step-by-step learning process on
how to set up, configure, and manage Kubernetes is really fun.

Setting up the Kubernetes cluster on macOS


by minikube
Kubernetes consists of combination of multiple open source components. These are
developed by different parties, making it difficult to find and download all the related
packages and install, configure, and make them work from scratch.

Fortunately, there are some different solutions and tools that have been developed to set up
Kubernetes clusters effortlessly. Therefore, it is highly recommended you use such a tool to
set up Kubernetes on your environment.

The following tools are categorized by different types of solution to build your own
Kubernetes:

Self-managed solutions that include:


minikube
kubeadm
kubespray
kops

[ 14 ]
Building Your Own Kubernetes Cluster Chapter 1

Enterprise solutions that include:


OpenShift (https:/​/​www.​openshift.​com)
Tectonic (https:/​/​coreos.​com/​tectonic/​)
Cloud-hosted solutions that include:
Google Kubernetes engine (https:/​/​cloud.​google.​com/
kubernetes-​engine/​)
Amazon elastic container service for Kubernetes (Amazon EKS,
https:/​/​aws.​amazon.​com/​eks/​)
Azure Container Service (AKS, https:/​/​azure.​microsoft.​com/
en-​us/​services/​container-​service/​)

A self-managed solution is suitable if we just want to build a development environment or


do a proof of concept quickly.

By using minikube (https:/​/​github.​com/​kubernetes/​minikube) and kubeadm (https:/​/


kubernetes.​io/​docs/​admin/​kubeadm/​), we can easily build the desired environment on our
machine locally; however, it is not practical if we want to build a production environment.

By using kubespray (https:/​/​github.​com/​kubernetes-​incubator/​kubespray) and kops


(https:/​/​github.​com/​kubernetes/​kops), we can also build a production-grade
environment quickly from scratch.

An enterprise solution or cloud-hosted solution is the easiest starting point if we want to


create a production environment. In particular, the Google Kubernetes Engine (GKE),
which has been used by Google for many years, comes with comprehensive management,
meaning that users don't need to care much about the installation and settings. Also,
Amazon EKS is a new service that was introduced at AWS re: Invent 2017, which is
managed by the Kubernetes service on AWS.

Kubernetes can also run on different clouds and on-premise VMs by custom solutions. To
get started, we will build Kubernetes using minikube on macOS desktop machines in this
chapter.

[ 15 ]
Building Your Own Kubernetes Cluster Chapter 1

Getting ready
minikube runs Kubernetes on the Linux VM on macOS. It relies on a hypervisor
(virtualization technology), such as VirtualBox (https:/​/​www.​virtualbox.​org), VMWare
fusion (https:/​/​www.​vmware.​com/​products/​fusion.​html), or hyperkit (https:/​/​github.
com/​moby/​hyperkit) In addition, we will need to have the Kubernetes command-line
interface (CLI) kubectl, which is used to connect through the hypervisor, to control
Kubernetes.

With minikube, you can run the entire suite of the Kubernetes stack on your macOS,
including the Kubernetes master, node, and CLI. It is recommended that macOS has
enough memory to run Kubernetes. By default, minikube uses VirtualBox as the
hypervisor.

In this chapter, however, we will demonstrate how to use hyperkit, which is the most
lightweight solution. As Linux VM consumes 2 GB of memory, at least 4 GB of memory is
recommended. Note that hyperkit is built on the top of the hypervisor framework (https:/
/​developer.​apple.​com/​documentation/​hypervisor) on macOS; therefore, macOS 10.10
Yosemite or later is required.

The following diagram shows the relationship between kubectl, the hypervisor, minikube,
and macOS:

How to do it...
macOS doesn't have an official package management tool, such as yum and apt-get on
Linux. But there are some useful tools available for macOS. Homebrew (https:/​/​brew.​sh) is
the most popular package management tool and manages many open source tools,
including minikube.

[ 16 ]
Building Your Own Kubernetes Cluster Chapter 1

In order to install Homebrew on macOS, perform the following steps:

1. Open the Terminal and then type the following command:


$ /usr/bin/ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/insta
ll)"

2. Once installation is completed, you can type /usr/local/bin/brew help to


see the available command options.

If you just install or upgrade Xcode on your macOS, the Homebrew


installation may stop. In that case, open Xcode to accept the license
agreement or type sudo xcodebuild -license beforehand.

3. Next, install the hyperkit driver for minikube. At the time of writing
(February 2018), HomeBrew does not support hyperkit; therefore type the
following command to install it:
$ curl -LO
https://storage.googleapis.com/minikube/releases/latest/docker-
machine-driver-hyperkit \
&& chmod +x docker-machine-driver-hyperkit \
&& sudo mv docker-machine-driver-hyperkit /usr/local/bin/ \
&& sudo chown root:wheel /usr/local/bin/docker-machine-driver-
hyperkit \
&& sudo chmod u+s /usr/local/bin/docker-machine-driver-hyperkit

4. Next, let's install the Kubernetes CLI. Use Homebrew with the following
comment to install the kubectl command on your macOS:
//install kubectl command by "kubernetes-cli" package
$ brew install kubernetes-cli

Finally, you can install minikube. It is not managed by Homebrew; however,


Homebrew has an extension called homebrew-cask (https:/​/​github.​com/
caskroom/​homebrew-​cask) that supports minikube.

5. In order to install minikube by homebrew-cask, just simply type the following


command:
//add "cask" option
$ brew cask install minikube

[ 17 ]
Building Your Own Kubernetes Cluster Chapter 1

6. If you have never installed Docker for Mac on your machine, you need to install
it via homebrew-cask as well
//only if you don't have a Docker for Mac
$ brew cask install docker

//start Docker
$ open -a Docker.app

7. Now you are all set! The following command shows whether the required
packages have been installed on your macOS or not:
//check installed package by homebrew
$ brew list
kubernetes-cli

//check installed package by homebrew-cask


$ brew cask list
minikube

How it works...
minikube is suitable for setting up Kubernetes on your macOS with the following
command, which downloads and starts a Kubernetes VM stet, and then configures the
kubectl configuration (~/.kube/config):
//use --vm-driver=hyperkit to specify to use hyperkit
$ /usr/local/bin/minikube start --vm-driver=hyperkit
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
150.53 MB / 150.53 MB [============================================]
100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.0
Downloading kubelet v1.10.0
Finished Downloading kubelet v1.10.0
Finished Downloading kubeadm v1.10.0
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.

[ 18 ]
Building Your Own Kubernetes Cluster Chapter 1

Loading cached images from config file.

//check whether .kube/config is configured or not


$ cat ~/.kube/config
apiVersion: v1
clusters:
- cluster:
certificate-authority: /Users/saito/.minikube/ca.crt
server: https://192.168.64.26:8443
name: minikube
contexts:
- context:
cluster: minikube
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
user:
as-user-extra: {}
client-certificate: /Users/saito/.minikube/client.crt
client-key: /Users/saito/.minikube/client.key

After getting all the necessary packages, perform the following steps:

1. Wait for a few minutes for the Kubernetes cluster setup to complete.
2. Use kubectl version to check the Kubernetes master version and kubectl
get cs to see the component status.
3. Also, use the kubectl get nodes command to check whether the Kubernetes
node is ready or not:
//it shows kubectl (Client) is 1.10.1, and Kubernetes master
(Server) is 1.10.0
$ /usr/local/bin/kubectl version --short
Client Version: v1.10.1
Server Version: v1.10.0

//get cs will shows Component Status


$ kubectl get cs
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok

[ 19 ]
Building Your Own Kubernetes Cluster Chapter 1

etcd-0 Healthy {"health": "true"}

//Kubernetes node (minikube) is ready


$ /usr/local/bin/kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 2m v1.10.0

4. Now you can start to use Kubernetes on your machine. The following sections
describe how to use the kubectl command to manipulate Docker containers.
5. Note that, in some cases, you may need to maintain the Kubernetes cluster, such
as starting/stopping the VM or completely deleting it. The following commands
maintain the minikube environment:

Command Purpose
minikube start --vm- Starts the Kubernetes VM using the hyperkit
driver=hyperkit driver
minikube stop Stops the Kubernetes VM
minikube delete Deletes a Kubernetes VM image
minikube ssh ssh to the Kubernetes VM guest
minikube ip Shows the Kubernetes VM (node) IP address
Checks and updates ~/.kube/config if the
minikube update-context
VM IP address is changed
Opens the web browser to connect the
minikube dashboard
Kubernetes UI
For example, minikube starts a dashboard (the Kubernetes UI) by the default. If you want
to access the dashboard, type minikube dashboard; it then opens your default browser
and connects the Kubernetes UI, as illustrated in the following screenshot:

[ 20 ]
Building Your Own Kubernetes Cluster Chapter 1

See also
This recipe describes how to set up a Kubernetes cluster on your macOS using minikube. It
is the easiest way to start using Kubernetes. We also learned how to use kubectl, the
Kubernetes command-line interface tool, which is the entry point to control our Kubernetes
cluster!

[ 21 ]
Building Your Own Kubernetes Cluster Chapter 1

Setting up the Kubernetes cluster on


Windows by minikube
By nature, Docker and Kubernetes are based on a Linux-based OS. Although it is not ideal
to use the Windows OS to explore Kubernetes, many people are using the Windows OS as
their desktop or laptop machine. Luckily, there are a lot of ways to run the Linux OS on
Windows using virtualization technologies, which makes running a Kubernetes cluster on
Windows machines possible. Then, we can build a development environment or do a proof
of concept on our local Windows machine.

You can run the Linux VM by using any hypervisor on Windows to set up Kubernetes from
scratch, but using minikube (https:/​/​github.​com/​kubernetes/​minikube) is the fastest way
to build a Kubernetes cluster on Windows. Note that this recipe is not ideal for a
production environment because it will set up a Kubernetes on Linux VM on Windows.

Getting ready
To set up minikube on Windows requires a hypervisor, either VirtualBox (https:/​/​www.
virtualbox.​org) or Hyper-V, because, again, minikube uses the Linux VM on Windows.
This means that you cannot use the Windows virtual machine (for example, running the
Windows VM on macOS by parallels).

However, kubectl , the Kubernetes CLI, supports a Windows native binary that can
connect to Kubernetes over a network. So, you can set up a portable suite of Kubernetes
stacks on your Windows machine.

The following diagram shows the relationship between kubectl, Hypervisor, minikube, and
Windows:

[ 22 ]
Building Your Own Kubernetes Cluster Chapter 1

Hyper-V is required for Windows 8 Pro or later. While many users still use Windows 7, we
will use VirtualBox as the minikube hypervisor in this recipe.

How to do it...
First of all, VirtualBox for Windows is required:

1. Go to the VirtualBox website (https:/​/​www.​virtualbox.​org/​wiki/​Downloads) to


download the Windows installer.
2. Installation is straightforward, so we can just choose the default options and click
Next:

[ 23 ]
Building Your Own Kubernetes Cluster Chapter 1

3. Next, create the Kubernetes folder, which is used to store the minikube and
kubectl binaries. Let's create the k8s folder on top of the C: drive, as shown in
the following screenshot:

4. This folder must be in the command search path, so open System Properties,
then move to the Advanced tab.
5. Click the Environment Variables... button, then choose Path , and then click the
Edit... button, as shown in the following screenshot:

[ 24 ]
Exploring the Variety of Random
Documents with Different Content
would catch the ear of either side could do so only by fierce
denunciation of the other; he that would have it thought that he
loved us had only to show that he hated you. Men of moderation
found no hearers. The voices of the calm and clear-headed sank into
silence; and Wigfall and Toombs, and Sumner and Phillips walked up
and down in the land.
Yes, no doubt we had thousands of statesmen who knew better. But
who knew them? And so Seward kept piping of peace in ninety days,
and Yancey—Polyphemus of politicians—was willing to drink all the
blood that would be shed. A Yankee wouldn’t fight, said the one.
The slave-drivers, perhaps, would, said the other; but they were,
after all, a mere handful; and the poor white trash would be as
flocks of sheep.
A Yankee wouldn’t fight! And why not, pray? Two bulls will, meeting
in a path; two dogs, over a bone. The fishes of the sea fight; the
birds of the air; nay, do not even the little midgets, warmed by the
slanting rays of the summer’s sun, rend one another with
infinitesimal tooth and microscopic nail? All nature is but one vast
battle-field; and if the nations of men seem at times to be at peace,
what is that peace but taking breath for another grapple? And
congresses and kings are but bottle-holders, and time will be called
in due season. The Yankees wouldn’t fight! And suppose they
wouldn’t, why should they, pray, being sensible men?
Where was the Almighty Dollar?
Had any one of the Southern leaders read one page of history, not
to know that money means men? means cannon, rifles, sabres?
means ships, and commissariat, and clothing? means rallying from
reverses, and victory in the end? The Yankee would not fight, they
told us. His omnipotent ally they forgot to mention or to meet. Had
our Congress consisted of bankers, merchants, railway
superintendents, they would have seen to the gathering of the
sinews of war. We had only the statesmen of the period,—God save
the mark!
It was in finance that we blundered fatally. ’Twas not the eagle of
the orator that overcame us, but the effigy thereof, in silver and in
gold.
When we fired on Fort Sumter there was a burst of patriotism
throughout the North, and her young men flocked to her standards.
They fought, and fought well. The difference between them and us
was, that when they got tired of poor fare and hard knocks they
could find others to take their places. Being sensible, practical men,
they used their opportunities. When a man was drafted (as the war
went on) he or his friends found the means of hiring a substitute
(persons who have visited the North since the war tell me that you
rarely find a man of means who served in the army); and at last
cities and counties and States began to meet each successive call for
fresh troops by votes of money; their magnificent bounty system
grew up, and from that time the composition of the Northern armies
rapidly changed. Trained soldiers from every part of the world
flocked to the El Dorado of the West; and as the war went on each
successive battle brought less and less grief to the hearts and homes
of the North, while with us—with us!
From every corner of Europe they poured.
From Italy, from Sweden, from Russia, and from Spain.
From the Danube and the Loire; from the marshy borders of the
Elbe and the sunny slopes of the Guadalquivir.
From the Alps and the Balkan. From the home of the reindeer and
the land of the olive. From Majorca and Minorca, and from the Isles
of Greece.
From Berlin and Vienna; from Dublin and from Paris; from the vine-
clad hills of the Adriatic and the frozen shores of the Baltic Sea.
From Skager Rack and Skater Gat, and from Como and Killarney.
From sweet Auburn, loveliest village of the plain, from the banks and
braes o’ bonny Doon, and from Bingen-on-the-Rhine.
Catholic and Calvinist; Teuton, Slav, and Celt,—who was not there to
swell that host, and the babel of tongues around their camp-fires?
For to every hut in Europe, where the pinch of want was known, had
gone the rumor of fabulous bounty and high pay now, generous
pension hereafter.
At Bull Run the North met the South; at Appomattox Lee laid down
his sword in the presence of the world in arms.
CHAPTER LXXI.

And Gordon? What did he see, standing on Massanutten’s crest?


They lay there, beyond Cedar Creek, the Eighth Corps, the
Nineteenth Corps and the Sixth; and, further away, the heavy
masses of their cavalry; spread out before him, forty or fifty
thousand strong.
Like a map. “I can distinguish the very chevrons of that sergeant,”
said he.
And now he bends his eyes on Fisher’s Hill.
Those men lying there were beaten at Winchester, one month ago.
Against brigade Early can bring regiment, against division, brigade;
can oppose division to corps. And yet he is going to hurl this little
handful against that mighty host.
A mere handful; but hearts of English oak! The ancestors of these
men fought and won at Crecy and Agincourt; and they are going to
fight and lose at Cedar Creek. The result was different,—but the
odds and the spirit were the same.
Have I forgotten the brigade of Louisiana creoles? No; but when I
would speak of them, a certain indignant sorrow chokes my
utterance. They came to us many and they went away few; and the
Valley has been made historic by their blood, mingled with ours.
And now is heard the voice of one, speaking as with authority,—the
voice of a Louisianian, proclaiming to the world that these
Louisianians died in an unjust cause. Unjust! It is a word not to be
used lightly. Your share of the obloquy, living comrades, you can
bear; but theirs? For they are not here to speak for themselves.
And to say it to their widows and their orphans!
That word could not help the slave. He is free, thank heaven. Nor
was the war in which these men died waged to free him. He was
freed to wage the war, rather, as everybody knew when the
proclamation of emancipation was promulgated. In point of fact, the
struggle was between conflicting interpretations of the Constitution;
and the Northern people, by a great and successful war, established
their view of its obligations; the freedom of the slave being a
corollary of victory.
Unjust! had it not been as well to leave that word to others? ’Tis an
ill bird that fouls its own nest.
The war wrought wide ruin; but it has been a boon to the South in
this, at least: that it has jostled our minds out of their accustomed
grooves. Bold thinking has come to be the fashion. And so we should
not find fault with the author of Doctor Sevier, if, dazzled by the
voluptuous beauty of quadroon and octoroon, he should find a
solution of our race troubles in intermarriage. Let him think his little
thought. Let him say his little say. It will do no harm. On one
question he will find, I think, a “solid” North and a “solid” South.
Both are content to choose their wives from among the daughters of
that great Aryan race which boasts so many illustrious women; and
which boasts still more the millions of gentle mothers and brave
wives, whose names the trump of fame has never sounded. And
with such, I think, both the blue and the gray are likely to rest
content. Content, too, that their children, like themselves, should be
of that pure Indo-Germanic stock whence has sprung a Socrates and
a Homer; a Cæsar and a Galileo; a Descartes and a Pascal; a Goethe
and a Beethoven; a Newton and a Shakespeare. The countrymen of
Cervantes and of Cortez, failing to keep their blood pure, have
peopled a continent with Greasers and with Gauchos. And shall the
children of Washington become a nation of Pullman car porters—and
octoroon heroines—be their eyes never so lustrous?
But such matters are legitimate subjects of discussion. So let him
have his say. But there are things which it is more seemly to leave
unsaid.
When a step-mother is installed in the house, you may think her
vastly superior, if you will, with her velvets and her laces and her
diamonds, to her that bore you; and you may, perhaps, win fame as
an original thinker by saying so to the world; but there is a certain
instinct of manhood that would seal the lips of most men. And I, for
my part, know many, very many Northern men; and not one of them
seems to wish to have me grovel in the dust and cry peccavi. Would
it not have been a disgrace to them to have spent, with all their
resources and odds, four years in subduing a race of snivellers? No;
let us say to the end: you were right in fighting for your country, we
equally right in battling for ours. The North will, the North does
respect us all the more for it.
As I read these words, Charley rose, and, opening a book-case, took
out a volume. Finding, apparently, the passage he sought, he closed
the book upon his forefinger.
“When a man takes upon himself,” he began, “to rise up before
Israel to confess and make atonement for the sins of the people, be
should be quite sure that he has the right to exercise the functions
of high-priest.
“If either his father or his mother, for example, sprang from the
region roundabout Tyre and Sidon, that should bid him pause. It is
not enough that one wields the pen of a ready writer. One must be
an Hebrew of the Hebrews. Else the confession goes for naught.
“What Jack has just read,” added he, “brought to my mind a passage
which I have not thought of for ages. You must know, Alice, that
after the death of Cyrus at the battle of Cunaxa, the Ten Thousand
made a truce with Tissaphernes, lieutenant of Artaxerxes, who
agreed to conduct them back to Greece. After journeying together
for some time, he invited the Greek generals to a conference at his
headquarters. Clearchus and almost all of the leading officers
accepted the invitation, and at a given signal were seized and
murdered.
“The Ten Thousand were in as bad plight as ever an army was.
Without leaders, confronted by a countless host, they had either to
surrender or cut their way through a thousand miles of hostile
territory.
“Xenophon, though not an officer, called an assembly, and soon
aroused a stern enthusiasm. Speech after speech was made, and no
one uttered other than brave words, except a certain Apollonides;
and he cried out that the others spoke nonsense,—that the safe and
profitable thing to do was to grovel before the Great King. Xenophon
replied in a sarcastic vein, ending as follows:
“‘It seems to me, oh men, that we should not admit this man into
any fellowship with us, but that we should cashier him of his
captaincy and put baggage upon his back, and use him as a beast of
burden. For he is a disgrace to his native land and to all Greece,
since, being a Greek, he is such as he is.’
“‘And thereupon, Agasias, the Stymphalian, taking up the discourse,
said, ‘But this man is not a Greek; for I see that, like a Lydian, he
has both his ears bored.’
“And such was the fact. Him, therefore, they cast out.”
CHAPTER LXXII.

It is not my purpose to describe the battle of Cedar Creek. Even of


the rôle played by Gordon’s division, of which the present writer
formed, according to Alice, a large part, I shall give no detailed
account; for my object is not so much to instruct military men as to
entertain my fair reader.
Three simultaneous attacks were to be made. Rosser, advancing
along the “Back-road,” far away to our left, was to swoop down, with
his cavalry, upon that of the enemy. Kershaw and Wharton were to
attack his centre; Gordon, with Ramseur and Pegram, to turn and
assault his left.
At eight o’clock, therefore, in the evening of October 18, 1864, our
men, rising from around their camp-fires and buckling on their
accoutrements, took up their line of march. The enemy was miles
away, yet they spoke in undertones; for their instinct told them that
they were to surprise him. Their very tread as they moved along was
in a muffled rhythm, as it seemed to me, and their canteens gave
forth a dim jingle, as of sheep-bells, by night, from a nodding flock
on a distant hill.
Leaving the pike and turning to the right, we (Gordon’s command) at
one time marched down a country road, at another straggled,
single-file, along bridle-paths, at times fought our way through briers
and amid jagged rocks as we toiled along under the shadow of
Massanutten.
At last, when the night was wellnigh spent, we stacked arms in a
field. The shining Shenandoah murmured just in front of us. We
talked almost in whispers.
Suddenly the notes of a bugle, faint, far away, broke the stillness of
the night. The enemy’s cavalry at Front Royal were sounding the
reveille. We held our breath,—had they divined our intentions?
The bugle-call to our right had scarcely died away, when, from far
away to our left, the rattle of carbines was heard, low and soft, as
though one dreamt of battle! ’Twas Rosser. Unfortunately, he had
found a portion of the enemy in the saddle and ready to march,
though not expecting an attack.
Just then the clanking of sabres and the trampling of hoofs was
heard close beside us; and turning, we saw a squadron of our
cavalry moving upon the ford. A thick mist had begun to rise, and as
they rode through it they seemed colossal phantoms rather than
earthly horsemen. A few moments, and the crack of carbine-shots
was heard. The enemy’s videttes retired, and our horsemen dashed
across the stream. We followed, and formed in a field beyond the
river.
The mist thickened with the approach of day. You could scarcely see
a man thirty feet away. Captain Smith had deployed his skirmishers.
As he stood near me, waiting for the word forward, a terrific rattle of
musketry burst upon our ears, coming from our left. It was Kershaw,
we knew. And then the cannon began to roar. Kershaw had left, his
artillery behind him. Had they been ready to receive him, and were
the cannon and rifles of an entire corps mowing down his gallant
little division? It was an appalling moment!
The word was given, and Captain Smith and his skirmishers dashed
into the wood at a double-quick. We followed, and soon the air was
filled with the roar of wide-spread battle. The cannon that we had
heard, as we soon learned, were captured guns that Kershaw had
turned upon the enemy. His division had rushed up a steep hill and
put a corps to flight. Between us, we had soon driven, in headlong
rout from their camps, the Eighth and the Nineteenth Corps. The
Sixth remained, but we could not see it, so dense was the mist. Our
assault slackened, ceased.
What would have been the result had we pushed on it is needless,
now, to inquire. Desultory firing continued till about four o’clock in
the afternoon, when Sheridan, who was at Winchester when the
battle began, having galloped up, rallied thousands of the fugitives,
and adding them to the Sixth Corps and his heavy force of cavalry,
attacked and routed us in turn.
There were those who said that Early, if he did not choose to
continue the attack (the most brilliant movement of the war, I think),
should have withdrawn his troops, and not held them there, in an
open plain, with greatly superior forces in his immediate front. He
himself, smarting under defeat, attributed the disaster to the fact
that his men, scattering through the captured camps, were engaged
in plundering instead of being at their posts; and his words have
been quoted by our friends the enemy. But I think that a moment’s
reflection will dispel this idea. Our hungry men, pursuing the enemy,
and coming upon their sutlers’ wagons, did undoubtedly snatch up
such edibles as came in their way; but this occurred at day-break,
and we were not attacked till four o’clock in the afternoon. I
remember that I myself, espying a fat leg of mutton (of which some
farmer had been robbed), laid hands on it with a view to a royal
supper when the battle should be over; and, by brandishing it over
my head, like a battle-axe, caused much laughter in the ranks. What
became of it I cannot recall. I know I did not eat it; but I know, too,
that my seizing it had no influence on the fortunes of the day.
The truth is, our defeat requires no explanation or apology from our
brave old general. When Sheridan attacked us, he brought against
our thin, single line of jaded men, overwhelming masses of fresh
troops, assaulting our front, and, at the same time, turning both our
flanks. I remember that Gordon’s men, who held the left of our line,
did not give way till bodies of the enemy had marched entirely
around our flank, and began to pour deadly and unanswered volleys
into our backs.
One more word and I am done with the battle as such.
Captain Smith, in his letter to Major Frobisher, found it impossible to
understand why our army was not entirely destroyed at Winchester.
I, on the contrary, can explain how it was that we were not
annihilated at Cedar Creek.
When the enemy, in their pursuit, reached Strasburg, and saw,
below them, slowly retreating along the road to Fisher’s Hill, a dark
mass of troops, they called a halt. That halt saved our army. I can
hardly repress a smile now, when I remember that that serried
phalanx which looked so formidable, and gave the enemy pause,
consisted of fifteen hundred Federal prisoners, guarded by a few
hundred of our men. But the eccentric strategy of that halt, instead
of being comic, was, in truth, fearfully tragic; for it protracted the
defence of Richmond, and delayed the close of the war till the
following spring, and cost the lives of thousands of brave men on
both sides.
So much for the battle of Cedar Creek. Such slight sketch of it as I
have given has cost me more pain than it can give the reader
pleasure. Not willingly did I introduce it into my story.
That story grows sombre. It opened bright and joyous as the sunny
nook of Earth in which my earlier scenes were laid. But between my
hero and the land he helped to defend there is a parallelism of
fortunes. The shadow of the same fate hangs over both.
SYMPHONY OF LIFE.

MOVEMENT IV.
CHAPTER LXXIII.

During the night of this 18th of October, while we were making our
toilsome advance upon the enemy, a Virginia soldier, wounded in the
battle of Winchester, lay in a small room of a house in the edge of
Middletown; around which village the battle of Cedar Creek was
chiefly fought. Upon some bedding, spread upon the floor, lay a
young woman, his cousin; who, having heard that he had been hard
hit, had made her way to the enemy’s pickets, and, after some
parleying, gained permission to pass within their lines and nurse her
wounded relative. This young woman had, since the beginning of
the war, passed her life, as one might say, in our hospitals. But her
present position, within the enemy’s lines, was a trying one. It so
happened that between the Federal officer who occupied a room in
the same house and herself a strong antipathy soon grew up. The
little nurse was too busy attending to the wants of her wounded
cousin to leave his side often; but being under the same roof with
the Federal officer, they met, in a casual manner, not infrequently.
These meetings he contrived to make very disagreeable, by
continually attempting to force political discussions upon her. But
she, on her side, managed to render them far more exasperating to
him.
He that would get the better of a woman had best finish her with a
club at once and be done with it; he is sure to get the worst of it in
a tongue-battle. It may be a washerwoman opening on you with
Gatling-gun invective, and sweeping you from the face of the earth;
or a dainty society belle, with a dropping sharp-shooter fire of soft-
voiced sarcasm,—in either case you shall wish that you had held
your peace.
And so this big Federal colonel never had an encounter with the little
rebel nurse but he gnashed his teeth and raged for hours
afterwards. She always contrived, in the subtlest way, and without
saying so, to make him feel that she did not look upon him as a
gentleman. One day, for example, he had been carefully explaining
to her in how many ways the Northern people were superior to the
Southern.
“But I don’t believe,” added he, with evident acrimony, “that you F. F.
V.’s think there is one gentleman in the whole North. This arrogance
on your part is really one main cause of the war.”
“I can readily believe you,—for I understand the feeling. But really
you do us an injustice. I know, personally, a number of Northern
gentlemen. In New York, for instance” (the colonel was from that
city), “I am acquainted with the ——— family and the ———s and
the ———s, do you know them?”
The colonel hesitated.
“No?” said she, in soft surprise. “Ah, you should lose no time in
making their acquaintance on your return to the city. They are very
nice. But I hear my patient calling. Good-day!”
The colonel knew, and he saw plainly that she knew, that he could
no more enter one of those houses than he could fly. He could not
answer her. All that was left him was to hate her, and this he did
with his whole heart; and all aristocrats, living and dead.
When the crash of battle burst forth, on the morning of the
nineteenth, the colonel hurried forth to form his regiment. He met
his men rushing pell-mell to the rear, and he ran back to his
headquarters to gather a few things that lay scattered about his
room. Although the bullets were flying thick, frequently striking the
house itself, he found the little nurse standing on the porch,
exultation in every feature. The whizzing of the rifle-balls seemed
sweet to her ears. Confederate bullets would not hurt her.
“Get out of my way,” said he, in a gruff voice. “This is no place for
women.”
“Nor for men, either, you seem to think!”
He gave her a black look.
“Why this unseemly haste, colonel?” said she, following him into the
hall. “What! through the back door? The Confederates are there!”
And she stabbed the air in the direction of the coming bullets with a
gesture that would have made the fortune of a tragedy queen.
“Take that, d——n you!” And he brought his open hand down upon
her cheek with such force that, reeling through the open door of her
room, she fell headlong upon the floor.
“Coward!” roared a voice from the threshold of the hall.
Rising to her knees and turning, she saw the colonel spring forward
with a fierce glare in his eyes and a cocked pistol in his extended
hand. She shut her eyes and stopped her ears.
Had he killed the Confederate? No, for she heard no fall; but the
clear ring, instead, of a sabre drawn quickly from its scabbard. The
colonel stepped across the threshold of the room in which she was,
cocking his pistol for another shot. He raised the weapon,—but she
heard a spring in the hall, and saw a flash of steel; and the colonel
fell at full length upon the floor, with a sword-blade buried up to the
hilt in his breast. With such terrific force had the thrust been
delivered that he was knocked entirely off his feet, and the whole
house shook.
“Δούπησεν δὲ πεσών, ἀράβησε δὲ τεύχε᾽ ἐπ᾽αὐτῷ,”[1] muttered the
victor, as the young woman, springing to her feet, threw her arms
around his neck and kissed him.
“My brave defender!” cried she, in a fervor of patriotic exaltation,
lifting her eyes to his; and then she sprang back with a shiver, and
stood breathless before him, her head bowed upon her breast, her
face ashy pale.
A scene within a scene.
Without, the roar of cannon, the incessant rattle of musketry, the
bursting of shells, the panic-stricken rush of riderless horses, the
tramp of hurrying men, the Rebel Yell sweeping by like a tornado,
shouts of victory, moans of the dying.
Within, four people for a moment oblivious of all this mad hurly-burly
that billowed around them.
The convalescent soldier, rising upon his elbow, looked with silent
amazement upon the crouching figure of his fair cousin; while the
dying Union soldier forgot, for a moment, his gaping wound as he
gazed upon the man who had inflicted it. Tall, broad-shouldered,
gaunt of flank, supple, straight as an Indian, he held in his right
hand the gory sword, from which the prostrate officer saw his own
life-blood trickling, drop by drop, upon the floor. In his left he held
his cap uplifted.
Attila and Monsieur Deux-pas in one!
With cap uplifted; but head thrown back and eyes averted. His right
shoulder and breast were soaked with blood, which was streaming
down his brown beard upon his coat, from a bullet-hole in his
bronzed cheek. But it was his eyes which riveted the attention of his
fallen enemy. He had been appalled by their fierce glare, when,
angered by the pistol-shot, he had sprung upon him in the hall. But
that look had been soft compared with the cold, steady, pitiless
gleam they poured forth now. That man, thought he, would not give
a cup of water to a dying enemy.
Captain Smith made two steps towards the door, and turning,
bowed.
Feeling that he was going (for she had not dared to raise her eyes),
Mary Rolfe quivered for a moment from head to foot; then springing
forward, with passionate entreaty in every gesture and a cry of
anguish upon her lips:
“And you will leave me without a word? Listen! How frightfully the
battle is raging! And you are so cruel, cruel, as to go forth, and die,
perhaps, without ever— I know you will be killed, I know it, I know
it! And you won’t say you forgive me! Won’t you say just that one
little word? You loved me once,—and dearly, for you pressed me
against your heart and told me so; and can that heart, once so
tender, be so hard now? Oh, say you forgive me; for the sake of that
dear, dead love, say you forgive your little Mary!”
And round about them the battle roared and surged and thundered.
Her cousin has told me that such was the pathos and passion of her
tones, her looks, her gestures, as she uttered these words (which
hardly seemed unconventional in their fearful setting), that the eyes
of the dying soldier grew moist. But Captain Smith, standing like a
granite cliff:
“There is nothing to forgive. You did your duty as you saw it. So did
I when I ran that officer through.—Ah, pardon me: I had forgotten
you. Can I do anything for you?” added he in a tender voice, as he
kneeled beside him.
“Unbutton my coat, please; I am choking.”
The captain shuddered as he saw the broad gash in the breast of his
enemy. “I am sorry I hit you so hard.”
“It is all right,” replied he, wearily. “I tried to kill you, and you killed
me, that’s all. But thank you for your kind words.”
The captain’s eyes filled with tears. “I hope it is not as bad as you
think. I’ll send you a surgeon immediately. Meanwhile, keep up your
spirits.” And taking the wounded man’s hand in his, he pressed it
softly. Then, rising, “Good-by,” said he, with a cheering smile, and
moved towards the door.
It was then that Mary, catching, for the first time, a view of the right
side of his face, saw the blood trickling down his cheek.
“You are wounded already,” she cried in terror.
“Yes; wounded beyond healing,” said the captain of the Myrmidons;
and with a cold bow, he passed out of the door and into the tempest
of the battle.
“Oh—oh—oh!” gasped Mary, wringing her interlocked hands high
above her head; and she sank slowly down upon the floor.
The measures fashioned by the hands of men can hold but so much;
but anguish without limit may be pent up within a human heart that
is bursting, yet will not burst.
The officer turned his eyes, and, even in his own great extremity,
pitied her.
And, after all, which of the two was most to be pitied?
He was about to speak a few kind words, when he saw upon her
pallid cheek the dark bruises made by his own heavy hand; and he
held his peace. His lips were parched, his throat tortured with that
cruel thirst that loss of blood entails. His wounded neighbor could
not, she would not hand him a cup of water. At any rate, it were
worthier to die there, where he lay, rather than ask a favor of the
woman he had so insulted. Three times he tried to rise, and as often
fell heavily back. She raised her head and saw the longing, wistful
look in his eyes, fixed upon a bucket which stood in a corner of the
room.
It is wonderful how sorrow softens the heart!
She rose in an instant and brought him the cup. He could not lift his
head. Bending over him, she placed her arm beneath his neck and
raised him. As he drank, the tears poured down his cheeks. Gently
withdrawing her arm, she tripped softly across the room and brought
her own pillow and placed it beneath his head; and sitting down
upon the floor, by his side, stroked his brown forehead with her soft
white hand. He raised his streaming eyes to hers, and again and
again essayed to speak; but his quivering lips refused to obey.
“I know what you would say; so never mind. Don’t worry now. You
may beg my pardon when you get well.”
He shook his head sadly. “I am dying now,—I feel it.”
His voice sank into a whisper. She bent over him to catch his words.
“Promise me to write to my mother and tell her how I died, and that
you sat beside me. Leave out one thing. It would break her heart to
hear that of me. You will? God bless you. Her address is in my
pocket. Write to her. You promise? Oh, how good of you to hold the
very hand that—”
“Hush! Don’t talk of that now.”
“You won’t have to hold it long. I feel it coming, coming. Press my
hand hard, harder! You have forgiven me! Tell her, that as I lay—
dying—far away from home—an angel—of light—”

[1] He fell with a crash, and his arms rattled upon him.
(The Homeric formula when a warrior falls.)
CHAPTER LXXIV.

If only night would come!


They were pouring down upon us and around us in overwhelming
masses. They had turned our left, and were raking Gordon’s flank
and rear. It was a question of a few minutes only.
In our front was a narrow field. Beyond that, a wood. Through this
the enemy were driving our skirmishers back upon the main line.
One by one these brave men emerged from the wood and trotted
briskly across the field, targets, every one of them, for a dozen rifles.
There come two more! They are the last. But they do not trot, as the
rest did and as skirmishers should.
Upon those two, convergent rifles from all along the line of the wood
poured a rain of lead. Still they refused to hurry. And one was tall
and bearded, and the other slender, and with a face as smooth as a
girl’s. The boy, as fast as he loaded his rifle, wheeled and fired; the
man carried a pistol in his hand. Weeds fell about them, mowed
down by the bullets; spurts of dust leaped from under their very
feet.
The few men left in our line stood, under cover of a thin curtain of
trees, fascinated by the sight of these two, leisurely stalking along,
under that murderous fire.[1]
“Run, run!” we shouted.
“Run!” cried Captain Smith, giving the shoulder of his companion a
push.
“And leave my commander!” replied Edmund.
“Stoop, then!”
“Show me how, captain!”
“Obey me!” thundered he.
The boy lowered his head, as he rammed a bullet home; then
turned, and, cocking his rifle, scanned the opposite wood narrowly.
Presently he raised his rifle; but before he could fire we heard that
terrible sound which old soldiers know so well.
“Oh!” cried the boy, falling upon his face.
“My God! my God!” ejaculated the captain of the Myrmidons, with a
woman’s tenderness in his voice and the despair of Laocoön in his
corrugated brow.
Hearing that cry, the boy turned quickly and smiled in his captain’s
face. “It is only a flesh-wound, through the thigh,” said he; “I can
walk, I think.”
He was attempting to rise, when his captain, placing his strong arms
beneath him, lifted him high in the air. He ran, then; and his face
was full of terror, as the thick-flying bullets whistled past him and his
burden. The two were within a few paces of where I stood, when
again that terrific sound was heard; and they both fell heavily at my
very feet.
A bullet, coming from our flank and rear, had struck Captain Smith in
the right breast.
It was a wound in front, at any rate.
There was but one ambulance-wagon in sight, and that was
retreating. A skirmisher ran to overtake it. Others placed the captain
and Edmund on stretchers and hurried after it.
“Jack, old boy; good-by. I am done for; but I particularly desire to
get within our lines; so hold them in check as long as you can. Say
farewell to Charley.”
A few of his own men held their ground till they saw their captain
and Edmund disappear, in the wagon, over the hill, when they fell
back, loading and firing as they went. When the wagon reached the
bridge beyond Strasburg, it was found broken down; but the men
with the stretchers managed to get our two wounded friends across
the stream, and to find another wagon; so, the pursuit slackening at
this juncture, they were not captured.
Late in the night, I found them by the road-side. Edmund was
asleep. The captain lay awake, watched by one of his brave
skirmishers. He gave messages to my grandfather, to Charley and
Alice, to the Poythresses. “And now, good-night,” said he. “You need
rest. Throw yourself down by that fire and go to sleep. Don’t bother
about me. I shall set out for Harrisonburg at daybreak.”
“The ride will kill you.”
He smiled faintly. “I must get well within our lines. Remember—
Harrisonburg—good-night!” And he closed his eyes and wearily
turned his lace away. “Shelton!”
The skirmisher bent tenderly over his captain.
“Lie down by the fire and sleep. You cannot help me. God alone can
do that, and he will release me from my sufferings before many
days. Shelton, give me your hand. Tell your little boy, when he grows
up, that I said you were as brave as a lion in battle; and tell your
wife that you could be as gentle as a woman to a suffering comrade.
And now lie down and rest. Good-night!”
“Presently, captain.”
“What are you crying about, man? Such things will happen. Good-
night!”
[1] Meis ipsius vidi oculis.
CHAPTER LXXV.

Let us return to that little parlor on Leigh Street, from the windows
of which, four years ago, we caught our first glimpse of the man
who has played so large a part in our story. It is full of people, now,
—half a dozen elderly men, all the rest women. Of the men, one is a
minister, with a face so singularly gentle that his smile is a sort of
subdued sunbeam.
The countenances of the women all wear looks of happy expectancy.
Mr. and Mrs. Poythress are there, and Lucy. Mr. and Mrs. Rolfe, but
not Mary. And others whom the reader, to her cost, does not know.
Our plump friend, Mrs. Carter, is bustling about, who but she, her
jolly face wreathed in smiles.
At every sound in the hall, every female neck is craned towards the
door. Somebody or something is expected.
“Mrs. Carter,” said Mrs. Poythress, “what name has Alice selected for
the little man?”
“Oh, yes! what is to be his name?” echoed every lady in the room.
Thereupon, Mrs. Carter, being constitutionally incapable of laughing,
began to shake.
At this eccentric behavior on the part of the young grandmother,
curiosity rose to fever heat; but the more they plied her with
questions, the more she could not answer. Seeing her incapable of
speech, her grave and silent husband came to the rescue, and
explained that what amused Mrs. Carter was that she did not know
what their grandchild was to be called. It appeared that Alice, as a
reward for his getting well of his wound, had allowed Charley the
privilege of naming their son. He had accepted the responsibility,—
but no mortal, not even his wife, had been able to make him say
what the name was to be.
This statement sent the curiosity of the audience up to the boiling
point. Did you ever!
Mrs. Rolfe interrogated Mr. Rolfe with her impressive eyes.
“Such a fancy would never have occurred to me, I’m sure,” said that
man of peace.
“Al-i-ce!” called Mrs. Carter, from the foot of the stairs.
“We are coming, mother,” answered a cheery voice from the ball
above; and Alice, giving two or three final little jerks at the ends of
certain ribbons and bits of lace that adorned her boy (he was asleep
on his nurse’s shoulder), stood aside to let that dignitary pass down-
stairs, at the head of the procession.
“And now,” said Alice, going up to her husband, “what is his name to
be?”
“One that he will never have cause to be ashamed of,” replied
Charley.
Alice drew back in surprise. Up to this point she had looked upon the
thing as a joke, and enjoyed it, too, as so characteristic of her
husband. This time, however, he had not smiled, as usual. On the
contrary, he betrayed, both in voice and look, a certain suppressed
excitement. She imagined, even, that he was a trifle pale; and her
heart began to flutter a little, she knew not why.
The column halted when it reached the closed parlor door. Here
Charley took the sleeping boy in his arms.
When the audience within heard the knob rattle, the excitement was
intense. It was dissipated, in an instant, by the sight of Charley
bearing the child.
In this wide world there lives not a woman who can look upon a
bearded man, with his first infant in his arms, without smiling.
The admiring ohs and ahs made the young mother’s heart beat high
with joy. And who shall call her weak, because she forgot that they
are to be heard at every christening? In the name of pity, let us sip
whatever illusive nectar chance flowers along our stony path may
afford!
Every one noticed how awkward Charley was in handing the baby to
the minister; while the good man, on the contrary, received an
ovation of approving smiles for his skill in holding him.
The little fellow, himself, appeared to feel the difference. He nestled,
at any rate, against the comfortable shoulder, and threw his head
back; and his little twinkling nose, pointing heavenward, seemed to
say that he knew what it all meant.
“Name this child!”
“Ah-ah-ah-ah!”
Every neck was craned, every ear eager to catch the first mysterious
syllable!
Alice glanced anxiously at her husband.
Why that determined look? What was he going to do?
A lightning-flash darted through her brain! Charley’s mother’s father
was named Peter! He had been a man of mark in his day; and,
besides, Charley worshipped his mother’s memory. Peter! Horrors!
And then he stammers so over his P’s! That half-defiant look, too!
Charley leaned forward.
She could not hear what he said; but she saw, from the obstinate
recusancy of his lips, that there was a P in the name. She felt a
choking in her throat.
’Twas her first,—and Peter! And he knew how painfully absurd she
thought the name! Poor little innocent babe! Peter! Her eyes filled
with tears.
No one had heard the name; not even the minister. He bent an
inquiring look upon Charley.
Charley repeated the words.
This time the good man heard, though no one else did. Bringing his
left arm around in front of his breast, he dipped his right hand into
the water, and raised it above the head of the sleeping boy.
Alice’s heart stood still!
“Theodoric Poythress, I baptize thee—”
A gasp of surprise, followed by a stifled moan, startled minister and
people; and all eyes were turned towards the Poythress group.
Mrs. Poythress lay with her head upon her husband’s breast, silent
tears streaming from her closed eyes. Lucy, half-risen from her seat,
leaned over her mother, holding her hand, deep compassion in her
gentle eyes! Her father sat bolt upright, looking stern, in his effort to
appear calm. Her mother pressed Lucy gently back into her chair,
and the minister went on.
Hurried leave-takings followed the ceremony. The baby was awake
and gurgling, but nobody noticed him; not even his mother. Mrs.
Poythress did not stir.
The front door was heard to close.
“Lucy, are they all gone?”
“Yes, mother.”
She opened her eyes, and seeing Charley standing, silent, by the
side of his wife, rose and staggered towards him, with outstretched
arms. He ran to meet her; and she folded him to her breast with a
long, convulsive embrace; then dropped into a chair, without a word,
and covered her face with one hand, while she held one of his with
the other.
First, Lucy thanked Charley, and then Mr. Poythress, coming up, and
taking Charley’s hand in both his: “My boy, you are as true as steel,
—I thank you.” And he strode stiffly out into the hall.
And instantly, as Alice’s quick eye noticed, the cloud which had
lingered on her husband’s brow vanished. He drew a long, deep
breath, and turning with a bright smile, chucked young Theodoric
under the chin. “How do you like your name, young fellow?”
The corners of the young fellow’s mouth made for his ears, then
snapped together beneath his nose.
“Your views vary with kaleidoscopic rap-p-p-pidity,” remarked the
philosopher.
The son of the philosopher crowed.
“He says he rather likes his name,” said Charley; “but,” added he,
drawing his handkerchief from his pocket, “those drops of water, at
the corners of his eyes, look too much like—”
“Hush!” cried Alice, quickly; and she laid her hand on her husband’s
mouth.
“Absit omen!” said he.
CHAPTER LXXVI.

On the morning following this christening, the papers contained a


telegraphic account of our defeat at Cedar Creek. And, late in the
afternoon of the same day, Lucy Poythress walked into the Carters’
back parlor. Her eyes were red and swollen.
“Have you any news?” asked Alice, anxiously.
“Here is a letter from Edmund.”
“Then he is safe, thank God!”
“Not exactly. The poor child was shot through the thigh. Mr. Whacker
is unhurt.”
“And Captain Smith?”
Lucy’s lips quivered.
“Not killed?” cried Alice, clasping her hands.
“No, but dangerously wounded,—very. Here is Edmund’s letter to
mother.”
Alice read it aloud. He gave an account of the battle, making light of
his own wound (“The rascals popped me in the second joint”), but
represented his captain’s as very serious. The captain had advised
him to remain in Harrisonburg, but had himself gone to Taylor’s
Springs, four miles distant. As for himself, he was in luck.
“Who do you think is my nurse? Why, Miss Mary Rolfe! The battle
caught her in Middletown, nursing a Confederate soldier; and when,
in the afternoon, the enemy showed signs of an intention to attack,
the captain sent me, with an ambulance-wagon, to Miss Mary. I was
to tell her that in my opinion (that is what he told me to say) it
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like