Linkerd 2.10 (Step by Step) — Customizing Linkerd Configuration with Kustomize

Linkerd 2.10 (Step by Step) — Customizing Linkerd Configuration with Kustomize

The Linkerd 2.10 Chinese manual is being continuously revised and updated:

https://linkerd.hacker-linner.com

Kustomize can be used to patch the output of linkerd install in a consistent way, rather than forking the Linkerd installation and upgrade process. This allows installations to be customized to add installation-specific features.

First, save the output of install into a YAML file. This will be the base resource that Kustomize will use to patch and generate content that is added to the cluster.

  1. linkerd install > linkerd.yaml

When upgrading, make sure to populate this file with the contents from linkerd upgrade . With the latest kustomize versions, this can be done automatically using the exec plugin.

Next, create a kustomization.yaml file. This file will contain the instructions for Kustomize, listing the base resources and the transformations performed on those resources. Right now, this looks pretty empty:

  1. resources:
  2. - linkerd.yaml

Now, let's see how to do some example customizations.

Kustomize allows any number of patches, transforms, and generators. These examples show one modification at a time, but you can make as many modifications as you want in a single kustomization.yaml file.

Adding Priority Class

There are several components in the control plane that can benefit from being associated with a critical PriorityClass. While this configuration is not currently supported as a flag to linkerd install, it is not difficult to add using Kustomize.

First, create a file called priority-class.yaml, which will create a PriorityClass resource.

  1. apiVersion: scheduling.k8s.io/v1
  2. description: Used for critical linkerd pods that must run in the cluster, but
  3. can be moved to another node if necessary.
  4. kind: PriorityClass
  5. metadata:
  6. name : linkerd-critical
  7. value: 1000000000

1000000000 is the maximum value. User defined priorities are allowed, adjust accordingly.

Next, create a file called patch-priority-class.yaml which will contain the override. This override will explain what needs to be modified.

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name : linkerd-identity
  5. spec:
  6. template:
  7. spec:
  8. priorityClassName: linkerd-critical
  9. ---  
  10. apiVersion: apps/v1
  11. kind: Deployment
  12. metadata:
  13. name : linkerd-controller
  14. spec:
  15. template:
  16. spec:
  17. priorityClassName: linkerd-critical

Then, add this as a strategy merge option to kustomization.yaml:

  1. resources:
  2. -priority-class.yaml
  3. - linkerd.yaml
  4. patchesStrategicMerge:
  5. -patch-priority-class.yaml

Applying this to your cluster requires taking the output of kustomize build and piping it to kubectl apply. For example, you could run:

  1. kubectl kustomize build . | kubectl apply -f -

Modify Grafana configuration

Interested in enabling authentication for Grafana? You can do this with a one-time modification to the ConfigMap. Unfortunately, these changes will eventually be reverted every time a linkerd upgrade occurs. Instead, create a file called grafana.yaml and add your modifications:

  1. kind: ConfigMap
  2. apiVersion: v1
  3. metadata:
  4. name : grafana-config
  5. data:
  6. grafana.ini: |-
  7. instance_name = grafana
  8.  
  9. [server]
  10. root_url = %(protocol)s://%(domain)s:/grafana/
  11.  
  12. [analytics]
  13. check_for_updates = false  

Then, add this as a strategy merge option to kustomization.yaml:

  1. resources:
  2. - linkerd.yaml
  3. patchesStrategicMerge:
  4. -grafana.yaml

Finally, apply it to your cluster by generating the YAML using kustomize build and piping the output to kubectl apply .

  1. kubectl kustomize build . | kubectl apply -f -

【Editor's recommendation】

  1. How do you use these 7 Linux commands?
  2. Perhaps this is the best Git tutorial so far.
  3. A Brief Analysis of the Infrastructure of WeChat Mini Programs
  4. The regret medicine is here! Detailed graphic tutorial on how to downgrade from iOS 15 to iOS 14.6
  5. Popular language projects based on WebAssembly

<<:  Why the development of optical communications is not as good as 5G, experts say: each is fighting for its own

>>:  Why are operators competing to launch new 4G packages as 5G is the mainstream?

Recommend

...

How to use Layer 3 switches to build enterprise VLANs

The expansion of enterprise scale has led to the ...

3 Ways 5G is Driving Edge Intelligence

5G is closely tied to edge computing. With a whol...

5G RedCap: New Cellular IoT Technology Optimization

The latest version of the 3GPP standard for mobil...

...

Review of 5G industry-specific networks in 2020: The beginning of a new era

4G changes life, 5G changes society. As the leade...

Inventory of URLError and HTTPError exception handling methods

[[390611]] 1. Introduction This article mainly ta...

5G era: Will WiFi disappear from people’s lives?

WiFi has gradually penetrated into our daily live...

Three steps to converge cloud and edge computing for IoT

The Internet of Things has grown rapidly over the...

PacificRack VPS, 5-253 IPs per year starting from $50

PacificRack is a site under QN Data Center, mainl...

...