100% found this document useful (12 votes)
50 views

Download Full (Ebook) Traefik API Gateway for Microservices: With Java and Python Microservices Deployed in Kubernetes by Rahul Sharma, Akshay Mathur ISBN 9781484263754, 9781484263761, 1484263758, 1484263766 PDF All Chapters

The document provides information about various ebooks available for download, including 'Traefik API Gateway for Microservices' by Rahul Sharma and Akshay Mathur, which focuses on deploying Java and Python microservices in Kubernetes. It includes details such as ISBN numbers, links to purchase, and a brief overview of the book's content and structure. Additionally, it mentions other related ebooks covering topics like cloud-native microservices, SAT preparation, and cooking.

Uploaded by

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

Download Full (Ebook) Traefik API Gateway for Microservices: With Java and Python Microservices Deployed in Kubernetes by Rahul Sharma, Akshay Mathur ISBN 9781484263754, 9781484263761, 1484263758, 1484263766 PDF All Chapters

The document provides information about various ebooks available for download, including 'Traefik API Gateway for Microservices' by Rahul Sharma and Akshay Mathur, which focuses on deploying Java and Python microservices in Kubernetes. It includes details such as ISBN numbers, links to purchase, and a brief overview of the book's content and structure. Additionally, it mentions other related ebooks covering topics like cloud-native microservices, SAT preparation, and cooking.

Uploaded by

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

Download Full Version ebook - Visit ebooknice.

com

(Ebook) Traefik API Gateway for Microservices:


With Java and Python Microservices Deployed in
Kubernetes by Rahul Sharma, Akshay Mathur ISBN
9781484263754, 9781484263761, 1484263758,
1484263766
https://ebooknice.com/product/traefik-api-gateway-for-
microservices-with-java-and-python-microservices-deployed-
in-kubernetes-22075350

Click the button below to download

DOWLOAD EBOOK

Discover More Ebook - Explore Now at ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason;


Viles, James ISBN 9781459699816, 9781743365571,
9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

ebooknice.com

(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena


Alfredsson, Hans Heikne, Sanna Bodemyr ISBN 9789127456600,
9127456609
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312

ebooknice.com

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT


II Success) by Peterson's ISBN 9780768906677, 0768906679

https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018

ebooknice.com

(Ebook) Cloud-Native Microservices with Apache Pulsar:


Build Distributed Messaging Microservices by Rahul Sharma,
Mohammad Atyab ISBN 9781484278383, 1484278380
https://ebooknice.com/product/cloud-native-microservices-with-apache-
pulsar-build-distributed-messaging-microservices-36507274

ebooknice.com
(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master
the SAT Subject Test: Math Levels 1 & 2) by Arco ISBN
9780768923049, 0768923042
https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-
arco-master-the-sat-subject-test-math-levels-1-2-2326094

ebooknice.com

(Ebook) Cambridge IGCSE and O Level History Workbook 2C -


Depth Study: the United States, 1919-41 2nd Edition by
Benjamin Harrison ISBN 9781398375147, 9781398375048,
1398375144, 1398375047
https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044

ebooknice.com

(Ebook) SRE with Java Microservices: Patterns for Reliable


Microservices in the Enterprise by Jonathan Schneider ISBN
9781492073925, 149207392X
https://ebooknice.com/product/sre-with-java-microservices-patterns-
for-reliable-microservices-in-the-enterprise-55575376

ebooknice.com

(Ebook) Playing with Java Microservices on Kubernetes and


OpenShift by Nebrass Lamouchi ISBN 9782956428510,
9782956428527, 2956428519, 2956428527
https://ebooknice.com/product/playing-with-java-microservices-on-
kubernetes-and-openshift-35145762

ebooknice.com

(Ebook) Pro Java Microservices with Quarkus and


Kubernetes: A Hands-on Guide by Nebrass Lamouchi ISBN
9781484271698, 1484271696
https://ebooknice.com/product/pro-java-microservices-with-quarkus-and-
kubernetes-a-hands-on-guide-34171588

ebooknice.com
Traefik API
Gateway for
Microservices
With Java and Python Microservices
Deployed in Kubernetes

Rahul Sharma
Akshay Mathur
Traefik API Gateway
for Microservices
With Java and Python
Microservices Deployed
in Kubernetes

Rahul Sharma
Akshay Mathur
Traefik API Gateway for Microservices
Rahul Sharma Akshay Mathur
Patpargunj, Delhi, India Gurgaon, Haryana, India

ISBN-13 (pbk): 978-1-4842-6375-4 ISBN-13 (electronic): 978-1-4842-6376-1


https://doi.org/10.1007/978-1-4842-6376-1

Copyright © 2021 by Rahul Sharma, Akshay Mathur


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.

Managing Director, Apress Media LLC: Welmoed Spahr


Acquisitions Editor: Divya Modi
Development Editor: Laura Berendson
Coordinating Editor: Divya Modi
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1
New York Plaza, Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201)
348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media,
LLC is a California LLC and the sole member (owner) is Springer Science + Business Media
Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for
reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub via the book’s product page, located at www.apress.com/
978-1-4842-6375-4. For more detailed information, please visit http://www.apress.com/
source-code.
Printed on acid-free paper
To our families, for all the personal time spent on this book
Table of Contents
About the Authors��������������������������������������������������������������������������������ix
About the Technical Reviewer�������������������������������������������������������������xi
Acknowledgments�����������������������������������������������������������������������������xiii
Introduction����������������������������������������������������������������������������������������xv

Chapter 1: Introduction to Traefik���������������������������������������������������������1


Microservice Architecture�������������������������������������������������������������������������������������3
Agility���������������������������������������������������������������������������������������������������������������6
Innovation��������������������������������������������������������������������������������������������������������6
Resilience��������������������������������������������������������������������������������������������������������7
Scalability��������������������������������������������������������������������������������������������������������7
Maintainability�������������������������������������������������������������������������������������������������8
n-Tier Deployment������������������������������������������������������������������������������������������������9
Four-Tier Deployment������������������������������������������������������������������������������������12
Gateway Characteristics�������������������������������������������������������������������������������������14
Application Layer Protocols���������������������������������������������������������������������������14
Dynamic Configuration����������������������������������������������������������������������������������16
Observability��������������������������������������������������������������������������������������������������18
TLS termination���������������������������������������������������������������������������������������������19
Other Features�����������������������������������������������������������������������������������������������20

v
Table of Contents

Traefik�����������������������������������������������������������������������������������������������������������������21
Installation�����������������������������������������������������������������������������������������������������23
Traefik Command Line�����������������������������������������������������������������������������������24
Traefik API������������������������������������������������������������������������������������������������������26
Traefik Dashboard�����������������������������������������������������������������������������������������28
Summary������������������������������������������������������������������������������������������������������������29

Chapter 2: Configure Traefik���������������������������������������������������������������31


Configuration Topics��������������������������������������������������������������������������������������������31
Introduction to Sample Web Service�������������������������������������������������������������������32
Traefik Configuration�������������������������������������������������������������������������������������������35
Entrypoints����������������������������������������������������������������������������������������������������36
Routers����������������������������������������������������������������������������������������������������������43
Services��������������������������������������������������������������������������������������������������������������50
Middleware����������������������������������������������������������������������������������������������������58
Summary������������������������������������������������������������������������������������������������������������65

Chapter 3: Load Balancing������������������������������������������������������������������67


HTTP Load Balancer��������������������������������������������������������������������������������������������68
Round Robin��������������������������������������������������������������������������������������������������69
Weighted Round Robin����������������������������������������������������������������������������������77
Mirroring��������������������������������������������������������������������������������������������������������83
TCP Service���������������������������������������������������������������������������������������������������������86
Round Robin��������������������������������������������������������������������������������������������������87
Weighted Round Robin����������������������������������������������������������������������������������90
UDP Service��������������������������������������������������������������������������������������������������������92
Round Robin��������������������������������������������������������������������������������������������������93
Weighted Round Robin����������������������������������������������������������������������������������96
Summary������������������������������������������������������������������������������������������������������������97

vi
Table of Contents

Chapter 4: Configure TLS��������������������������������������������������������������������99


Quick Overview of TLS����������������������������������������������������������������������������������������99
TLS Termination at Traefik���������������������������������������������������������������������������������102
Exposing MongoDB Route on TLS����������������������������������������������������������������103
Let’s Encrypt Automatic Certificate Provisioning�����������������������������������������107
Provisioning TLS Certificates for Public TCP Endpoints�������������������������������108
Secure Traefik Dashboard over TLS�������������������������������������������������������������114
Traefik for TLS Forwarding��������������������������������������������������������������������������������121
Summary����������������������������������������������������������������������������������������������������������125

Chapter 5: Logs, Request Tracing, and Metrics��������������������������������127


Prerequisites�����������������������������������������������������������������������������������������������������129
Traefik Configuration�����������������������������������������������������������������������������������133
Traefik Logs�������������������������������������������������������������������������������������������������������135
Access Logs�������������������������������������������������������������������������������������������������137
Log Rotation������������������������������������������������������������������������������������������������143
Blacklisting��������������������������������������������������������������������������������������������������145
Request Tracing������������������������������������������������������������������������������������������������147
Install Zipkin������������������������������������������������������������������������������������������������148
Integrate Zipkin�������������������������������������������������������������������������������������������150
Traefik Metrics��������������������������������������������������������������������������������������������������154
Configure Prometheus���������������������������������������������������������������������������������155
Summary����������������������������������������������������������������������������������������������������������158

Chapter 6: Traefik for Microservices������������������������������������������������159


Pet-Clinic Application����������������������������������������������������������������������������������������162
Application Configuration����������������������������������������������������������������������������164
Consul Service Registry������������������������������������������������������������������������������165

vii
Table of Contents

Deploy Pet-Clinic�����������������������������������������������������������������������������������������167
Pet-Clinic UI�������������������������������������������������������������������������������������������������171
Configure Gateway��������������������������������������������������������������������������������������������173
Service Details��������������������������������������������������������������������������������������������177
Circuit Breaker���������������������������������������������������������������������������������������������179
Retries���������������������������������������������������������������������������������������������������������182
Throttling�����������������������������������������������������������������������������������������������������185
Canary Deployments�����������������������������������������������������������������������������������188
Summary����������������������������������������������������������������������������������������������������������190

Chapter 7: Traefik as Kubernetes Ingress����������������������������������������191


Traefik as Kubernetes Ingress Controller����������������������������������������������������������191
Installation of Traefik on Kubernetes����������������������������������������������������������������194
Installing the bookinfo Application��������������������������������������������������������������204
Installing Traefik with Helm�������������������������������������������������������������������������������209
Exploring Traefik Helm Chart�����������������������������������������������������������������������211
Local Installation�����������������������������������������������������������������������������������������217
Exposing the bookinfo Reviews Service������������������������������������������������������222
Configure Request Tracing with Jaeger������������������������������������������������������������228
Setup Traefik on DigitalOcean Kubernetes Cloud����������������������������������������������234
TLS Termination on Kubernetes via Let’s Encrypt Certificates��������������������237
TLS Certificate Limitations with Multiple Traefik Instances�������������������������243
Summary����������������������������������������������������������������������������������������������������������245

Index�������������������������������������������������������������������������������������������������247

viii
About the Authors
Rahul Sharma is a seasoned Java developer
with over 15 years of industry experience.
In his career, he has worked with companies
of various sizes, from enterprises to start-
ups. During this time, he has developed and
managed microservices on the cloud (AWS/
GCE/DigitalOcean) using open source
software. He is an open-source enthusiast and
shares his experience at local meetups.
He has co-­authored Java Unit Testing with JUnit 5 (Apress, 2017) and
Getting Started with Istio Service Mesh (Apress, 2019).

Akshay Mathur is a software engineer with


15 years of experience, mostly in Java and web
technologies. Most of his career has been spent
building B2B platforms for enterprises, dealing
with concerns like scalability, configurability,
multitenancy, and cloud engineering. He has
hands-on experience implementing and
operating microservices and Kubernetes in
these ecosystems. Currently, he enjoys public
speaking and blogging on new cloud-native
technologies (especially plain Kubernetes) and
effective engineering culture.

ix
About the Technical Reviewer
Brijesh is currently working as a lead
consultant. He has more than ten years of
experience in software development and
providing IT solutions to clients for their
on-premise or cloud-based applications,
spanning from monoliths to microservice-
based architecture.

xi
Acknowledgments
This book would not have been possible without the support of many
people. I would like to take this opportunity and express my gratitude to
each of them.
I would like to thank Divya Modi for believing in the project and
making it work. She has been instrumental in starting the project.
Moreover, during the project, her editorial support provided a constant
push throughout the process. It would have been difficult to deliver the
project without your support.
I would like to thank Celestin Suresh John for providing me this
wonderful opportunity. Your guidance made sure that we got the correct
path outlined from the start.
I would like to thank Brijesh Pant and Laura C. Berendson for sharing
valuable feedback. Your advice has helped to deliver the ideas in a better
manner.
I would also like to thank my co-author Akshay Mathur for his
knowledge and support. Your experience and willingness have made this
a successful project. The brainstorming sessions we had helped to express
the ideas.
I wish to thank my parents, my loving and supportive wife, Swati,
and my son, Rudra. They are a constant source of encouragement and
inspiration. Thanks for providing the time and listening to my gibberish
when things were not working according to the plan.
Lastly, I would like to thank my friends, who have been my source
of knowledge. The discussion we had often helped me to deliberate on
various topics. Often our debates have provided the testbed for evaluations.
—Rahul Sharma

xiii
Acknowledgments

I’d like to express my gratitude to my co-author Rahul Sharma for


bringing me on board this project. While we had discussed the possibility,
the actual opportunity still came suddenly, and I’d like to thank him for
his guidance through the process. It was as fun and nerve-wracking as I’d
envisioned, and he had my back the whole way as I channeled my inner
Douglas Adams and (to borrow from a great man) enjoyed the sound of
deadlines whooshing by.
Divya Modi was a constant source of support and encouragement.
She gently helped us stay on track and was a picture of calm and
confidence, helping us get to completion. And still entertained multiple
last-minute requests as I kept tweaking the title.
To our reviewers, Brijesh Pant and Laura C. Berendson, thank you for
all the constructive feedback in making this book better.
I’d also like to thank my ever-patient family, especially my mother, my
wife, Neha, and my daughter, Inara, who kept wondering when I would
actually be done and free to talk to them, as I kept fiddling till the last
minute and repeating, “Almost there!”.
I’m grateful to the two mentors who pulled me up to the level of
authoring a book—Aditya Kalia and Shekhar Gulati.
Finally, our gratitude to the Traefik team for releasing an excellent
product to the community. We hope this book helps in any small way to
drive further adoption.
—Akshay Mathur

xiv
Introduction
Microservice architecture has brought dynamism to the application
ecosystem. New services are built and deployed while older ones are
deprecated and removed from the enterprise application estate. But
front-end load balancers haven’t been able to adapt to the components
in the enterprise architecture. Most current load balancers have a static
configuration. They require configuration updates as the application
landscape changes. Thus, there are operational complexities when
working with microservices. These are a few of the challenges of getting
a microservices-based solution to work. The dynamic nature of the
ecosystem requires dynamic tools that can autoconfigure themselves.
Traefik bases its foundations on the dynamic nature of the
Microservice architecture. It has built first-class support for service
discovery, telemetry, and resiliency. It is a modern HTTP reverse proxy
and load balancer that eases microservices deployment. Its integration has
been great, with many existing tools.
The book covers Traefik setup, basic workings, and integration with
microservices. It is intended for developers, project managers, and DevOps
personnel interested in solutions for their operational challenges.
The book is not specific to any programming language, even though all
the examples use Java or Python.

xv
CHAPTER 1

Introduction to Traefik
Over the last couple of years, microservices have become a mainstream
architecture paradigm for enterprise application development. They have
replaced the monolithic architecture of application development, which
was mainstream for the past couple of decades. Monolithic applications
are developed in a modular architecture. This means that discrete logic
components, called modules, are created to segregate components based
on their responsibility. Even though an application consisted of discrete
components, they were packaged and deployed as a single executable.
Overall, the application has very tight coupling. Changes to each of these
modules can’t be released independently. You are required to release a
complete application each time.
A monolithic architecture is well suited when you are building
an application with unknowns. In such cases, you often need quick
prototyping for every feature. Monolithic architecture helps in this case,
as the application has a unified code base. The architecture offers the
following benefits.

• Simple to develop.

• Simple to test. For example, you can implement end-­


to-­end testing by launching the application and testing
the UI with Selenium.

• Simple to deploy. You only have to copy the packaged


application to a server.

© Rahul Sharma, Akshay Mathur 2021 1


R. Sharma and A. Mathur, Traefik API Gateway for Microservices,
https://doi.org/10.1007/978-1-4842-6376-1_1
Chapter 1 Introduction to Traefik

• Simple to scale horizontally by running multiple copies


behind a load balancer.

In summary, you can deliver the complete application quickly in these


early stages. But as the application grows organically, the gains erode. In
the later stages, the application becomes harder to maintain and operate.
Most of the subcomponents get more responsibility and become large
subsystems. Each of these subsystems needs a team of developers for its
maintenance. As a result, the complete application is usually maintained
by multiple development teams. But the application has high coupling,
so development teams are interdependent while making new features
available. Due to a single binary, the organization faces the following set of
issues.

• Quarterly releases: Application features take more


time to release. Most of the time, an application feature
needs to be handled across various subsystems. Each
team can do their development, but deployment
requires the entire set of components. Thus, teams can
seldom work independently. Releases are often a big
coordinated effort across different teams, which can be
done only a couple of times per period.
• Deprecated technology: Often, when you work with
technology, you must upgrade it periodically. The
upgrades make sure all vulnerabilities are covered.
Application libraries often require frequent upgrades
as they add new features as well. But upgrading the
libraries in a monolith is difficult. A team can try to use
the latest version, but often needs to make sure that the
upgrade does not break other subsystems. In certain
situations, an upgrade can even lead to a complete
rewrite of subsystems, which is a very risky undertaking
for the business.

2
Chapter 1 Introduction to Traefik

• Steep learning curve: Monolithic applications often


have a large code base. But the individual developers
are often working on a very small subset of the
codebase. At first glance, the lines of code create a
psychological bottleneck for developers. Moreover,
since the application is tightly coupled, developers
usually need to know how others invoke the code.
Thus, the overall onboarding time for a new developer
is large. Even the experienced developers find it
hard to make changes to modules that have not been
maintained well. This creates a knowledge gap that
widens over time.

• Application scaling: Typically, a monolithic


application can only be scaled vertically. It is possible
to scale the application horizontally, but you need to
determine how each subsystem maintains its internal
state. In any case, the application requires resources for
all subsystems. Resources can’t be selectively provided
to subsystems under load. Thus, it is an all-or-nothing
scenario with a monolithic application. This is often a
costly affair.

When faced with challenges, organizations look for alternative


architectures to address these issues.

M
 icroservice Architecture
Microservice architecture is an alternative to the monolithic architecture
(see Figure 1-1). It converts the single application to a distributed system
with the following characteristics.

3
Chapter 1 Introduction to Traefik

• Services: Microservices are developed as services that


can work independently and provide a set of business
capabilities. A service may depend on other services
to perform the required functionality. Independent
teams can develop each of these services. The teams
are free to select and upgrade the technology they need
for their service. An organization often delegates full
responsibility for the services to their respective teams.
The teams must ensure that their respective service
runs as per the agreed availability and meets the agreed
quality metrics.

• Business context: A service is often created around


a business domain. This makes sure that it is not too
fine-grained or too big. A service needs to answer
first if it is the owner of the said business function or
the consumer of the function. A function owner must
maintain all the corresponding function data. If it
needs some more supporting function, it may consume
the same from another service. Thus determining
business context boundaries helps keep a check on
the service dependencies. Microservices aim to build
a system with loose coupling and high cohesion
attributes. Aggregating all logically related functionality
makes the service an independent product.

• Application governance: In enterprise systems,


governance plays an important role. You rarely want
to make systems that are difficult to run. Due to this,
a governance group keeps check on the technologies
used by developers so that the operations team can
still run the system. But microservice architecture
provides the complete ownership to the respective

4
Chapter 1 Introduction to Traefik

teams. The ownership is not limited to development.


It also delegates service operations. Due to this, most
organizations must adopt DevOps practices. These
practices enable the development teams to operate and
govern a service efficiently.

• Automation: Automation plays an important role in


microservices. It applies to all forms like infrastructure
automation, test automation, and release automation.
Teams need to operate efficiently. They need to test
more often and release quickly. This is only possible
if they rely more on machines and less on manual
intervention. Post-development manual testing is a
major bottleneck. Thus, teams often automate their
testing in numerous ways like API testing, smoke
testing, nightly tests, and so forth. They often perform
exploratory testing manually to validate the build.
Release and infrastructure preparation is often
automated by using DevOps practices.

Figure 1-1. Monolith vs. microservices

5
Chapter 1 Introduction to Traefik

In summary, a monolith has a centralized operating model. This


means that all code resides in one place; everyone uses the same
library, releases happen simultaneously, and so forth. But on the other
end, microservices is a completely decentralized approach. Teams
are empowered to make the best decisions with complete ownership.
Adopting such an architecture not only asks for a change in software
design, but it also asks for a change in organizational interaction.
Organizations reap the following benefits of such application design.

Agility
This is one of the biggest driving factors for an organization adopting the
microservices architecture. Organizations become more adaptive, and
they can respond more quickly to changing business needs. The loose
coupling offered by the architecture allows accelerated development.
Small, loosely coupled services can be built, modified, and tested
individually before deploying them in production. The model dictates
small independent development teams working within their defined
boundaries. These teams are responsible for maintaining high levels of
software quality and service availability.

Innovation
The microservice architecture promotes independent small development
teams supporting each service. Each team has ownership within their
service boundary. They are not only responsible for development but also
for operating the service. The teams thus adopt a lot of automation and
tools to help them deliver these goals. These high-level goals drive the
engineering culture within the organization.

6
Chapter 1 Introduction to Traefik

Moreover, development teams are usually well aware of the


shortcomings of their services. Such teams can address these issues using
their autonomous decision-making capability. They can fix the issues and
improve service quality frequently. Here again, teams are fully empowered
to select appropriate tools and frameworks for their purpose. It ultimately
leads to the improved technical quality of the overall product.

Resilience
Fault isolation is the act of limiting the impact of a failure to a limited
subsystem/component. This principle allows a subsystem to fail as long
as it does not impact the complete application. The distributed nature of
microservice architecture offers fault isolation, a principal requirement
to build resilient systems. Any service which is experiencing failures
can be handled independently. Developers can fix issues and deploy
new versions while the rest of the application continues to function
independently.
Resilience, or fault tolerance, is often defined as the application’s
ability to function properly in the event of a failure of some parts.
Distributed systems like microservices are based on various tenets
like circuit breaking, throttling to handle fault propagation. This is an
important aspect; if done right, it offers the benefits of a resilient system.
But if this is left unhandled, it leads to frequent downtime due to failures
cascading. Resilience also improves business agility as developers can
release new services without worrying about system outages.

Scalability
Scalability is defined as the capability of a system to handle the growth
of work. In a monolith, it is easy to quantify the system scalability.
In a monolithic system, as the load increases, not all subsystems get
proportionally increased traffic. It is often the case that some parts of the

7
Chapter 1 Introduction to Traefik

system get more traffic than others. Thus, the overall system performance
is determined by a subset of the services. It is easier to scale a monolithic
system by adding more hardware. But at times, this can also be difficult as
different modules may have conflicting resource requirements. Overall an
overgrown monolith underutilizes the hardware. It often exhibits degraded
system performance.
The decoupling offered by microservices enables the organization
to understand the traffic that each microservice is serving. The
divide and conquer principle helps in improving the overall system
performance. Developers can adopt appropriate task parallelization
or clustering techniques for each service to improve the system
throughput. They can adopt appropriate programming languages and
frameworks, fine-tuned with the best possible configuration. Lastly,
hardware can be allocated by looking into service demand rather than
scaling the entire ecosystem.

Maintainability
Technical debt is a major issue with monolithic systems. Overgrown
monoliths often have parts that are not well understood by the complete
team. Addressing technical debt in a monolith is difficult as people often
fear of breaking any of the working features. There have been cases where
unwanted dead code was made alive by addressing technical debt on a
particular monolith.
Microservice architecture helps to mitigate the problem by following
the principle of divide and conquer. The benefits can be correlated with
an object-oriented application design where the system is broken into
objects. Each object has a defined contract and thus leads to improved
maintenance of the overall system. Developers can unit test each of
the objects being refactored to validate the correctness. Similarly,
microservices created around a business context have a defined contract.
These loosely coupled services can be refactored and tested individually.

8
Chapter 1 Introduction to Traefik

Developers can address the technical debt of the service while validating
the service contract. Adopting microservices is often referred to as a
monolith’s technical debt payment.
You have looked at the advantages of Microservice architecture. But
the architecture also brings a lot of challenges. Some challenges are due to
the distributed nature of the systems, while others are caused by diversity
in the application landscape. Services can be implemented in different
technologies and scaled differently. There can be multiple versions of the
same service serving different needs. Teams should strategize to overcome
these challenges during application design and not as an afterthought.
Application deployment is one such important aspect. Monoliths have
been deployed on a three-tier model. But the same model does not work
well with microservices. The next section discusses the changes required
in the deployment model.

n-Tier Deployment
n-tier deployment is a design implementation where web applications
are segregated into application presentation, application processing, and
data management functions. These functions are served by independent
components known as tiers. The application tiers allow segregation of
duties. All communication is linear across the tiers. Each tier is managed
by its own software subsystem. The n-tier deployment offers the benefit of
improved scalability of the application. Monolithic applications are usually
deployed as three-tiers (see Figure 1-2) applications.

• Presentation tier: This tier is responsible for serving


all static content of the application. It is usually
managed by using web servers like Apache, Nginx, and
IIS. These web servers not only serve applications static
UI components but also handle dynamic content by
routing requests to the application tier. Web servers

9
Chapter 1 Introduction to Traefik

are optimized to handle many requests for static


data. Thus, under load, they perform well. Some of
these servers also provide different load balancing
mechanisms. These mechanisms can support multiple
nodes of the application tier.

• Application tier: This tier is responsible for providing


all processing functions. It contains the business
processing logic to deliver the core capabilities of an
application. The development team is responsible for
building this in a suitable technology stack like Java,
Python, and .NET. This tier is capable of serving a
user request and generating an appropriate dynamic
response. It receives requests from the presentation
tier. To serve the request, the application tier may need
additional data to interact with the data tier.

• Data tier: This tier provides capabilities of data storage


and data retrieval. These data management functions
are outside the scope of the application. Thus, an
application uses a database to fulfill these needs. The
data tier provides data manipulation functions using an
API. The application tier invokes this API.

10
Chapter 1 Introduction to Traefik

Figure 1-2. Three-tier

There are many benefits to using a three-layer architecture, including


scalability, performance, and availability. You can deploy the tiers on
different machines and can use the available resources in an optimized
manner. The application tier delivers most of the processing capability.
Thus, it needs more resources. On the other hand, the web servers serve
static content and do not need many resources. This deployment model
improves application availability by having different replication strategies
for each tier.

11
Chapter 1 Introduction to Traefik

F our-Tier Deployment
The three-tier deployment works in line with monolith applications.
The monolith is usually the application tier. But with microservices, the
monolith is converted into several services. Thus the three-tier deployment
model is not good enough to handle microservice architecture. It needs
the following four-tier deployment model (see Figure 1-3).

• Content delivery tier: This tier is responsible for


delivering the content to the end user. A client can use
an application in a web browser or on a mobile app. It
often asks for making different user interfaces targeted
across different platforms. The content delivery tier is
responsible for ensuring that the application UI is working
well on these different platforms. This tier also abstracts
the services tier and allows developers to quickly develop
new services for the changing business needs.

• Gateway tier: This tier has two roles.

• Dynamically discover the deployed services and


correlate them with the user request

• Route requests to services and send responses

For each request, the gateway layer receives data from all
the underlying services and sends back a single aggregated
response. It has to handle different scenarios like role-based
access, delayed responses, and error responses. These
behaviors make it easier for the service tier. The service tier
can focus only on the business requirements.

• Services tier: This tier is responsible for providing all


business capabilities. The services tier is designed for
a microservices approach. This tier provides data to its
clients without concern for how it is consumed. The

12
Chapter 1 Introduction to Traefik

clients can be other services or application UI. Each of


the services can be scaled based on their requests load
pattern. The clients have the responsibility to determine
the new instances. All of this enables a pluggable
approach to the application ecosystem. New services
can be built by consuming existing services. They can
be readily integrated into the enterprise landscape.

• Data tier: This tier provides capabilities of data storage


and data retrieval. Data management capabilities are
still beyond the application scope. But each service has
an exclusive data management infrastructure. It can be
DBMS like MySQL or a document store like Mongo.

Figure 1-3. Four-tier

13
Chapter 1 Introduction to Traefik

The four-tier architecture (see Figure 1-3) was pioneered by early


microservices adopters like Netflix, Amazon, and Twitter. At the center
of the paradigm, the gateway tier is responsible for binding together
the complete solution. The gateway needs a solution that can link the
remaining tiers together so all of them can communicate, scale, and
deliver. In the three-tier architecture, the presentation tier had webservers
that can be adopted for the gateway tier. But first, you should determine
the characteristics required to be a gateway tier solution.

G
 ateway Characteristics
A gateway is the point of entry for all user traffic. It is often responsible for
delegating the requests to different services, collate their responses, and
send it back to the user. Under microservice architecture, the gateway must
work with the dynamic nature of the architecture. The following sections
discuss the different characteristics of the gateway component.

Application Layer Protocols


The OSI networking model handles traffic at Layer 4 and Layer 7. Layer 4
offers only low-level connection details. Traffic management at this layer
can only be performed using a protocol (TCP/UDP) and port details. On
the other hand, Layer 7 operates at the application layer. It can perform
traffic routing based on the actual content of each message. HTTP is one of
the most widely used application protocols. You can inspect HTTP headers
and body to perform service routing.
Layer 7 load balancing enables the load balancer to make smarter
load-balancing decisions. It can apply various optimizations like
compressions, connection reuse, and so forth. You can also configure
buffering to offload slow connections from the upstream servers to
improve overall throughput. Lastly, you can apply encryption to secure our
communication.

14
Chapter 1 Introduction to Traefik

In the current ecosystem, there are a wide variety of application


protocols to choose from. Each of these protocols serves a set of needs.
Teams may adapt a particular application protocol, let’s say gRPC because
it is better suited for their microservice. This does not require the other
teams to adapt to the same application protocol. But in the ecosystem, the
gateway needs to delegate traffic to most of these services. Thus, it needs
to have support for the required protocol. The list of application protocols
is extensive. Consequently, the gateway needs to have a rich set of current
protocols. Moreover, it should be easy to extend this list by adding new
protocols.

PROTOCOLS

HTTP/2 is the next version of the HTTP/1.1 protocol. It is a binary protocol


and does not change any of the existing HTTP semantics. But it offers real-­
time multiplex communication and improves the application performance by
employing better utilization of underlying TCP connections.

gRPC is a binary RPC protocol. It offers various features, such as multiplexing,


streaming, health metrics, and connection pooling. It is often used with
payload serialization like JSON or protocol buffers.

REST (REpresentational State Transfer) is an application protocol based on


HTTP semantics. The protocol represents resources that are accessed using
HTTP methods. It is often used with a JSON payload to describe the state.

Another important aspect is the interprocess communication


paradigm. Traditionally, we create synchronous applications based on
HTTP. But with data-driven microservices, you may want to adopt an
asynchronous model, like ReactiveX and Zeromq. A gateway component
needs to support both these forms of communication. Developers should
be able to pick and choose which model works for their application.

15
Chapter 1 Introduction to Traefik

Dynamic Configuration
In a monolith application, you know the location of our backend
application. The location does not change often, and more instances of the
application are not created at runtime. Since most servers are known, it is
easier to provide these details in a static configuration file.
But in a microservices application, that solution does not work. The
first challenge arises from the number of microservices. Usually, there are
limited services at the start. But as the system grows, people realize there
can be multiple fine-grained services for every business function. Often
the number can grow to a couple of hundred services. It is a daunting task
to allocate a static address to each of these services and maintain the same
updates in a static file.
The second challenge arises from scalability offered by microservices.
Services can be replicated during load times. These services are removed
when the load subsides. This runtime behavior of microservices gets
multiplied by the number of services in the ecosystem. It is impossible to
keep track of all these changes in a static configuration file.
To solve discovery issues, a microservice architecture advocates a
service registry. It is a database containing the network locations of service
instances. The service registry needs to be updated in near real time. It
needs to reflect the new locations as soon as they are available. A service
registry needs to have high availability. Consequently, it consists of a
cluster of nodes that replicate data to maintain consistency.

SERVICE REGISTRY PROVIDERS

The following are the most widely used service registry providers.

Eureka is a REST-based solution for registering and querying service


instances. Netflix developed the solution as part of its microservices journey. It
is often used in the AWS cloud.

16
Exploring the Variety of Random
Documents with Different Content
from thirty to fifty or a hundred birds streaming from or towards the
berg, and we could not doubt that we were approaching a very
populous breeding-colony. But we had been told of millions of
brooding birds, and as yet we could see nothing of such numbers. At
length, after we had rowed round a projecting ridge, the Nyke lay
before us. In the sea, all around, were black points, at the foot of the
hill white ones. The former were without order or regularity, the latter
generally in rows, or sharply defined troops; the one set consisted of
razor-bills swimming, with head, throat, and neck above the water,
the others were the same birds sitting on the hill with their white
breasts turned towards the sea. There were certainly many
thousands, but not millions.
After we had landed at the opposite island and refreshed ourselves
in the house of the proprietor of the Nyke, we crossed over to it, and
choosing a place round which the seething waves did not surge too
violently, we sprang out on the rock and climbed quickly up to the turf
which covers the whole Nyke, with the exception of a few protruding
peaks, ledges, and angles. There we found that the whole turf was
so pierced with nest-hollows something like rabbit holes, that on the
whole hill not a single place the size of a table could be found free
from such openings. We made our way upwards in a spiral,
clambering rather than walking to the top of the berg. The
undermined turf trembled under our feet, and from every hole there
peeped, crept, glided, or flew out birds rather larger than pigeons,
slate-coloured on the upper part of the body, dazzlingly white on
breast and belly, with fantastic bills and faces, short, narrow, pointed
wings, and stumpy tails. Out of every hole they appeared and even
out of the fissures and clefts in the rocks. Whichever way we turned
we saw only birds, heard only the low droning noise of their
combined weak cries. Every step onwards brought new flocks out of
the bowels of the earth. From the berg down to the sea, from the sea
up to the berg there flew swarms innumerable. The dozens became
hundreds, the hundreds became thousands, and hundreds of
thousands sprang incessantly from the brown-green turf. A cloud not
less thick than that over the holm enveloped us, enveloped the
island, so that it—magically indeed, but in a way perceptible by the
senses—seemed transformed into a gigantic bee-hive, round which
not less gigantic bees, humming and buzzing, hovered and fluttered.
The farther we went, the more magnificent became the spectacle.
The whole hill was alive. Hundreds of thousands of eyes looked
down upon us intruders. From every hole and corner, from every
peak and ledge, out of every cleft, burrow, or opening, they hurried
forth, right, left, above, beneath; the air, like the ground, teemed with
birds. From the sides and from the summit of the berg thousands
threw themselves like a continuous cataract into the sea in a throng
so dense that they seemed to the eye to form an almost solid mass.
Thousands came, thousands went, thousands fluttered in a
wondrous mazy dance; hundreds of thousands flew, hundreds of
thousands swam and dived, and yet other hundreds of thousands
awaited the footsteps which should rouse them also. There was such
a swarming, whirring, rustling, dancing, flying, and creeping all about
us that we almost lost our senses; the eye refused duty, and his
wonted skill failed even the marksman who attempted to gain a prize
at random among the thousands. Bewildered, hardly conscious, we
pushed on our way until at length we reached the summit. Our
expectation here at last to regain quietness, composure, and power
of observation, was not at once realized. Even here there was the
same swarming and whirring as further down the slope, and the
cloud of birds around us was so thick that we only saw the sea dimly
and indefinitely as in twilight. But a pair of jerfalcons, who had their
eyrie in a neighbouring precipice, and had seen the unusual bustle,
suddenly changed the wonderful scene. The razor-bills, guillemots,
and puffins were not afraid of us; but on the appearance of their well-
known and irresistible enemies, the whole cloud threw themselves
with one accord, as at the command of a magician, into the sea, and
the outlook was clear and free. Innumerable black points, the heads
of the birds swimming in the sea, stood out distinctly from the water,
and broke up the blue-green colouring of the waves. Their number
was so great that from the top of the berg, which was over three
hundred feet high, we could not see where the swarm ended, could
not discover where the sea was clear from birds. In order to make a
calculation, I measured out a small square with my eye, and began
to count the points in it. There were more than a hundred. Then I
endeavoured mentally to place several similar squares together, and
soon came to thousands of points. But I might have imagined many
thousands of such squares together and yet not exhausted the
space covered by birds. The millions of which I had been told were
really there. This picture of apparent quiet only lasted for a few
moments. The birds soon began to fly upwards again, and as before,
hundreds of thousands rose simultaneously from the water to
ascend the hill, as before a cloud formed round it, and our senses
were again bewildered. Unable to see, and deafened by the
indescribable noise about me, I threw myself on the ground, and the
birds streamed by on all sides. New ones crept constantly out of their
holes, while those we had previously startled now crept back again;
they settled all about me, looking with comical amazement at the
strange form among them, and approaching with mincing gait so
close to me that I attempted to seize them. The beauty and charm of
life showed themselves in every movement of these remarkable
birds. With astonishment I saw that even the best pictures of them
are stiff and cold, for I remarked in their quaint forms a mobility and
liveliness with which I had not credited them. They did not remain
still a single instant, their heads and necks at least were moved
incessantly to all sides, and their contours often showed most
graceful lines. It seemed as though the inoffensiveness with which I
had given myself up to observing them, had been rewarded by
unlimited confidence on their part. The thousands just about me
were like domestic birds; the millions paid me no more attention than
if I had been one of themselves.
I spent eighteen hours on this bird-berg in order to study the life of
the auks.[4] When the midnight sun stood large and blood-red in the
sky and cast its rosy light on the sides of the hill there came the
peace which midnight brings even in the far North. The sea was
deserted; all the birds which had been fishing and diving in it had
flown up to the berg. There they sat wherever there was room to sit
in long rows of tens, of hundreds, of hundreds of thousands, forming
dazzling white lines as all, without exception, sat facing the sea.
Their ‘arr’ and ‘err’, which had deafened our ears notwithstanding
the weakness of the individual voices, were silent now, and only the
roar of the surf breaking on the rocks far below resounded as before.
Not till the sun rose again did the old bewildering bustle begin anew,
and as we at length descended the hill by the way we had climbed it,
we were once more surrounded by a thick cloud of startled birds.
It is not because of their enormous numbers alone that the auks are
so fascinating; there is much that is attractive in their life and habits.
During the brooding time their social virtues reach an extraordinary
height. Till the beginning of that season they live entirely on the open
sea, defying the severest winter and the wildest storms. Even in the
long night of winter very few of them forsake their northern home, but
they range, in flocks of hundreds and thousands, from one fishing-
ground to another, finding all the open spaces among the ice as
unfailingly as they do other promising feeding-grounds in the open
sea. But when the sun reappears they are animated by one feeling—
love, by one longing—to reach as soon as possible the hill where
their own cradle stood. Then somewhere about Easter-time they all
set out, swimming more than flying, for the bird-berg. But among the
auks there are more males than females, and not every male is
fortunate enough to secure a wife. Among other birds such a
disproportion gives rise to ceaseless strife, yet among these auks
peace is not disturbed. The much-to-be-pitied beings whom, making
use of a human analogy, we may call bachelors, migrate to the berg
as well as the fortunate pairs, who coquette and caress by the way;
they fly up with these to the heights and accompany them on their
hunting expeditions to the surrounding sea. As soon as the weather
permits, the pairs begin to get the old holes in order; they clear them
out, deepen them, enlarge their chambers, and, if necessary, hollow
out a new brooding-place. As soon as this has been done the female
lays, on the bare ground at the further end of the hollowed-out
brooding-chamber, a single very large, top-shaped, brightly-spotted
egg, and begins to brood alternately with the male. The poor
bachelors have a sad time of it now. They, too, would dearly like to
take parental cares upon themselves if they could only find a mate
who would share them. But all the females are appropriated, and
wooing is in vain. So they resolve to give practical proof of their
good-will, at least in so far that they force themselves on the
fortunate pair as friends of the family. In the hours about midnight,
when the female broods on the nest, they sit with the male as he
keeps watch before it, and, when the male relieves his mate that she
may fish in the sea, they mount guard in his stead. But when both
parents visit the sea at once the bachelors hasten to reap some
reward for their faithfulness. Without delay they thrust themselves
into the interior of the cavity, and sit for the time upon the forsaken
egg. The poor birds who are condemned to celibacy want at least to
brood a little! This unselfish devotion has one result for which men
might envy the auks—there are no orphans on these bird-bergs.
Should the male of a pair come to grief, his widow immediately
consoles herself with another mate, and in the rarer case of both
parents losing their lives at once the good-natured supernumeraries
are quite ready to finish hatching the egg and to rear the young one.
The young ones differ materially from those of the ducks and gulls.
They are ‘altrices’, not ‘præcoces’ as the ornithologists say;[5] in
plain language, they are not ready for active life as soon as they are
hatched. In a dress of thick gray down the young auk slips from the
egg in which it awakes to life, but it must spend many weeks in the
hole before it is ready to attempt its first flight to the sea. This first
flight is always a hazardous undertaking, as is proved by the
countless dead bodies on the cliffs at the foot of the berg. The young
bird, nervously using its unpractised legs, hardly less timidly its
newly-developed wings, follows its parents as they lead the way
down the hill towards some place from which the leap into the sea
may be attempted with as little danger as possible. On a suitable
ledge the parents often remain a long time with their young one
before they can induce it to take a spring. Both father and mother
persuade it coaxingly; the little one, usually obedient like all young
birds, pays no heed to their commands. The father throws himself
into the sea before the eyes of his hesitating offspring; the
inexperienced young one remains where he was. More attempts,
more coaxing, urgent pressure: at length he risks the great leap and
plunges like a falling stone deep into the sea; then, unconsciously
obeying his instincts, he works his way to the surface, looks all
around over the unending sea, and—is a sea-bird who thenceforth
shuns no danger.
Different again is the life and activity on the bergs chosen as
brooding-places by the kittiwakes. Such a hill is the promontory
Swärtholm, high up in the north between the Laxen and the
Porsanger fjord, not far from the North Cape. I knew well how these
gulls appear on their brooding-places. Faber, with his excellent
knowledge of the birds of the far North, has depicted it, as usual, in a
few vivid words:
“They hide the sun when they fly, they cover the skerries when they
sit, they drown the thunder of the surf when they cry, they colour the
rocks white when they brood.” I believed the excellent Faber after I
had seen the eider-holms and auk-bergs, and yet I doubted, as
every naturalist must, and therefore I ardently desired to visit
Swärtholm for myself. An amiable Norseman with whom I became
friendly, the pilot of the mail steamer by which I travelled, readily
agreed to row me over to the breeding-place, and we approached
the promontory late one evening. At a distance of six or eight
nautical miles we were overtaken by flocks of from thirty to a
hundred, sometimes even two hundred kittiwakes flying to their
nesting-place. The nearer we approached to Swärtholm the more
rapid was the succession of these swarms, and the larger did they
become. At last the promontory became visible, a rocky wall about
eight hundred yards long, pierced by innumerable holes, rising
almost perpendicularly from the sea to a height of from four hundred
and fifty to six hundred feet. It looked gray in the distance, but with a
telescope one could discern innumerable points and lines. It looked
as though a gigantic slate had been scratched all over with all sorts
of marks by a playful giant child, as though the whole rock bore a
wondrous decoration of chains, rings, and stars. From the dark
depths of large and small cavities there gleamed a brilliant white; the
shelving ledges stood out in more conspicuous brightness. The
brooding gulls on their nests formed the white pattern, and we
realized the truth of Faber’s words, “they cover the rocks when they
sit”.
Fig. 4.—Razor-bills.

Our boat, as it grated on the rocky shore, startled a number of the


gulls, and I saw a picture such as I had seen on many eider-holms
and gull-islands. A shot from my friend’s gun thundered against the
precipice. As a raging winter storm rushes through the air and
breaks up the snow-laden clouds till they fall in flakes, so now it
snowed living birds. One saw neither hill nor sky, nothing but an
indescribable confusion. A thick cloud darkened the whole horizon,
justifying the description “they hide the sun when they fly”. The north
wind blew violently and the icy sea surged wildly against the foot of
the cliffs, but more loudly still resounded the shrill cries of the birds,
so that the truth of the last part also of Faber’s description was fully
proved, “they drown the thunder of the surf when they cry”. At length
the cloud sank down upon the sea, the hitherto dim outlines of
Swärtholm became distinct again, and a new spectacle enchained
our gaze. On the precipices there seemed to sit quite as many birds
as before, and thousands were still flying up and down. A second
shot scared new flocks, a second time it snowed birds down upon
the sea, and still the hillsides were covered with hundreds of
thousands. But on the sea, as far as the eye could reach, lay gulls
like light foam-balls rocking up and down with the waves. How shall I
describe the magnificent spectacle? Shall I say that the sea had
woven millions and millions of bright pearls into her dark wave-robe?
Or shall I compare the gulls to stars; and the ocean to the dome of
heaven? I know not; but I know that I have seen nothing more
gorgeous even on the sea. And as if the charm were not already
great enough, the midnight sun, erewhile clouded over, suddenly
shed its rosy light over promontory and sea and birds, lighting up
every wave-crest as if a golden, wide-meshed net had been thrown
over the water, and making the rose-tinted dazzling gulls appear
more brilliant than before. We stood speechless at the sight! And we,
with all our company, even the sailors of our boat, remained
motionless for a long, long time, deeply moved by the wonderful
picture before us, till at last one of us broke the silence, and, rather
to recover himself through the sound of his own voice than to
express his inner feeling, softly uttered the poet’s words:
Over the bergs the sun blood-red
Shone through the night;
Nor day nor dark was over head,
But weird twilight.
THE TUNDRA AND ITS ANIMAL
LIFE.
Around the North Pole lies a broad belt of inhospitable land, a desert
which owes its special character rather to the water than to the sun.
Towards the Pole this desert gradually loses itself in fields of ice,
towards the south in dwarfed woods, becoming itself a field of snow
and ice when the long winter sets in, while stunted trees attempt the
struggle for existence only in the deepest valleys or on the sunniest
slopes. This region is the Tundra.[6]
It is a monotonous picture which I attempt to sketch when I seek to
describe the tundra, a picture gray on gray, yet not devoid of all
beauty; it is a desert with which we have to do, but a desert in which
life, though for many months slumbering and apparently banished,
stirs periodically in wondrous fulness.
Our language possesses no synonym for the word tundra, because
our Fatherland possesses no such tract of country. For the tundra is
neither heath nor moor, neither marsh nor fen, neither highlands nor
sand-dunes, neither moss nor morass, though in many places it may
resemble one or other of these. “Moss-steppes” someone has
attempted to name it, but the expression is only satisfactory to those
who have grasped the idea of steppe in its widest sense. In my
opinion the tundra most resembles one of those moors which we find
—and avoid—on the broad saddles of our lofty mountains; but it
differs in many and important respects even from these boggy
plateaus; indeed its character is in every respect unique. The region
is sometimes divided into low and high tundra, though the
differences between the land under three hundred feet above sea-
level and that above this line are in the tundra more apparent than
real.
The low tundra is bounded by flat, wavy outlines; its valleys are
shallow troughs, and even the heights, which, from a distance, look
like hills or even mountains, turn out to be only flat hillocks when one
approaches their base. Flatness, uniformity, expressionlessness
prevail, yet that there is a certain variety in the landscape, a diversity
in some of its individual features, cannot be disputed. As one
wanders through the tundra for days at a time, one’s attention is
often arrested by dainty, even charming little pictures, but such
pictures rarely stamp themselves on the memory, since on closer
examination they prove, in all important details, in setting and
surroundings, in contour and colour, like too many other scenes to
make a distinct impression. Notwithstanding this monotony, the
general aspect of the tundra has little unity, still less grandeur, and
on this account one does not become enthusiastic about the region,
does not reach to the heights of emotion which other landscapes
awaken, perhaps does not even attain to full enjoyment of the real
beauties which, it must be admitted, even this desert possesses.
The tundra receives its greatest beauty from the sky, its greatest
charm from the water. The sky is seldom quite clear and bright,
though even here the sun, shining uninterruptedly for months
together, can beat down hot and oppressive on the flat hills and
damp valleys. The blue sky is usually seen only in isolated places
through light, white, loose-layered clouds; these are often massed
together into cloud-banks which form on all sides of the apparently
immeasurable horizon, continually changing, shifting, assuming new
forms, appearing and vanishing again, so ravishing the eye with their
changeful brilliance that one almost forgets the landscape
underneath. When a thunder-storm threatens after a hot day the sky
darkens here and there to the deepest gray-blue, the vapour-laden
clouds sink beneath the lighter ones, and the sun shines through,
clear and brilliant; then the dreary, monotonous landscape is
magically beautified. For light and shade now diversify the hill-tops
and valleys, and the wearisome monotony of their colour gains
variety and life. And when, in the middle of a midsummer night, the
sun stands large and blood-red in the heavens, when all the clouds
are flushed with purple from beneath, when those hill-tops which
hide the luminary bear a far-reaching flaming crown of rays, when a
delicate rosy haze lies over the brown-green landscape, when, in a
word, the indescribable magic of the midnight sun casts its spell over
the soul: then this wilderness is transformed into enchanted fields,
and a blissful awe fills the heart.
Fig. 5.—The High Tundra in Northern Siberia.
But variety and life are also given by the jewels of the tundra—its
innumerable lakes. Distributed singly or in groups, lying beside or
rising above each other, stretching out into water-basins miles in
breadth, or shrinking into little pools, they occupy the centre of every
hollow, beautify every valley, almost every glen, sparkle in the all-
enlivening sunshine, and gray and colourless though they may be,
assume, if seen from the top of a hill, the deep blue of mountain
lakes. And when the sunlight flashes and twinkles on their mirroring
waves, or when they, too, are touched by the rosy glow of midnight,
they stand out from the surrounding gloom like living lights, on which
the eye delights to linger.
Much grander, though still gloomy and monotonous, is the spectacle
presented by the high tundra. Here the mountains—for such they are
—have all the charms of height. They almost always rise
precipitously, and the chains they form have much-broken lines, and
in all suitable places the snowy sheets which cover them become
glaciers. Tundra in the strict sense is only to be found where the
water does not find rapid outlet; the whole remaining country seems
so different from the low grounds that only the essentially similar
vegetation proclaims it tundra. The boulders, which in the low
grounds are turfed over with thick layers of dead plant remains, are
here almost everywhere exposed; endless heaps of gigantic blocks
cover the slopes and fill the valleys; boulders form the substratum of
wide, almost flat surfaces on which the traveller treads hesitatingly,
as he ponders over the difficult riddle regarding the forces which
have distributed the blocks over these vast surfaces with almost
unvarying regularity. But everywhere between them the water trickles
and glides, ripples and swells, rushes and roars, rages and thunders
down to the low ground. From the slopes it flows in trickling threads,
converging runlets, and murmuring brooklets; from the crevices of
the glaciers it breaks forth in milky torrents; it enters the water-basins
in turbid rivulets; it escapes from the purifying lakes in crystalline
streams, and whirling and foaming, hissing and raging, it hurries
onwards down the valleys, forming alternate waterfalls and
whirlpools, till it reaches the low tundra, a river, or the sea. But the
sun, as often as it breaks through the clouds, floods this unique
mountain region also with its magic colours, defines every hill and
valley, illumines every snowfield, makes every glacier and ravine
conspicuous and telling, gives effect to every peak, ridge and cliff,
shows every lake as a clear and smiling mountain eye, spreads,
morning and evening, the blue haze of distance like a delicate veil
over the background of the picture, and, at midnight, floods the
whole with its deepest rays, so that it is bathed in rosy light. Surely
even the tundra is not without its charms.
In some places, though very rarely, the vegetation gives a certain
form and beauty to the scenery. Pines and firs, if not altogether
confined to the south, are only to be found in the most sheltered
valleys. The few firs which are to be seen look as if they had been
seized by a giant hand and twisted like a screw, and they do not
thrive in the higher districts. The birches penetrate farther, but even
they are stunted and bent like grizzled dwarfs. The larches alone
here and there hold the field, and grow to be really trees, but they
cannot be described as characteristic of the tundra. The most
characteristic plant is certainly the dwarf-birch. Only under
exceptionally favourable circumstances attaining to a yard in height,
it predominates over by far the greater part of the tundra so
absolutely that all other bushes and shrubs seem only to have
sprung up between the birches. It spreads over all tracts where it can
take root, from the shore of the sea or river to the tops of the
mountains, a more or less thick covering so equal in height that great
stretches look as if they had been shorn along the top; it recedes
only where the ground is so soaked with water that it forms swamp
or morass; it is stunted only where the heights are covered with
infertile quartz or with stiff clay, which hardens readily in the sun; but
it strives for mastery with the bog-moss on all the low grounds and
with the reindeer-moss on every height. Areas of many square miles
are so thickly clothed—one might almost say felted—that only the
indestructible bog-moss ventures to assert its claim to the soil
beside, or rather under the birches. In other less moist places we
find dwarf-birches, sweet-willow, and marsh-andromeda mixed
together. In the same way various berry-bearing bushes are often
mixed, especially cowberries, crowberries, cranberries, and
whortleberries.
If the ground lies below the level of the surrounding plains, and is
therefore very moist, the bog-moss gains the day, and, gradually
crowding out the dwarf-birch, forms great swelling cushions. As the
root-parts rapidly die away into peat, these cushions become higher
and more extensive until the water impedes any further advance, or
else they break up into dome-like hillocks. If the basin be very flat,
the accumulated water rarely forms a lake or pond, scarcely even a
pool, but soaks through the soil to an indefinite depth, and so forms
a morass whose thin but tough covering of interlacing sedge-roots
can only be trodden in safety by the broad-hoofed reindeer; and
even his steps, and the deeply-sinking runners of the sledge, make it
yield and tremble like jelly.
When the depression becomes a short confined trough, without
outlet, into which a streamlet flows, however slowly, the morass
becomes a bog, or lower down, a swamp. In the first of these, reeds,
in the second downy willows (sallows), a second characteristic plant
of the tundra, attain to luxuriant growth. Though only in very
favourable circumstances becoming as tall as a man, these plants
form thickets which may be literally impenetrable. Their branches
and roots interlace to an even greater extent than do those of the
dwarf-firs on the mountains, forming an inextricable maze which can
best be compared to a felt compacted out of all the different parts of
the willow. It withstands the strongest arm, when one tries to clear a
path through it, and it offers so much obstruction to the foot that the
most persistent explorer soon gives up the attempt to pierce it, and
turns aside, or retraces his steps. This he does the more readily as
the substratum is in most cases morass or an almost continuous
series of marshy, slimy pools whose fathomableness one is unwilling
even to try.
As the traveller journeys through the tundra, he recognizes that the
whole region presents to the eye the individual features already
described, in regular alternation and monotonous repetition. Only
where a large river of considerable volume flows through the low
tundra is there any real change. Such a river deposits on its banks
the masses of sand it has carried down; and the wind, which blows
constantly and usually violently, piles these gradually up into dunes
along the banks; thus a soil foreign to the tundra is formed. On these
sand-hills the larch grows, even in the tundra of Siberia, to a stately
tree, and becomes, in association with willows and dwarf alder
bushes, an ornament to the landscape. In the neighbourhood of
small lakes the trees may even be grouped together, and, with the
shrubs already named, form a natural park which would not escape
observation even in a much richer and more fertile district, and is
here so very remarkable that it leaves a lasting impression.

Fig. 6.—Peregrine Falcons and Lemmings.


When the larch has taken root in the sand-hills, there grow up under
its sheltering branches other tall-stemmed plants such as sharp-
leaved willows, mountain ash, black alder, and woodbine bushes,
and there spring from the sand many flowers which one thought to
have left far behind in the south. The surprised southerner is
cheered by the red glory of the willow-herb; the charming wild rose
clings close to the motherly earth, decorating it with its slender stems
and its flowers; the bright forget-me-not looks up with home-like
greeting; here hellebore and chives, valerian and thyme, carnations
and blue-bells, bird-vetch and alpine vetch, ranunculus and
immortelles, lady’s-smock, Jacob’s-ladder, cinquefoil, love-lies-
bleeding, and others find a home in the desert. In such places more
plants grow than one had expected, but the traveller is certainly
modest in his expectations when he has seen the same poverty all
around for days and weeks together, always dwarf-birches and
sallows, marsh-andromeda and sedge, reindeer-moss and bog-
moss; has refreshed himself with the stunted crowberries and
cranberries half-hidden in the moss, half-creeping on the ground,
and has been obliged to take the cloudberries which decorate the
moss-cushion as flowers; when he has tramped over them and
among them for days together always hoping for a change, and
always being disappointed. Every familiar plant from the south
reminds him of happier regions; he greets it as a dear friend whose
value is only realized when he has begun to fear losing him.[7]
It seems strange that the plants above-named and many others
should spring only from the dry sand of the dunes, but the apparent
riddle is solved when we know that it is only the sand thus piled up,
that becomes sufficiently warmed in the months of uninterrupted
sunshine for these plants to flourish. Nowhere else throughout the
tundra is this the case. Moor and bog, morass and swamp, even the
lakes with water several yards in depth only form a thin summer
covering over the eternal winter which reigns in the tundra, with
destructive as well as with preserving power. Wherever one tries to
penetrate to any depth in the soil one comes—in most cases
scarcely a yard from the surface—upon ice, or at least on frozen soil,
and it is said that one must dig about a hundred yards before
breaking through the ice-crust of the earth. It is this crust which
prevents the higher plants from vigorous growth, and allows only
such to live as are content with the dry layer of soil which thaws in
summer. It is only by digging that one can know the tundra for what it
is: an immeasurable and unchangeable ice-vault which has endured,
and will continue to endure, for hundreds of thousands of years. That
it has thus endured is proved indisputably by the remains of
prehistoric animals embedded in it, and thus preserved for us. In
1807 Adams dug from the ice of the tundras the giant mammoth,
with whose flesh the dogs of the Yakuts sated their hunger, although
it must have died many thousands of years before, for the race
became extinct in the incalculably distant past. The icy tundra had
faithfully preserved the carcase of this primitive elephant all through
these hundreds of thousands of years.[8]
Many similar animals, and others of a more modern time, are
embedded in the ice, though it is not to be supposed that the tundra
was ever able to sustain a much richer fauna than it has now. Bison
and musk-ox traversed it long after the time of the mammoth; giant-
elk and moose belonged to it once. Now its animal life is as poor and
monotonous as its vegetation—as itself. This holds true, however,
only with regard to species, not to individuals, for the tundra is, at
least in summer, the home of numerous animals.
The year is well advanced before the tundra begins to be visibly
peopled. Of the species which never leave it one sees very little in
winter. The fish which ascend its rivers from the sea are concealed
by the ice; the mammals and birds which winter in it are hidden by
the snow, under which they live, or whose colour they wear. Not until
the snow begins to melt on the southern slopes does the animal life
begin to stir. Hesitatingly the summer visitors make their
appearance. The wolf follows the wild reindeer, the army of summer
birds follows the drifting ice blocks on the streams. Some of the birds
remain still undecided in the regions to the South, behave as if they
would breed there, then suddenly disappear from their resting-place
by the way, fly hastily to the tundra, begin to build directly on their
arrival, lay their eggs, and brood eagerly, as though they wished to
make up for the time gained by their relatives in the South. Their
summer life is compressed into few weeks. They arrive already
united, paired for life, or at least for the summer; their hearts stirred
by all-powerful love, they proceed, singing and rejoicing, to build a
nest; unceasingly they give themselves up to their parental duties,
brood, rear, and educate their young, moult, and migrate abroad
again.

Fig. 7.—The White or Arctic Fox (Canis lagopus).


The number of species which may be looked upon as native to the
tundra is small indeed, yet it is much greater than that of those which
may be regarded as characteristic of the region. As the first of these,
I should like to place the Arctic fox. He ranges over the whole extent
of the tundra, and is sure of maintenance and food in the south at
least, where he occurs along with our fox and other allied species.
Like some other creatures he wears the colours of his home, in
summer a rock-coloured dress, in winter a snow-white robe, for the
hairs of his thick fur coat are at first stone-gray or grayish-blue, and
become snow-white in winter.[9] He struggles through life with ups
and downs like other foxes, but his whole character and conduct are
quite different from those of our reynard and his near relatives. One
scarcely does him injustice in describing him as a degenerate
member of a distinguished family, unusually gifted, intelligent, and
ingenious. Of the slyness and ingenuity, the calculating craft, the
never-failing presence of mind of his congeners he evinces hardly
any trace. His disposition is bold and forward, his manner officious,
his behaviour foolish. He may be a bold beggar, an impudent
vagabond, but he is never a cunning thief or robber, weighing all
circumstances, and using all available means to attain his end.
Unconcernedly he stares at the huntsman’s gun; unwarned by the
ball, which passes whistling over his body, he follows his worst
enemy; unhesitatingly he forces his way into the birch-bark hut of the
wandering reindeer-herdsmen; without fear he approaches a man
sleeping in the open, to steal the game he has caught, or even to
snap at a naked limb. On one occasion an Arctic fox at which I had
several times fired in vain in the dusk, kept following my steps like a
dog. My old sporting friend, Erik Swenson of Dovrefjeld, relates that
one night a fox nibbled the fur rug on which he lay, and old Steller
vouches for many other pranks which this animal plays, pranks
which every one would declare incredible were they not thoroughly
guaranteed by corroborating observations. An insufficient knowledge
of human beings, so sparsely represented in the tundra, may to
some extent account for the extraordinary behaviour of this fox, but it
is not the only reason. For neither the red fox nor any other mammal
of the tundra behaves with so little caution; not even the lemming
approaches him in this respect.
A strange creature certainly is this last inhabitant of our region
whatever species of his family we consider. He, or at least his tracks,
may be seen everywhere throughout the tundra. The tracks run in all
directions, often through places overgrown by dwarf-birches, narrow,
smooth, neatly-kept paths in the moss, going straight for several
hundred yards, then diverging to right or left, and only returning to
the main path after many circuits. On these we may often see, in
great numbers during a dry summer, a little, short-tailed, hamster-like
animal nimbly pattering along and soon disappearing out of sight.
This is the lemming, a rodent smaller than a rat, but larger than a
mouse, and with brightly but irregularly marked skin, usually brown,
yellow, gray, and black. If we dissect the animal we see, not without
surprise, that it consists almost entirely of skin and viscera. Its bones
and muscles are fine and tender; its viscera, especially the
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!

ebooknice.com

You might also like