Chapter 1. How to Get Started with Any Service Mesh

As you learned in Chapter 1: A Multi-Mesh World, there are many different service mesh options to choose from. Knowing that there isn’t a single tool that fits every job is somewhat reassuring, but at the same time having a number of service mesh options to consider means that you will want to make an informed decision regarding which one to deploy.

In this chapter we provide you with two key pieces of guidance. First, we explain how the management plane Meshery will help you quickly get started with whatever service mesh you choose—to stand it up and deploy your applications or sample applications that you can use to explore and learn. Second, we explain how this robust tool is also particularly useful operationally for implementing each of the patterns you will learn later in this book. Consequently, guidance in this chapter is useful both as you explore and operate different service meshes, but also you comprehend and implement any service mesh pattern.

Use a Management Plane to Deploy any Service Mesh

A management plane makes it easy to adopt and operate a service mesh. It helps with caretaking and configuration of workloads, and it integrates with existing tooling and processes (see Figure 2-1).

Service mesh planes  management  control  and data planes
Figure 1-1. Service mesh planes: management, control, and data planes

As the multi-mesh manager, Meshery, is the open source tool that we will reference throughout this book. Meshery’s popularity (and its usefulness in deploying patterns) is in part due to its compatibility with so many service meshes (more service meshes than any other tool available) as shown in Figure 2-2.

Multi mesh management through pluggable adapters.
Figure 1-2. Multi-mesh management through pluggable adapters.

Meshery deploys as a set of Docker containers whether as a stand-alone, management plane on a Docker host (out-of-cluster) or as a management plane in a Kubernetes cluster (in-cluster). Consequently, any given deployment of Meshery can be described as either an in-cluster or an out-of-cluster deployment. You will find the complete list of its supported platforms in the project’s documentation.

Whether you will be deploying Meshery in a Kubernetes cluster or on a Docker host (outside of a Kubernetes cluster), prepare to interact with Meshery by installing its command line client: mesheryctl. If you are on a MacOS or Linux system, you can download, install, and run the management plane with this single command:

$ curl -L https://git.io/meshery | bash -

If the command line client detects Docker on your system, it will attempt to start Meshery locally, opening your default browser when Meshery is running and available.

Alternative to this bash script, you can use Homebrew to install mesheryctl on your Linux or MacOS system or you can use Scoop to install mesheryctl on your Windows system.

To install mesheryctl, using Homebrew execute this command:.

$ brew install layer5io/mesheryctl
        

To install mesheryctl, using Scoop execute the following commands:

$ scoop bucket add mesheryctl https://github.com/layer5io/scoop-bucket.git
$ scoop install mesheryctl

Install the management plane and its service mesh adapter by executing:

$ mesheryctl system start
        

Whether you have deployed Meshery locally (out-of-cluster) on your host operating system or remotely (in-cluster) within Kubernetes, you can use either of Meshery’s clients to interact with the management plane. Meshery’s two clients are mesheryctl and Meshery’s UI. See Figure 2.3 for an understanding of how these two clients fit into a Meshery deployment.

Meshery Clients interact with Meshery through ReST  GraphQL  and Websockets.
Figure 1-3. Meshery Clients interact with Meshery through ReST, GraphQL, and Websockets.

Upon initialization, Meshery will inspect its environment in search of access to a Kubernetes cluster. For out-of-cluster deployments, this typically means that Meshery will look to your local kubeconfig file under ($HOME/.kube/config) and assume that your current context is the preferred cluster to connect. For in-cluster deployments, this means that Meshery will look to environment variables for a Kubernetes secret and certificate to communicate with Kube API. Once connected to Kubernetes, a reconciliation process called MeshSync initializes and begins synchronizing it’s understanding of the state of any existing service mesh deployments.

Understanding MeshSync

MeshSync is an event-driven, continuous synchronization routine that performs the task of ensuring that Meshery knows what the service mesh and Kubernetes environment’s states of configuration and status of operation are. MeshSync runs as a Kubernetes custom controller under the management of Meshery Operator. Once Meshery successfully initializes connection with your Kubernetes cluster, it deploys both Meshery Operator and MeshSync.

Architecture of Meshery  the service mesh management plane
Figure 1-4. Architecture of Meshery, the service mesh management plane

Once you have Meshery running, log into Meshery by selecting a provider from the available list as shown in Figure 2-5. From within Meshery’s UI, you may choose from any number of service meshes that you would like to deploy.

Select from local and remote Meshery providers.
Figure 1-5. Select from local and remote Meshery providers.

Deploying a Service Mesh

With Meshery up and running, you can explore the functionality, performance, and behavior of each supported service mesh. Some service meshes include optional add-ons like Promtheus, Grafana, or Jaeger. You can deploy each service mesh and its optional add-ons either using mesheryctl or Meshery UI. To start a service mesh with mesheryctl, execute the command below.

$ mesheryctl mesh start consul
Deploying service mesh: Consul...
          

To start a service mesh using Meshery UI, locate the type of service mesh you would like to deploy and click to deploy. Then execute the following command.

[Screenshot coming soon]

Deploying a Sample Application

Once your service mesh is up and running, deploy a sample application. Sample applications are helpful for understanding the functionality of a service mesh and are useful as on-hand examples for experimenting with patterns. Nearly all service meshes have a sample application bundled with them for the very purpose of learning. Consequently, a number of sample applications are bundled in Meshery and readily available for experimentation. Certain sample applications might resemble your own workloads more than others. We include a variety of sample applications throughout the book to demonstrate various aspects of service meshes.

We recommend using the same sample application across multiple service meshes, as this helps facilitate an even greater understanding of service mesh functionality and helps illuminate functional and behavioral differences between service meshes. Meshery makes this easy by supporting the same sample application deployment across service meshes. See the Meshery documentation for instructions on how to deploy an application (workload).

When deploying a sample application, first confirm your current context by executing this command:

$ mesheryctl system context view 
Context: 
	cluster-b

Create a new context or switch to an existing context as necessary as shown here:

$ mesheryctl system context switch cluster-a
Switched to context ‘cluster-a’.

Use Meshery to Deploy a Service Mesh Pattern

After a sample application is running, you can then use Meshery to deploy a pattern. Each of the patterns included in this book are detailed as a YAML file. The format of the YAML is based on the Service Mesh Performance (SMP) specification described in Chapter 28 .

To deploy a pattern, execute this command:

$ mesheryctl pattern apply -f <path to the pattern>
Deploying pattern…
Pattern successfully deployed.

From here, output and behavior will vary based upon the specific pattern you’re deploying. Should you find that your pattern is not successfully deployed, refer to the pattern troubleshooting guide in the Meshery documentation.

As you step through each pattern, you might choose to modify the pattern to suit your specific environment and workload, exploring in-context of your specific situation. Optionally, you may choose to use MeshMap, or another visual service mesh topology tool, to facilitate your comprehension of the patterns and to literally see the patterns in-action.

Take time to explore. Try deploying one service mesh’s sample application onto a different service mesh and compare differences in behavior and each service mesh’s ability to manage it. If using Meshery to do so, execute the following commands as an example to deploy the sample application, BookCatalog, onto Open Service Mesh:

$ mesheryctl pattern apply -f book-catalog
Deploying application “BookCatalog”...
Deployed. Endpoint(s) available at: http://localhost:8000/catalog

Conclusion

Your understanding of the service mesh management plane is fundamental to getting hands-on with each of the other patterns described in this book. Meshery is designed to not only let you deploy a number of different types of service meshes easily, but to deploy your applications specifically, so that you can onboard them and readily explore their behavior under the patterns you will learn in this book. Whether you are new to service meshes or have been running them for years, the combination of this book’s patterns and Meshery will help get the most out of your mesh.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.28.179