# Use Linkerd

## What Will You Do

In this exercise,

- You will be deploying a sample application with linkerd proxy

---

## Assumptions

- You have already provisioned or imported a Kubernetes cluster using the controller.
- You have successfully published a linkerd addon based cluster blueprint to your cluster.

For this example, we will use an emojivoto application available at [linkerd.io](https://linkerd.io/)

---

## Step 1: Download emojivoto sample application

Download the sample application provided in [linkerd.io](https://linkerd.io/) website.

```
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/emojivoto.yml -o emojivoto.yml
```

## Step 2: Create workload

- Login into the Web Console and navigate to your Project as an Org Admin or Project Admin
- Under Infrastructure (or Applications if accessed with Project Admin role), select "Namespaces" and create a new namespace called "emojivoto"
- Next in the Wizard, in the general section add the following annotation `linkerd.io/inject: enabled` and click save and go to placement.
- Select the appropriate cluster(s) and publish the namespace.
- Go to Applications > Workloads
- Select "New Workload" to create a new workload called "emojivoto"
- Ensure that you select "k8s YAML" for Package Type and select the namespace as "emojivoto"
- Click CONTINUE to next step
- Select Choose File and upload emojivoto.yml file downloaded earlier
- Save and Go to Placement
- In the Placement step, select the cluster(s) that you would like to deploy the application
- Publish the emojivoto workload to the selected cluster(s)

## Step 3: Verify deployment

You can optionally verify whether the correct resources have been created on the cluster.

- First, we will verify the pod status

```
kubectl get po -n emojivoto
NAME                        READY   STATUS    RESTARTS   AGE
emoji-56c95cbfd-ct6x7       2/2     Running   0          47m
vote-bot-84f555bcc9-nvsfh   2/2     Running   0          47m
voting-86c68ddd5-q7z9s      2/2     Running   0          47m
web-865b89955c-2vbfm        2/2     Running   0          47m
```

- Then, we will verify linkerd-proxy is attached to each of the pods.

```
kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{"\n"}{.metadata.name}{":\t"}{range .spec.containers[*]}{.image}{", "}{end}{end}'

emoji-56c95cbfd-ct6x7:  cr.l5d.io/linkerd/proxy:stable-2.11.4, docker.l5d.io/buoyantio/emojivoto-emoji-svc:v11,
vote-bot-84f555bcc9-nvsfh:  cr.l5d.io/linkerd/proxy:stable-2.11.4, docker.l5d.io/buoyantio/emojivoto-web:v11,
voting-86c68ddd5-q7z9s: cr.l5d.io/linkerd/proxy:stable-2.11.4, docker.l5d.io/buoyantio/emojivoto-voting-svc:v11,
web-865b89955c-2vbfm:   cr.l5d.io/linkerd/proxy:stable-2.11.4, docker.l5d.io/buoyantio/emojivoto-web:v11, %
```

You can see that all the pods have a linkerd proxy attached. You can also check this from Rafay console -> cluster resources

##

## Recap

Congratulations! You successfully deployed an application with Linkerd sidecar injection.
