To play with Linkerd and demonstrate some of it's capabilities, you will deploy the sample application, EmojiVoto.
Emojivoto is a sample microservice application that allows users to vote for their favorite emoji. It displays votes received on a leaderboard. Emojivoto has no dependencies on Linkerd, but will run fine either on or off the service mesh.
A sidecar injector is used for automating the injection of the Linkerd proxy into your application's pod spec. The Kubernetes admission controller enforces this behavior send sending a webhook request the the sidecar injector every time a pod is to be scheduled. This injector inspects resources for a Linkerd-specific annotation (linkerd.io/inject: enabled). When that annotation exists, the injector mutates the pod's specification and adds both an init container as well as a sidecar containing the proxy itself.
The Linkerd sidecar proxy can be either manually or automatically injected into your application's pods. This can be done from the meshery dashboard for namespace globally by,
Configure Applicationcard and select
Annotate Namespacefrom the list.
As part of Linkerd deployment in Previous chapter, you have deployed the sidecar injector. To verify, execute this command:
1kubectl get deployment linkerd-proxy-injector -n linkerd
1NAME READY UP-TO-DATE AVAILABLE AGE2linkerd-proxy-injector 1/1 1 1 9m49s
Examine the annotation added to the
1kubectl describe namespace linkerd
1Name: linkerd2Labels: config.linkerd.io/admission-webhooks=disabled3 linkerd.io/control-plane-ns=linkerd4 linkerd.io/is-control-plane=true5Annotations: linkerd.io/inject: disabled6Status: Active78No resource quota.910No LimitRange resource.
Using Meshery, navigate to the Linkerd management page.
Sample Applicationcard and select
Emojivoto Applicationfrom the list.
This will do 3 things:
emojivotonamespace for sidecar injection.
Install emojivoto into the emojivoto namespace by running:
1curl -sL https://run.linkerd.io/emojivoto.yml \2 | kubectl apply -f -
Before we mesh it, let's take a look at the app. If you're using Docker Desktop at this point you can visit http://localhost directly. If you're not using Docker Desktop, we'll need to forward the web-svc service. To forward web-svc locally to port 8080, you can run:
1kubectl -n emojivoto port-forward svc/web-svc 8080:80
Verify that the deployments are all in a state of AVAILABLE before continuing.
1watch kubectl get deployment -n emojivoto
Inspect the details of the pods
Examine details of the pods:
1watch kubectl get po -n emojivoto
Examine details of the services:
1watch kubectl get svc -n emojivoto
Choose one of EmojiVoto's services (e.g.
web-svc), and view it's sidecar configuration:
1kubectl get svc -n emojivoto23kubectl describe service svc/web-svc -n emojivoto
Let's look at the application deployment by port-forwarding the
1kubectl port-forward svc/web-svc 8080:80 -n emojivoto
You have onboarded emojivoto to the service mesh. Verify your data plane environment with this check:
1linkerd -n emojivoto check --proxy
Linkerd, in contrast to Istio annotates the resources (namespaces, deployment workloads) rather than labelling them.
Applying this yaml file included in the Linkerd package you collected in https://run.linkerd.io/emojivoto.yml will deploy the sample app into your cluster.
1kubectl apply -f https://run.linkerd.io/emojivoto.yml
The emojivoto application is a standalone Kubernetes application that uses a mix of gRPC and HTTP calls to allow the users to vote on their favorite emojis, which means the application can run standalone without support from linkerd service mesh. Now we will be injecting linkerd into our sample application
1kubectl get -n emojivoto deploy -o yaml \2 | linkerd inject - \3 | kubectl apply -f -
1kubectl -n emojivoto patch -f https://run.linkerd.io/emojivoto.yml -p '2spec:3 template:4 metadata:5 annotations:6 linkerd.io/inject: enabled7'
Either of these commands retrieve all of the deployments running in the emojivoto namespace, runs the manifest through linkerd inject, and then reapplies it to the cluster. The linkerd inject command adds annotations to the pod spec instructing Linkerd to add (“inject”) the proxy as a container to the pod spec.
You've now added Linkerd to existing services! Just as with the control plane, it is possible to verify that everything worked the way it should with the data plane. To do this check, run:
1linkerd -n emojivoto check --proxy