Install Linkerd Service Mesh in RancherDesktop Cluster
Install Linkerd in RancherDesktop cluster
In this blog will demonstrate setting up Linkerd service mesh in RancherDesktop. Will be only focusing on how we can manually and automatically inject linkerd-proxy to each container as sidecar.
Pre-requsities:
- Understanding on Kubernetes, Service Mesh bascis is required.
kubectlinstalled from kubernetes website.- optionally,
helm CLIbut not necessary.
Service mesh at a very high level,
- When deploying applications in Kubernetes cluster as container we need to control network traffic to and fro from the container, etc.
- Service mesh implementation like Istio, Linkerd, Consul, etc provides those feature at infrastcuture layer that can control service to service communications.
Install RancherDesktop
- Download the RancherDesktop binary for windows and install it, follow the instruction in rancherdesktop.io. This is very easy.

- RancherDesktop uses k3s Kubernetes distribution, developed and maintained by SUSE/Rancher.
- RancherDesktop provides a single node cluster. Currently, multi-node support is not available.
- RancherDesktop also has a Dashboard to view namespace, containers, etc.
Verify the RancherDesktop cluster
- Launch the RancherDesktop cluster by clicking the icon.
- It will take few minutes for the the cluster to be up and running, progress can be tracked in the GUI.
Note
- The RancherDesktop will use the
rancher-desktopcontext.- In case if you where using DockerDesktop, switch context to
rancher-desktopusing kubectl.
- Create the first Pod in the cluster,
- Open a command prompt and issue
kubectl run pod1 --image=nginx - verify the status using
kubectl get pods, the status ofpod1should be running.
- Open a command prompt and issue
Note
- RancherDesktop GUI provides port forwarding option, if we create a service its easy to forward traffic to and from host laptop.
- When setting up the Linkerd demo app will demonstrate port forwarding and how to access the application using port forward from local host laptop.

Install Linkerd Service Mesh
- Download and Install the Linkerd CLI binary from linkerd website, Github release, extract this binary and place in a directory.
- Add the executable path in the windows Environment path variable, so it will be recognized in command prompt or powershell.
Validate Linkerd CLI
If Linkerd CLI is installed correctly, open command prompt and issue
linkerd versioncommand this should display the version like in below snippet.Client version: stable-2.11.3 Server version: stable-2.11.3
Install Linkerd service mesh in RancherDesktop cluster
- Using the linkerd cli, we can generate the deployment yaml, and use kubectl command to install it in the cluster.
Details and steps are documented in the linkerd website, refer this link refence for more details.
- We can use below command to install linkerd service mesh.
- In this case we are piping the
linkerd installoutput to kubectl directly.
> linkerd install | kubectl apply -f -Once installed, we see that resources running under the
linkerdnamespace
- To verify and check if everything is installed correctly use
linkerd checkcommand.
Inject Linkderd proxy - Automatic
- By creating specific annotation at the namespace, we can configure linkerd control pane to manager the proxy injection automatic.
- create a
namepsacein the cluster and create anannotationlinkerd.io/inject=enabled, shown below
# Creating an emojivoto namespace used for linkerd demo application as well
> kubectl creaet namespace emojivoto
# create annotation on the emojivoto namespace
> kubectl annotation namespace emojivoto linkerd.io/inject=enabled
- With the above configuration, if we issue
kubectl run pod1 --image=nginx, it will create a container and we can notice the proxy injected automatically. - Use
kubectl -n emojivoto get pods, notice the Pod Ready state indicating2/2. We can describe the pod and see the proxy injected


Inject Linkerd proxy - manually
- In order to manually inject, we need to use linkerd cli command.
- Once we build the deployment descriptor yaml file, we need to pass the file to
linkerd injectcommand
# use linkerd inject to mutated the custom deployment with linkerd proxy configuration
> cat mydeployment.yml | linkerd inject > deploymentwithproxy.yml
# deploy using kubectl
> kubectl apply -f deploymentwithproxy.yml
Install linkerd emojivoto demo app
- Download the deployment descriptor yaml, using below command
> curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/emojivoto.yml > emojoapp.yml
- Use
kubectl applycommand to install the resources to cluster
> kubectl apply -f emojoapp.yml
- Use
kubectl -n emojivoto get podsto view the deployed resources

Accessing the demo application from localhost
Open up the RancherDesktop, enable the port forwarding for the service created by the linkerd demo app.
In the below image, port forwarding is enabled for all the service created by the demo app.

- Now we can use the port displayed for the accessing the application, the
web-svcservice is where we need to start. - In my case
http://localhost:62173.

Install Linkerd dashboard
- We need to install the linkerd viz to the cluster using below command
> linkerd viz install | kubectl apply -f -
# use below command to check if everything is setup correctly
>linkerd check
Monitor traffic in linkerd dashboard
- With the below command we can start the linkerd dashboard
> linkerd viz dashboard
- Issuing above command, will open up the the dashboard in the browser automatically
- Below image depicts the list of namespace and pods, etc displayed in the daskboard.


- Clicking the
Grafanaicon near the pod will bring up theGrafanadashboard with visualization of pod traffic and other Observability metrics.

Bonus - using nerdctl cli
- In RancherDesktop, I was using
ContainerdContainer Runtime, in order to manage images forcontainerdwe can usenerdctlcli. - First install the
nerdcltCLI for windows from containerd Github - Note,
nerdctlcommand is similar to Docker CLI command, all options are supported there, refer documentation. - With the
nerdctlcommand, we can build the image and directly deploy to RancherDesktop cluster, no need to push to dockerhub. - Refer RancherDesktop reference working on images using
nerdctl
- Below lists the image built for a simple GoLang app, using using
nerdctlcli
C:\go_k8s>nerdctl --namespace k8s.io images
REPOSITORY TAG IMAGE ID CREATED PLATFORM SIZE BLOB SIZE
thiru/mygoapp v1.0 ab83037c8160 57 seconds ago linux/amd64 7.6 MiB 3.7 MiB
- Command to deploy the image created in the local repo directly deploy in RancherDesktop cluster
C:\go_k8s>kubectl run goapp --image thiru/mygoapp:v1.0
pod/goapp created