readersclub / linkerd-lf

Introduction to Service Mesh with Linkerd by Linux Foundation - MOOC, EdX
Apache License 2.0
0 stars 0 forks source link

Chapter 3. Linkerd Architecture #4

Open anitsh opened 3 years ago

anitsh commented 3 years ago

Chapter Overview

Up until now, we've discussed Linkerd within the context of the service mesh ecosystem and covered the core concepts of a service mesh. From this chapter on, we will turn all our attention to Linkerd.

Successfully deploying and maintaining Linkerd in a production environment starts with a solid understanding of its underlying architecture. In this chapter, we'll cover Linkerd's architecture in broad terms. Since this is intended to be a practical course, we will also get started with the Linkerd command-line interface (CLI) and get our hands dirty with some basic commands.

anitsh commented 3 years ago

Learning Objectives

By the end of this chapter, you should be able to:

anitsh commented 3 years ago

Linkerd's Architecture

A basic overview of Linkerd's architecture is shown in the diagram below. There are several components of note: The control plane, denoted by the blue background. The data plane, denoted by the green background. The underlying application, denoted by the grey background. The CLI and browser (generally, the "UI"), located to the left of the diagram. Note that this diagram presents a simplified view of the control plane; there are several control plane components we will cover in later chapters that are not on this diagram.

image

The basic functionality of each of these components is as follows:

The application is the underlying application to which the service mesh has been added to. In this course, we assume that your application is composed of multiple services that communicate with each other over the network (sometimes called a "microservice architecture"). If that's not the case, the service mesh will be of limited utility to you! The data plane is the component of the service mesh that handles the actual communication between application services. Linkerd uses a sidecar model in which Linkerd's "micro-proxies" are injected alongside the application services and transparently handle the communication between them. The control plane is the collection of components that allow the data plane to be observed and controlled as a whole. The UI (CLI and browser) or "user interface" is the set of mechanisms by which you, the operator and user of the service mesh, interact with Linkerd. This architecture has a couple notable features:

The control plane is a heterogeneous set of services with individual functions, but the data plane consists only of (many copies of) the Linkerd micro-proxy itself. Once fully meshed, communication between application components goes through two proxies: one on the source side, and one on the destination side. The data plane scales directly with the size (in services) of the application. In future chapters, we'll dive into the control plane and the data plane in greater detail. But first, let's describe the sidecar pattern that Linkerd uses to install its data plane alongside the application.

anitsh commented 3 years ago

The Sidecar Pattern

In order to install its data plane alongside the application, Linkerd uses a "sidecar" approach: it takes advantage of a feature in Kubernetes that allows multiple containers in one pod, and installs its data plane proxy as a "sidecar" container in the same pod as the application. The term "sidecar" comes from the real world design of a motorcycle with an attachment that allows for an additional passenger. Thus, in a Kubernetes pod which is part of the Linkerd service mesh, there are at least two containers: one for the service (the motorcycle) and one for the Linkerd proxy (the sidecar). image In later chapters, we'll see how Linkerd uses additional Kubernetes features to transparently wire all incoming and outgoing TCP traffic through this sidecar container. This is the basic mechanism by which Linkerd remains transparent to the underlying application.

anitsh commented 3 years ago

The Linkerd CLI

Enough armchair architecture. Let's get ready to take this motorcycle out for a test drive!

Your main interaction with Linkerd will be through its command line interface. Linkerd's user experience is designed to fit into Kuberentes, and the CLI should feel familiar if you've used kubectl.

While the control plane and data planes will be installed on a Kubernetes cluster, the CLI is installed locally, e.g. on your laptop or desktop computer. Let's try it out! Run this command to download and install the CLI:

curl -sL https://run.linkerd.io/install | sh

This will install the latest version of the Linkerd CLI (called simply "linkerd") on your computer. Be sure to follow the instructions to add the linkerd executable to your PATH environment variable:

export PATH=$PATH:~/.linkerd2/bin/linkerd

From our architecture discussion above, we know that the CLI is used to interact with Linkerd through its control plane. In a later chapter, we'll see how to install the control plane onto a cluster using the CLI. For now, take a moment to become familiar with the linkerd CLI by viewing the help output:

linkerd --help

This output displays the subcommands offered by the Linkerd CLI and in this course, you'll learn how to use each one.

Congratulations! With the CLi installed, you've taken the first step towards operating Linkerd!

anitsh commented 3 years ago

Summary

In this chapter you learned about the Linkerd architecture, and installed the Linkerd CLI. This chapter also describes the sidecar pattern implemented by the Linkerd proxies in the data plane. This pattern decouples the Linkerd proxy from the service logic in a way that provides transparency.

Now that you're familiar with the architecture, you are prepared for the upcoming chapters where you will deploy the Linkerd control plane and inject the Linkerd data plane into a sample application. You will also continue to use the Linkerd CLI and learn more about its commands.