Overview

소개 - 링크

Untitled

제공 기능

  1. Observability : Collecting real-time telemetry from the system to infer the health of each of the services
  2. Security : Ensuring that communication between services is confidential, authenticated, and authorized
  3. Reliability : Ensuring that overall application health is maximized, even in the face of partial failures

Architecture - 링크

Untitled

(참고) Linkerd Extenstions : Viz, Jaeger, Multi-cluster

(참고) Service Mesh Interface (SMI)Specification - 링크

Untitled

Getting Started

기본 환경 배포

# 쿠버네티스 배포
curl -O <https://raw.githubusercontent.com/gasida/KANS/main/8/Vagrantfile>
vagrant up

# 접속 후 확인
vagrant ssh k8s-m
kubectl version --short

linkerd 설치 : CLI Helm

# linkerd cli 설치
curl --proto '=https' --tlsv1.2 -sSfL <https://run.linkerd.io/install> | sh
export PATH=$PATH:/root/.linkerd2/bin
linkerd version # 버전 확인

# linkerd 설치 : install the control plane into the 'linkerd' namespace
linkerd install | kubectl apply -f -
kubectl get all,sa,cm,secret -n linkerd # 설치 확인

데모 앱 배포

# Emojivoto 라는 이모티콘 투표할수 있는 간단한 애플리케이션 배포
curl --proto '=https' --tlsv1.2 -sSfL <https://run.linkerd.io/emojivoto.yml> | kubectl apply -f -
kubectl get all,sa,cm,secret -n emojivoto # 배포 확인

# 배포된 파드 확인
kubectl get pod -n emojivoto
NAME                        READY   STATUS    RESTARTS   AGE
emoji-5dbdd567bd-qzpw2      1/1     Running   0          8m42s
vote-bot-58b4f5fdb7-sg8v4   1/1     Running   0          8m42s
voting-5fdcddcfc-zlsln      1/1     Running   0          8m42s
web-67c857998c-z75c9        1/1     Running   0          8m42s

# web-svc 를 NodePort 로 변경하고 웹 접속 확인
kubectl patch svc -n emojivoto web-svc -p '{"spec":{"type":"NodePort"}}'
kubectl get svc -n emojivoto web-svc -o jsonpath={.spec.ports[0].nodePort} | awk '{ print "App URL = <http://192.168.10.10>:"$1 }'
App URL = <http://192.168.10.10:30444> # 출력 URL 로 웹 접속

Untitled

Linkerd inject

# 파드에 linkerd inject 실행
kubectl get -n emojivoto deploy -o yaml | linkerd inject - | kubectl apply -f -

# 확인
kubectl get pod -n emojivoto
NAME                        READY   STATUS        RESTARTS   AGE
emoji-55c59cf485-s8pxs      **2/2**     Running       0          34s
vote-bot-57d4c898bb-nlkgj   **2/2**     Running       0          34s
voting-87469d4bb-wcs2l      **2/2**     Running       0          34s
web-847cbcb586-ltzsc        **2/2**     Running       0          34s

# web 파드 상세 확인 : 사이드카 컨테이너(linkerd-proxy) 확인
kubectl describe $(kubectl get pod -n emojivoto -oname -l app=web-svc) -n emojivoto
...
Init Containers:
  linkerd-init:
    Image:         cr.l5d.io/linkerd/proxy-init:v1.4.0
  ...
Containers:
  **linkerd-proxy**:
    Image:          cr.l5d.io/linkerd/proxy:stable-2.11.1
  ...
  **web-svc**:
    Image:          docker.l5d.io/buoyantio/emojivoto-web:v11
  ...

# 로그 모니터링
kubetail -l app=web-svc -n emojivoto

Linkerd extension 설치 : 대시보드 웹 접속 - 링크

# To install the viz extension, install the on-cluster metrics stack
linkerd viz install --set-string dashboard.enforcedHostRegexp="." | kubectl apply -f -
kubectl get all,sa,cm,secret -n linkerd-viz # 설치 확인

# viz stat 확인 : 요청 성공률, RPS, 지연 등
linkerd viz stat deployments -n emojivoto
NAME       MESHED   SUCCESS      RPS   LATENCY_P50   LATENCY_P95   LATENCY_P99   TCP_CONN
emoji         1/1   100.00%   2.3rps           1ms           1ms           1ms          3
vote-bot      1/1   100.00%   0.3rps           1ms           1ms           1ms          1
voting        1/1    93.51%   1.3rps           1ms           1ms           1ms          3
web           1/1    96.32%   2.3rps           2ms           3ms           4ms          3

# 대시보드 접속을 위한 포트 설정
linkerd viz dashboard --address 192.168.10.10 --port 80
Linkerd dashboard available at:
<http://192.168.10.10:80>
Grafana dashboard available at:
<http://192.168.10.10:80/grafana>
Opening Linkerd dashboard in the default browser
Failed to open Linkerd dashboard automatically
Visit <http://192.168.10.10:80> in your browser to view the dashboard

# 삭제
~~linkerd viz install | kubectl delete -f - # Linkerd extension 삭제~~
curl --proto '=https' --tlsv1.2 -sSfL <https://run.linkerd.io/emojivoto.yml> | kubectl delete -f - # 애플리케이션 삭제

Untitled

Untitled