Linkerd is an ultralight service mesh for Kubernetes. It makes running services easier and safer by giving you runtime debugging, observability, metrics, reliability, and security without requiring any code changes. The Linkerd 1-Click app configures and performs a deployment of Linkerd2 onto a DigitalOcean Kubernetes cluster in the linkerd
namespace. As a part of a recommended deployment, this app includes Grafana and Prometheus in the linkerd
namespace.
This stack is open source and community supported, and can be found at github.com/digitalocean/marketplace-kubernetes/tree/master/stacks/linkerd2. If you have large production needs, see the Buoyant Enterprise Support.
Notes:
Package | Version | License |
---|---|---|
linkerd2 | 2.12.4 | Apache 2.0 |
Click the Deploy to DigitalOcean button to install a Kubernetes 1-Click Application. If you aren’t logged in, this link will prompt you to log in with your DigitalOcean account.
In addition to creating Linkerd using the control panel, you can also use the DigitalOcean API. As an example, to create a 3 node DigitalOcean Kubernetes cluster made up of Basic Droplets in the SFO2 region, you can use the following doctl
command. You need to authenticate with doctl
with your API access token) and replace the $CLUSTER_NAME
variable with the chosen name for your cluster in the command below.
doctl kubernetes clusters create --size s-4vcpu-8gb $CLUSTER_NAME --1-clicks linkerd2
Follow these instructions to connect to your cluster with kubectl
and doctl
.
First, check if the Linkerd installation was successful by running the command below:
kubectl get deployment -n linkerd
The output looks similar to the following:
NAME READY UP-TO-DATE AVAILABLE AGE
linkerd-destination 1/1 1 1 4m6s
linkerd-identity 1/1 1 1 4m11s
linkerd-proxy-injector 1/1 1 1 4m3s
All pods should be in a READY
state.
Next, check if the Linkerd on-cluster metrics stack installation was successful by running the following command:
kubectl get deployment -n linkerd-viz
The output looks similar to the following:
NAME READY UP-TO-DATE AVAILABLE AGE
grafana 1/1 1 1 7m36s
metrics-api 1/1 1 1 7m40s
prometheus 1/1 1 1 7m33s
tap 1/1 1 1 7m31s
tap-injector 1/1 1 1 7m23s
web 1/1 1 1 7m11s
All pods should be in a READY
state.
If this is your first time running Linkerd, you will need to download the command line interface (CLI) onto your local machine to interact with Linkerd.
For installation instructions, see the release page. For example, for MacOS and Linux, download and install the Linkerd client binary:
curl -sL https://run.linkerd.io/install | sh
Next, add Linkerd to your path:
export PATH=$PATH:$HOME/.linkerd2/bin
Verify that the CLI is installed by running:
linkerd version
You can now view the Linkerd dashboard by running:
linkerd viz dashboard
This will open your default browser with the Linkerd dashboard.
Linkerd also includes Grafana to visualize all the metrics collected by Prometheus. You can see the Grafana dashboard at http://localhost:50750/grafana.
In order for your service to use Linkerd, it needs to have the proxy sidecar added to its resource definition. To do so, use the Linkerd CLI to update the definition and output YAML files and pass them to kubectl
. By using Kubernetes rolling updates, the availability of your application will not be affected.
To add Linkerd to your service, run:
linkerd inject deployment.yml | kubectl apply -f -
For more details, see the Linkerd documentation.
To upgrade your local CLI to the latest version, run the following command:
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh
Alternatively, you can download the CLI directly via the Linkerd releases page.
Verify the CLI is installed and running correctly by running the following command:
linkerd version --client
The output looks similar to the following:
Client version: stable-2.11.1
Use the linkerd upgrade
command to upgrade the control plane. This command ensures that all of the control plane’s existing configuration and mTLS secrets are retained. Use the --prune
flag to remove any Linkerd resources from the previous version which no longer exist in the new version.
linkerd upgrade | kubectl apply --prune -l linkerd.io/control-plane-ns=linkerd -f -
Next, run this command again by adding some --prune-whitelist
flags. This makes sure that certain cluster-scoped resources are correctly pruned.
linkerd upgrade | kubectl apply --prune -l linkerd.io/control-plane-ns=linkerd \
--prune-whitelist=rbac.authorization.k8s.io/v1/clusterrole \
--prune-whitelist=rbac.authorization.k8s.io/v1/clusterrolebinding \
--prune-whitelist=apiregistration.k8s.io/v1/apiservice -f -
Note:
For upgrading a multi-stage installation setup, follow the upgrading a multi-stage install instructions.
Finally, check that the control plane has been upgraded:
linkerd check
Note:
This will run through a set of checks against your control plane and make sure that it is operating correctly.
To uninstall Linkerd from a Kubernetes cluster, you need to first remove any data plane proxies and extensions by running the following command:
linkerd viz uninstall | kubectl delete -f -
Next, remove the control plane by running the following command:
linkerd uninstall | kubectl delete -f -
Note: The linkerd uninstall
command outputs the manifest for all of the Kubernetes resources necessary for the control plane, including namespaces, service accounts, CRDs, and more; kubectl delete
then deletes those resources.