(01)Install Linkerd
Linux
1curl -fsL https://run.linkerd.io/install | sh2export PATH=$PATH:$HOME/.linkerd2/bin3linkerd versionLightweight Kubernetes service mesh — mTLS, metrics, retries
What is this?
Linkerd is a lightweight service mesh that adds mTLS, metrics, and retries between pods.
Step 01
1curl -fsL https://run.linkerd.io/install | sh2export PATH=$PATH:$HOME/.linkerd2/bin3linkerd versionStep 02
1linkerd install | kubectl apply -f -2linkerd viz install | kubectl apply -f -3kubectl annotate namespace default linkerd.io/inject=enabled4linkerd checkStep 03
1linkerd viz dashboard &2linkerd stat deploy -n defaultStep 04
1linkerd check2kubectl get pods -n linkerd3kubectl annotate namespace default linkerd.io/inject=enabled --overwrite4kubectl rollout restart deployment2 YAML templates for Linkerd. Copy and deploy after setup.
2 ready-to-copy templates. Expand one, copy the YAML, then run the deploy commands.
configmap.yml
1apiVersion: v12kind: ConfigMap3metadata:4 name: node-api-config5data:6 NODE_ENV: "production"7 WORKER_URL: "http://worker-svc:4000"gateway-deployment.yml
1apiVersion: apps/v12kind: Deployment3metadata:4 name: gateway5spec:6 replicas: 27 selector:8 matchLabels:9 app: gateway10 template:11 metadata:12 labels:13 app: gateway14 spec:15 containers:16 - name: gateway17 image: node-gateway:local18 imagePullPolicy: IfNotPresent19 ports:20 - containerPort: 300021 envFrom:22 - configMapRef:23 name: node-api-config24 resources:25 requests:26 memory: "128Mi"27 cpu: "100m"28 limits:29 memory: "256Mi"30 cpu: "250m"gateway-svc.yml
1apiVersion: v12kind: Service3metadata:4 name: gateway-svc5spec:6 type: NodePort7 selector:8 app: gateway9 ports:10 - port: 300011 targetPort: 300012 nodePort: 32300worker-deployment.yml
1apiVersion: apps/v12kind: Deployment3metadata:4 name: worker5spec:6 replicas: 17 selector:8 matchLabels:9 app: worker10 template:11 metadata:12 labels:13 app: worker14 spec:15 containers:16 - name: worker17 image: node-worker:local18 imagePullPolicy: IfNotPresent19 ports:20 - containerPort: 400021 resources:22 requests:23 memory: "128Mi"24 cpu: "100m"worker-svc.yml
1apiVersion: v12kind: Service3metadata:4 name: worker-svc5spec:6 type: ClusterIP7 selector:8 app: worker9 ports:10 - port: 400011 targetPort: 4000Step 01
1docker build -t node-gateway:local ./gateway2docker build -t node-worker:local ./worker3minikube image load node-gateway:local4minikube image load node-worker:local1kubectl apply -f configmap.yml2kubectl apply -f gateway-deployment.yml3kubectl apply -f gateway-svc.yml4kubectl apply -f worker-deployment.yml5kubectl apply -f worker-svc.yml6kubectl get pods,svc