What you’ll need
- An existing remote or local Kubernetes cluster or the minikube CLI installed locally to create a new testing cluster.
- The Linkerd 2.x CLI installed locally (helper script, Homebrew, or binary in your
$PATH). - An ngrok account.
- kubectl and Helm 3.0.0+ installed on your local workstation.
- The ngrok Kubernetes Operator installed on your cluster.
- A reserved domain from the ngrok dashboard or API; this guide refers to it as
<NGROK_DOMAIN>.
Set up a local development cluster
-
Create a local Kubernetes cluster with minikube.
You will assign it a profile named
ngrok-linkerdwith-p, and for the best compatibility with Linkerd, use thecontainerdcontainer runtime. -
Use
kubectlto verify your local cluster is running properly.
Deploy Linkerd’s service mesh to your cluster
-
Verify your Linkerd CLI is working correctly with
linkerd version, which should display the same output as below. TheServer version: unavailableis expected at this point. -
Validate that your Kubernetes cluster is ready to deploy Linkerd with
linkerd check --pre. You should see the following output at the end: -
Generate and deploy the Kubernetes manifests required to run Linkerd on your cluster, starting with the CRDs.
Followed by the core resources.
-
Check that Linkerd installed correctly with
linkerd check. You should see a number of successful checks in your terminal output, with a final verification at the end.
These steps follow the Linkerd getting-started documentation for installing the service mesh.
Deploy an example microservices-based application
To demonstrate how Linkerd and the ngrok Kubernetes Operator integrate to add additional observability, security, and reliability into your cluster, you’ll deploy the Emojivoto demo application, which was developed by Buoyant, the company that originally developed Linkerd.-
Create an ngrok static subdomain for ingress if you don’t have one already.
Go to the Domains section of the ngrok dashboard and click Create Domain or New Domain.
This static subdomain will be your
NGROK_DOMAINfor the remainder of this guide. Creating a subdomain on the ngrok Edge provides a public route for HTTP, HTTPS, and TLS traffic. -
Deploy Emojivoto to the
emojivotonamespace. -
Add meshing by injecting Linkerd’s data plane proxies into each pod with a rolling deploy.
The following command retrieves all deployments from the previous step, injects the Linkerd proxy, and redeploys each pod.
-
Verify your data plane with
linkerd -n emojivoto check --proxy; it should end with a healthy status check. -
Create a new
emojivoto-ingress.yamlfile and add the following YAML content (see Linkerd’s ingress task documentation for the ngrok example). It defines the ngrok Kubernetes Operator for routing traffic on yourNGROK_DOMAINto theweb-svcdeployment you created when deploying Emojivoto.showLineNumbers -
Apply the
emojivoto-ingress.yamlmanifest you just created.Give your cluster a few moments to launch the necessary resources and for ngrok’s cloud service to pick up the new tunnel. -
Access your Emojivoto application by navigating to your ngrok domain (for example,
https://one-two-three.ngrok.app) in your browser.
Add Linkerd’s dashboard to verify meshing and mTLS
Given that one of the key benefits of a service mesh is increased observability, and the inherent security enhancements that come from mTLS connections between your microservices, you’ll want to double-check that your deployments and pods are properly meshed.-
Install the Linkerd dashboard.
-
To verify mTLS, restart all pods in the
emojivotonamespace to enable tapping. -
Use Linkerd’s tap feature: run
linkerd viz -n emojivoto tap deployto stream traffic from all pods in theemojivotonamespace to your terminal. The Emojivoto app generates traffic automatically, so you’ll see a consistent stream of requests.You should seetls=truein all of these requests between these pods. You can also usekubectl get pods -o wideto see the IP address of each pod, which lets you verify the source and destination of each request. For example, the request shown above is theweb-svcservice sending a POST request, with mTLS enabled, to theemoji-svcservice, which maintains and stores the votes database. -
Run
linkerd viz dashboard &to open the Linkerd dashboard in your browser. The default dashboard shows golden metrics (success rates, traffic, latencies per namespace) and the number of meshed pods per namespace. Some of the auto-generated traffic is designed to fail, which shows how to use the dashboard to debug pod-to-pod issues.
What’s next?
You’ve now integrated a demo microservices application with Linkerd’s service mesh and ngrok’s Kubernetes Operator to add multiple new layers of security and reliability without having to worry about configuring middleware, network interfaces, mTLS, or deploying new monitoring services for observing the external behavior of your code. After deploying this local demo, you have a few options for moving forward.Clean up
To clean up from the work you’ve done for this local demo, you can stop and delete your minikube cluster with theminikube CLI: