Adding Linkerd to a service

Follow these steps to add Linkerd to our demo application:

  1. Change directories to the linkerd folder:
$ cd /src/chapter7/linkerd
  1. Deploy the demo application, which uses a mix of gRPC and HTTP calls to service a voting application to the user:
$ kubectl apply -f emojivoto.yml
  1. Get the service IP of the demo application. This following command will return the externally accessible address of your application:
$ SERVICE_IP=http://$(kubectl get svc web-svc -n emojivoto \
-o jsonpath='{.status.loadBalancer.ingress[0].hostname}:{.spec.ports[].targetPort}')
$ echo $SERVICE_IP
  1. Open the external address from Step 3 in a web browser and confirm that the application is functional:

  1. Enable automatic sidecar injection by labeling the namespace where you will run your applications. In this recipe, we're using the emojivoto namespace:
$ kubectl label namespace emojivoto linkerd.io/inject=enabled

You can also manually inject a linkerd sidecar by patching the pods where you run your applications using the
kubectl get -n emojivoto deploy -o yaml | linkerd inject - | kubectl apply -f - command. In this recipe, the emojivoto namespace is used.