DEV Community

Cover image for Linkerd: Install and Basic Ops
Carlos Nogueira
Carlos Nogueira

Posted on

Linkerd: Install and Basic Ops

Linkerd Installation, Basic Operations and My Thoughts About it.

Requirements(Works on Production too)

  • GKE or Minikube or kind
  • Kubernetes(1.16+)
  • kubectl(1.16+)
  • Linkerd 2.x

1 - Install Linkerd CLI

- $ curl -sL https://run.linkerd.io/install | sh
- $ export PATH=$PATH:$HOME/.linkerd2/bin
- $ linkerd version
Enter fullscreen mode Exit fullscreen mode

2 - Validate Kubernetes Cluster

- $ linkerd check --pre
OUTPUT:
..
pre-kubernetes-capability
-------------------------
‼ has NET_ADMIN capability
    found 1 PodSecurityPolicies.. 
‼ has NET_RAW capability
    found 1 PodSecurityPolicies..
Enter fullscreen mode Exit fullscreen mode
(on GKE ignore this warnings. This is because there's no linkerd previously installation and the pods security policies are on. But, dont worry)

3 - Deploy Linkerd

- $ linkerd install | kubectl apply -f -
- $ linkerd check
- $ kubectl get all -n linkerd 
Enter fullscreen mode Exit fullscreen mode
(now the linkerd check command must have all green checks output)

4 - Access the Dashboard

- $ linkerd dashboard
OUTPUT:
Linkerd dashboard available at:
http://localhost:50750
Grafana dashboard available at:
http://localhost:50750/grafana
Opening Linkerd dashboard in the default browser
Enter fullscreen mode Exit fullscreen mode

You can use port-forward to expose the dashboard.

- $ kubectl port-forward --address 127.0.0.1 \
service/linkerd-web 5000:8084 -n linkerd
Enter fullscreen mode Exit fullscreen mode

Dashboard is referenced by the linkerd-web service. If you are executing from a bastion, you can define the bastion IP editing the deployment.apps/linkerd-web

- $ kubectl edit deployment.apps/linkerd-web -n linkerd
# you must edit the address on the arg enforced-host:
# BEFORE EDIT:-enforced-host=^(localhost|127\.0\.0\.1|..
# AFTER  EDIT:-enforced-host=^(bastionhost|192\.168\.0\.9|..

- $ kubectl port-forward --address 0.0.0.0 \
service/linkerd-web 5000:8084 -n linkerd
Enter fullscreen mode Exit fullscreen mode

Now you can open the Dashboard with bastion IP(192.168.0.9 as the example) and port 5000

Linkerd Dashboard

With dashboard we can visualize our microservices architecture in selected namespace

Alt Text

Clicking on the Grafana icon link at the pod line, we can see the pod stats on a template pre-configurated

Alt Text

Alt Text

Each meshed pod will have a pre-configured Grafana Dashboard.

The Linkerd is a lightweight powerful service mesh plataform, and had the advantage to be strongly decoupled architecture. It can be added and removed without influencing your app.

Linkerd is unique in that it is part of the Cloud Native Foundation (CNCF), which is the organization responsible for Kubernetes.

The CLI had a simple and intuitive user experience.

You can mesh your deployed microservice with simple commands

#add with linkerd inject command on a deployed app
- $ kubectl get -n YOUR_APP_NAMESPACE deploy -o yaml \
  | linkerd inject - \
  | kubectl apply -f -
Enter fullscreen mode Exit fullscreen mode

or add few yaml instructions(two config lines on the app deployment yaml)

#example:
annotations:
  checksum/config: 37b064423157b6fe14ddeba6924195c1075bd17feb
  linkerd.io/inject: enabled

#this values are extract from the command
- $ kubectl get -n YOUR_APP_NAMESPACE deploy -o yaml \
  | linkerd inject -
Enter fullscreen mode Exit fullscreen mode

To reverse the mesh on your app do:

- $ kubectl get -n YOUR_APP_NAMESPACE deploy -o yaml \
  | linkerd uninject - \
  | kubectl apply -f -
Enter fullscreen mode Exit fullscreen mode

To uninstall Linkerd

- $ linkerd uninstall | kubectl apply -f -
Enter fullscreen mode Exit fullscreen mode

References

Top comments (0)