SlideShare a Scribd company logo
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
Service Mesh
Red Hat
25%
Mirantis
10%
IBM
8%
Rackspace…
*independent…
HP
6%
Huawei
4%
NEC
3%
SUSE
3%
Intel
3%
HPE
3%
VMware
2%
AT&T
2%
Google
48%
*independent
19%
Red
Hat
19%
Huawei
4%
Microsoft
2%
VMware
2%
IBM
1%
Intel
1%
Service Mesh
5
Foundation
시작
Service Mesh CNCF
Landscape: landscape.cncf.io/
Service Mesh
7
Trail Map: l.cncf.io
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
Service Mesh
9
• 일반적인 서비스들이 제공해야하는 서비스 검색,로드 밸런싱,
장애 복구, 메트릭 및 모니터링을 서비스 코드의 변경없이 유기
적으로 생성/결합하는 서비스 필요
• 추가적으로 속도제한 / 액세스제어 / 종단인증등의 연계된 서비
스를 관리/제어하는 기능이 필요
전 세계적으로 가장 큰 마이크로 서비스 응용 프로그램 중 하나를 작업 한 결과, 마이크로 서비
스는 확장이나 유연성, 보안 또는 신뢰성이 마법같이 이루어지는 것이 아니라는 것입니다.
실제, 모놀리식 제품보다 작동하기가 훨씬 어렵습니다.
구성 관리, 로그 처리, strace, tcpdump 등 우리가 익숙하고 익숙한 도구는 마이크로 서비스
에 적용 할 때 적용 불가능한 도구입니다.
한 번의 요청으로 수 백 개의 인스턴스가 있는 수백 개의 서비스에 액세스 할 수 있는 세상에서
tcpdump를 어디에서 실행할 수 있습니까? 어떤 로그를 읽습니까? 느린 경우 어떻게 그 이유
를 알아낼 수 있습니까?
이것이 새로운 기능인 Service Mesh 를 탄생시킨 이유입니다.
정의
• 애플리케이션을 독립적으로 배포가능한 환경으로 변경
• 가볍고, 다른 언어일수 있고, 다양한 팀에서 관리되는 경향
• 서비스 수가 증가하고, 관리가 어려워짐
• 더 이상 서비스가 단순화 되지 않음
• 보안 /네트워크 트래픽 제어/서비스 모니터에 대한 요건 증가
Service Mesh
출처: https://developers.redhat.com/books/introducing-istio-service-mesh-microservices
구현방법
10
Service Mesh 구현기능
핵심 구현 기능
연결
서비스가 서로를 검색하고 대화
지능형 라우팅을 통해 서비스 / 엔드 포인트 간의 트래픽 및 API 호출 흐름을 제어
블루 / 그린, 카나리아 또는 롤링 업그레이드 등과 같은 배포 전략 구현 가능
“분산 마이크로 서비스의 전체 네트워크 동작에
대한 운영 제어 및 관찰 가능성을 제공"
보안
서비스 간의 보안 통신
통신을 허용하거나 거부하는 정책 수행 가능
모니터
분산 된 마이크로 서비스 시스템을 모니터
모니터링 및 추적 도구와 즉시 통합되어 서비스, 트래픽 흐름, API 지연 시간 및
추적 간의 종속성을 검색하고 시각화 함
정책 적용
서비스 간의 상호작용에 조직 정책/액세스 정책을 정의하고, 리소스의 분산을
관리함
정책변경을 매시를 통해서 구현함
필요성
제공기능
실현내용
• Service Discovery
• Load Balancing
• Dynamic Request Routing
• Circuit Breaking
• Retry and Timeout
• TLS
• Distributed Tracing
• metrics 수집
마이크로 서비스 확산 확산/배포 시
• 확장을 위한 핵심
• 서비스 통신을
안전하고 안정적으로
만들어야 하는 요청
제공기능
• 라우팅 규칙 추적
• 트래픽 경로 지시
• 패키지 경로 지시
• 가속화 및 수신 보장
연결
보안
모니터
정책
One Team 방식의 효율적 대응체계
• 개발자들이 서비스를 연결하는 대신 비즈니스 가치를 추가하는 일에
집중가능 .
• 분산된 요청 추적은 서비스와 함께 가시적인 인프라 계층을
형성하므로 문제를 손쉽게 인식하고 진단
• Service Mesh 는 장애가 발생한 서비스로부터 요청을 재 라우팅할
수 있기 때문에 다운타임 발생 시 애플리케이션 복구 능력이 향상
11
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
Service Mesh
13
종류
Service Mesh
Istio | 내부 Architecture Istio | 상세 설명
Istio
Lyft에서 처음 출시 한 Kubernetes 네이티브 솔루션이며 IBM, 구
글과 Lyft 후원인 오픈 플랫폼
•트래픽 관리 : 지능형 트래픽 라우팅 규칙, 흐름 제어 및 회로 차
단기, 시간 초과 및 재시도와 같은 서비스 수준 속성 관리. 이를 통
해 A / B 테스트, 카나리아 출시, 백분율 기반 트래픽 분할로 단계
적 출시를 쉽게 설정할 수있었습니다.
•보안 : 서비스 간의 안전한 통신 채널을 제공하고 인증, 권한 부
여 및 암호화를 대규모로 관리합니다.
•관찰 가능성 : 강력한 추적, 모니터링 및 로깅 기능은 깊은 통찰
력과 가시성을 제공합니다. 효율적인 문제 감지 및 해결에 도움이
됩니다. Istio에는 마이크로 서비스 모니터링을 지원하는 추가 인
프라 서비스도 있습니다.
Envoy 프록시는 plane끼리 상호 작용하는 유일한 Istio 구성 요소
Lyft가 C ++ 언어로 작성한 고성능 프록시로, 서비스 메시의 모든
서비스에 대한 모든 인바운드 및 아웃 바운드 트래픽을 중재
• Dynamic service discovery
• Load balancing
• TLS termination
• HTTP/2 and gRPC proxies
• Circuit breakers
• Health checks
• Staged rollouts with percentage-basedtraffic split
• Fault injection
• Rich metrics
• Istiod는 서비스 검색, 구성 및 인증서 관리를 제공
1. input yaml detected by galley
2. configuration converted to Istio format
3. Istio format passed to pilot
4. pilot convert it to envoy configuration
• Pilot – 사이드카 프록시, 트래픽 관리 기능 및 복원
• citadel - 서비스 및 최종 사용자 인증을 지원
• Galley - Istio 구성 유효성 검사, 수집, 처리 및 배포 구성 요소
• Kiali - Istio Dashboard
• Jaeger - tracing
• Prometheus + Grafana - metrics
• Entity - Virtual Service / Destination Rule
Gateway
• Canary Releases / Circuit Breakers
• 데이터 플레인은 사이드카 인 프록시 (엔보이)로 구성.
이러한 프록시는 마이크로 서비스 간의 모든 네트워크 통신을 중재 및
제어하고 모든 메시 트래픽에 대한 원격 분석을 수집.
• 컨트롤 플레인은 트래픽을 라우팅하도록 프록시를 구성/관리
Service Mesh
linkerd | 내부 Architecture linkerd | 상세 설명
linkerd
Buoyant의 Kubernetes 용으로 설계된 오픈 소스 경량 서비스 메시
Linkerd는 쿠버네티스용 Service Mesh이며, 코드를 변경할 필요없
이 런타임 디버깅, 관찰 가능성, 안정성 및 보안을 제공하여 서비스
를 보다 쉽고 안전하게 실행할 수 있음. (proxy는 rust로 작성)
UI, 데이터 플레인 및 컨트롤 플레인의 세 가지 구성 요소
Service mesh용으로 만들어진 보안이 강화된 초경량 proxy
• HTTP, HTTP / 2 및 임의 TCP 프로토콜을 위한 쉽고, 간단한
proxy
• HTTP 및 TCP 트래픽에 대한 자동 Prometheus 메트릭 전달
• 쉽고, 간단한 WebSocket 프록시.
• 대기 시간을 인식하는 자동 레이어 7로드 밸런싱.
• HTTP가 아닌 트래픽을 위한 layer-4 자동 부하 분산.
• 자동 TLS.
• On-demand 진단 TAP API.
• 데이터 플레인의 각 프록시 는 이 구성 요소를 사용하여 요청을
보낼 위치를 조회합니다. 경로 별 메트릭, 재시도 및 timeout등
을 위한 서비스 프로파일로 구성
• 이 구성 요소는 프록시에서 CSR 을 수락 하고 올바른 ID로 서명
된 인증서를 반환 하는 인증 기관 을 제공합니다 . Linkerd 프록
시 간의 연결에 사용되어 mTLS를 구현합니다.
• 인젝터는 포드가 생성 될 때마다 웹훅 요청을 수신 하는 승인 컨
트롤러 입니다.
• 새 서비스 프로필 을 저장하기 전에 유효성을 검사 하는 승인 컨
트롤러 .
• CLI 및 대시 보드에서 요청을 수신하여 요청과 응답을 실시간으
로 확인하여 애플리케이션에서 관찰 가능성을 제공
Service Mesh 솔루션비교
✓ Rate limiting - 초당 request thresholds를 구성하고, 예측 불가능한 트래픽이나 공격에 대한 방어
✓ Circuit Breaking - Connection Max & Pending 수에 따른 circuit break / Load balancing pool의 인스턴스의 상태에 기반하는 circuit break
Service Mesh
17
출처: https://linkerd.io/2019/05/18/linkerd-benchmarks/
Linkerd 2.3-edge-19.5.2 vs Istio 1.1.6
https://kinvolk.io/blog/2019/05/performance-
benchmark-analysis-of-istio-and-linkerd/
Service Mesh
18
출처: https://linkerd.io/2019/05/18/linkerd-benchmarks/
Service Mesh
19
출처: https://linkerd.io/2019/05/18/linkerd-benchmarks/
단위 : milicore = 1/1000 core
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
Service Mesh
NAME READY STATUS RESTARTS AGE
grafana-7f6cd4bf56-f7hr4 1/1 Running 0 1m
istio-citadel-7dd558dcf-dxqv4 1/1 Running 0 1m
istio-cleanup-secrets-xtd8v 0/1 Completed 0 1m
istio-egressgateway-88887488d-xnfsn 1/1 Running 0 1m
istio-galley-787758f7b8-762nb 1/1 Running 0 1m
istio-grafana-post-install-pnvsc 0/1 Completed 0 1m
istio-ingressgateway-58c77897cc-lw7j5 1/1 Running 0 1m
istio-pilot-86cd68f5d9-r4jqh 2/2 Running 0 1m
istio-policy-56c4579578-2xvhj 2/2 Running 0 1m
istio-security-post-install-5jgkj 0/1 Completed 0 1m
istio-sidecar-injector-d7f98d9cb-rrp9l 1/1 Running 0 1m
istio-telemetry-7fb48dc68b-6g2sv 2/2 Running 0 1m
istio-tracing-7596597bd7-tnxcg 1/1 Running 0 1m
prometheus-76db5fddd5-db5jl 1/1 Running 0 1m
servicegraph-56dddff777-8bh9c 0/1 Running 1 1m
Kubectl get pods –n istio-system
Version: 1.0.5
GitRevision: c1707e45e71c75d74bf3a5dec8c7086f32f32fad
User: root@6f6ea1061f2b
Hub: docker.io/istio
GolangVersion: go1.10.4
BuildStatus: Clean
istioctl version 고객사 서비스는 고객선호도를 조사해서 이를 추천항목에 넣는 서비스임
Istio구성
Service Mesh
[INFO] Scanning for projects...
[INFO] ----------------< com.redhat.developer.demos:customer >-----------------
[INFO] Building customer 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ customer ---
[INFO] Building jar: /root/projects/istio-
tutorial/customer/java/springboot/target/customer.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.8.RELEASE:repackage (default) @ customer ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.337 s
[INFO] Finished at: 2021-05-16T01:04:25Z
[INFO] ------------------------------------------------------------------------
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ customer ---
[INFO] Building jar: /root/projects/istio-
tutorial/customer/java/springboot/target/customer.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.8.RELEASE:repackage (default) @ customer ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.337 s
[INFO] Finished at: 2021-05-16T01:04:25Z
[INFO] ------------------------------------------------------------------------
Springboot - mvn package
FROM fabric8/java-jboss-openjdk8-jdk:1.5.2
ENV JAVA_APP_DIR=/deployments
ENV JAEGER_SERVICE_NAME=customer
JAEGER_ENDPOINT=http://jaeger-collector.istio-system.svc:14268/api/traces
JAEGER_PROPAGATION=b3
JAEGER_SAMPLER_TYPE=const
JAEGER_SAMPLER_PARAM=1
EXPOSE 8080 8778 9779
COPY target/customer.jar /deployments/
Create Docker image
Sending build context to Docker daemon 23.29 MB
Step 1/5 : FROM fabric8/java-jboss-openjdk8-jdk:1.5.2
---> 2d81027cb149
Step 2/5 : ENV JAVA_APP_DIR /deployments
---> 46fc95691e7a
Step 3/5 : ENV JAEGER_SERVICE_NAME customer JAEGER_ENDPOINT http://jaeger-
collector.istio-system.svc:14268/api/traces JAEGER_PROPAGATION b3
JAEGER_SAMPLER_TYPE const JAEGER_SAMPLER_PARAM 1
---> 518b64a43cc9
Step 4/5 : EXPOSE 8080 8778 9779
---> 0000990f2810
Step 5/5 : COPY target/customer.jar /deployments/
---> 57d20b60ca5b
Successfully built 57d20b60ca5b
Docker build
Istio구성
Service Mesh
/root/installation/istio-1.0.5/bin/istioctl kube-inject -f /root/projects/istio-
tutorial/customer/kubernetes/Deployment.yml | kubectl apply -n tutorial -f -
$ cat kubernetes/Deployment.yml
---
apiVersion: "v1"
kind: "ServiceAccount"
metadata:
name: "customer"
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: customer
version: v1
name: customer
spec:
replicas: 1
selector:
matchLabels:
app: customer
version: v1
template:
metadata:
labels:
app: customer
version: v1
annotations:
sidecar.istio.io/inject: "true"
사이드카 프록시를 삽입
NAME READY STATUS RESTARTS AGE
pod/customer-6d49bb8ffc-6dt8m 1/1 Running 0 3m
pod/preference-v1-d86f66d76-nbxxv 1/1 Running 0 7m
pod/recommendation-v1-5f9b4d8fcf-4wbnx 1/1 Running 0 8m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/customer ClusterIP 172.30.248.116 <none> 8080/TCP 36m
service/preference ClusterIP 172.30.139.105 <none> 8080/TCP 11m
service/recommendation ClusterIP 172.30.115.139 <none> 8080/TCP 4m
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
deployment.apps/customer 1 1 1 1 13m
deployment.apps/preference-v1 1 1 1 1 11m
deployment.apps/recommendation-v1 1 1 0 1 9m
NAME DESIRED CURRENT READY AGE
replicaset.apps/customer-6d49bb8ffc 1 1 1 3m
replicaset.apps/customer-77cc64968b 0 0 0 13m
replicaset.apps/preference-v1-59fcbbdcd9 0 0 0 11m
replicaset.apps/preference-v1-d86f66d76 1 1 1 7m
replicaset.apps/recommendation-v1-5f9b4d8fcf 1 1 1 8m
replicaset.apps/recommendation-v1-8589878566 1 0 0 9m
서비스 구현 완료
Istio구성
Service Mesh
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: recommendation
spec:
hosts:
- recommendation
http:
- route:
- destination:
host: recommendation
subset: version-v1
weight: 90
- destination:
host: recommendation
subset: version-v2
weight: 10
---
카나리 배포
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: recommendation
spec:
hosts:
- recommendation
http:
- match:
- headers:
baggage-user-agent:
regex: .*Safari.*
route:
- destination:
host: recommendation
subset: version-v2
- route:
- destination:
host: recommendation
subset: version-v1
---
사용자 에이전트 헤더를 기반으로 한 스마트 라우팅
- route:
- destination:
host: recommendation
subset: version-v1
weight: 50
- destination:
host: recommendation
subset: version-v2
weight: 50
---
VirtualService는 정규표현식(regex)인 .*Safari.* 의 값을 가지는 baggage header
(baggage-user-agent)의 http 중에서 version=v2 로 라벨을 포함하는 subset:version-
v2 로만 라우팅 됨
Istio구성
Service Mesh
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: recommendation
spec:
host: recommendation
trafficPolicy:
loadBalancer:
simple: RANDOM
LaodBalancer
apiVersion: "config.istio.io/v1alpha2"
kind: memquota
metadata:
name: handler
spec:
quotas:
- name: requestcount.quota.istio-system
# default rate limit is 5000qps
maxAmount: 5000
validDuration: 1s
# The first matching override is applied.
# A requestcount instance is checked against override dimensions.
overrides:
- dimensions:
destination: recommendation
destinationVersion: v2
source: preference
maxAmount: 1
validDuration: 1s
속도제한
customer => preference => recommendation v1 from '99634814-d2z2t': 1145
customer => preference => recommendation v2 from '2819441432-525lh': 1
customer => preference => recommendation v2 from '2819441432-rg45q': 2
customer => preference => recommendation v2 from '2819441432-bs5ck': 181
customer => preference => recommendation v1 from '99634814-d2z2t': 1146
customer => preference => recommendation v2 from '2819441432-rg45q': 3
customer => preference => recommendation v2 from '2819441432-rg45q': 4
customer => preference => recommendation v2 from '2819441432-bs5ck': 182
customer => preference => recommendation v2 from '2819441432-f4ls5': 108
customer => preference => recommendation v1 from '99634814-d2z2t': 1932
customer => preference => recommendation v2 from '2819441432-f4ls5': 109
customer => preference => recommendation v1 from '99634814-d2z2t': 1933
customer => 503 preference => 429 Too Many Requests
customer => preference => recommendation v1 from '99634814-d2z2t': 1934
customer => preference => recommendation v2 from '2819441432-f4ls5': 110
customer => preference => recommendation v1 from '99634814-d2z2t': 1935
customer => 503 preference => 429 Too Many Requests
Istio구성
Service Mesh
http:
- fault:
abort:
httpStatus: 503
percent: 50
route:
- destination:
host: recommendation
subset: app-recommendation
---
HTTP 오류 503
http:
- fault:
delay:
fixedDelay: 7.000s
percent: 50
route:
- destination:
host: recommendation
subset: app-recommendation
---
Delay에 대한 제한
503이 50%이상 나면 abort요청 VirtualServices는 http Fault를 제공한다. fixedDelay=7s. 50% of the time의 경우 작동
- route:
- destination:
host: recommendation
retries:
attempts: 3
perTryTimeout: 2s
Retry
http:
- route:
- destination:
host: recommendation
timeout: 1.000s
Timeout
503이 50%이상나면 abort요청
VirtualService timeout의 1 second 제공
Istio구성
Service Mesh
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: recommendation
spec:
host: recommendation
subsets:
- name: version-v2
labels:
version: v2
trafficPolicy:
connectionPool:
http:
http1MaxPendingRequests: 1
maxRequestsPerConnection: 1
tcp:
maxConnections: 1
outlierDetection:
baseEjectionTime: 120.000s
consecutiveErrors: 1
interval: 1.000s
maxEjectionPercent: 100
Circuit Breaker
name: recommendation
spec:
host: recommendation
subsets:
- labels:
version: v1
name: version-v1
trafficPolicy:
connectionPool:
http: {}
tcp: {}
loadBalancer:
simple: RANDOM
outlierDetection:
baseEjectionTime: 15.000s
consecutiveErrors: 1
interval: 5.000s
maxEjectionPercent: 100
- labels:
version: v2
name: version-v2
trafficPolicy:
connectionPool:
http: {}
tcp: {}
loadBalancer:
simple: RANDOM
outlierDetection:
baseEjectionTime: 15.000s
consecutiveErrors: 1
interval: 5.000s
maxEjectionPercent: 100
Pool ejection
풀 제거 또는 이상 값 감지 (outlier detection)는 클라이언트 요청을 처리 할 인스턴스 /
포드 풀이있을 때마다 발생하는 탄력적 회복 전략
Connection pool에 요청사항에 따라서 1초마다 체크해서, 한번이라도 에러가 발생하면,
120초 동안 서비스에서 배제(circuit breaking) 시킴
→ [503 Service Unavailable] error 발생시킴
Istio구성
Service Mesh
Ultimate resilience with retries, circuit breaker, and pool ejection
name: recommendation
spec:
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: recommendation
spec:
host: recommendation
subsets:
- name: version-v1
labels:
version: v1
- name: version-v2
labels:
version: v2
trafficPolicy:
connectionPool:
http:
http1MaxPendingRequests: 1
maxRequestsPerConnection: 1
tcp:
maxConnections: 1
outlierDetection:
baseEjectionTime: 120.000s
consecutiveErrors: 1
interval: 1.000s
maxEjectionPercent: 100
• 인스턴스에 대한 여러 동시 요청을 방지하는 회로 차단기
• 인스턴스를 응답의 풀을 이용하여, 실패하는 인스턴스 pool rejection
• 개방 회로 차단기 및 / 또는 풀 방출이 발생하는 경우를 대비하여 요청을 다른
인스턴스로 전달하기 위해 재 시도
mTLS
apiVersion: "authentication.istio.io/v1alpha1"
kind: "Policy"
metadata:
name: "default"
spec:
peers:
- mtls: {}
-------------------
apiVersion: "networking.istio.io/v1alpha3"
kind: "DestinationRule"
metadata:
name: "default"
spec:
host: "*.tutorial.svc.cluster.local"
trafficPolicy:
tls:
mode: ISTIO_MUTUAL
• host: 0192.168.64.70:31380 user-agent: curl/7.54.0 accept: */* x-forwarded-for:
172.17.0.1 x-forwarded-proto: http x-envoy-internal: true x-request-id: e5c0b90f-
341b-9edc-ac3e-7dd8b33f0e8b x-envoy-decorator-operation:
customer.tutorial.svc.cluster.local:8080/ x-b3-traceid: ce289e960a639d11 x-b3-
spanid: ce289e960a639d11 x-b3-sampled: 1
• 14:24:55.078222 IP (tos 0x0, ttl 64, id 32578, offset 0, flags [DF], proto TCP (6),
length 967) 172.17.0.15.33260 > customer-7dcd544ff9-652ds.8080: Flags [P.],
cksum 0x5bf5 (incorrect -> 0x595e), seq 2211080917:2211081832, ack
2232186801, win 391, options [nop,nop,TS val 5958433 ecr 5779275], length 915:
HTTP E....B@.@._........ ......j...w.....[......
Istio구성
Service Mesh
Kiali
• 전체서비스관찰가능
• 네임스페이스별pod내용
확인가능
• 각각의traffic확인가능
Istio구성
Service Mesh
Kiali-2
Kiali-1
• Namespace내에서비스
연결점확인
• 전체성공률과에러코드넘
버제공
• http/tcp전체서비스
traffic제공
• Pod간서비스시간확인
가능
• 상세세부버전에대한
graph제공
Kiali-3
• 에러코드에대한실시간화
면표시
• 서비스코드별색상표시
로가독성높은아웃풋제
공
Istio구성
Service Mesh
Kiali-2
Kiali-1
• Metric에대한서비스데이
터정보
• 서비스time에대한정보
와그pod정보
• 상세정보를들어가서,배
포후버전에따른응답시
간확인가능
Kiali-3
• 서비스상세내용에대한
duration
• 시간별비교맵제공
• 색깔별로response 상태
확인
Istio구성
Kiali-4
• 애플리케이션request
volume&duration&size
정보전달
Service Mesh
Grafana –2
Grafana –1
• 전체요청에대한응답시간
• 서비스latency
• 성공률
• 전체요청에대한백분율
• 서비스워크로드
Istio구성
Service Mesh
istioctl create -f istiofiles/recommendation_requestcount.yml -n istio-system
apiVersion: "config.istio.io/v1alpha2"
kind: metric
metadata:
name: recommendationrequestcount
spec:
value: "1"
dimensions:
user_agent: request.headers["user-agent"] | "unknown"
monitored_resource_type: '"UNSPECIFIED"'
---
apiVersion: "config.istio.io/v1alpha2"
kind: prometheus
metadata:
name: recommendationrequestcounthandler
spec:
metrics:
- name: recommendation_request_count
instance_name: recommendationrequestcount.metric.istio-system
kind: COUNTER
---
apiVersion: "config.istio.io/v1alpha2"
kind: rule
metadata:
name: recommendationrequestcountprom
spec:
match: destination.service == "recommendation.tutorial.svc.cluster.local"
actions:
- handler: recommendationrequestcounthandler.prometheus
instances:
- recommendationrequestcount.metric
사용자 지정 메트릭
Prometheus-1
• Recommend에대한
전체요청수에대한정보
Istio구성
Service Mesh
Jaeger-1
• 전체서비스에대한trace
정보제공
Istio구성
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
Service Mesh
NAME READY STATUS RESTARTS AGE
linkerd-controller-68fdf874c-p458b 0/2 PodInitializing 0 80s
linkerd-destination-db79d6d8f-sw7x7 0/2 PodInitializing 0 80s
linkerd-identity-5bc6c6c894-2bnkz 0/2 PodInitializing 0 80s
linkerd-proxy-injector-55bcb8fd99-dht7p 0/2 Running 0 80s
linkerd-sp-validator-56bf5b5896-22gbf 0/2 PodInitializing 0 80s
Kubectl get pods –n linkerd -l linkerd.io/control-plane-ns=linkerd
Linkerd stable-2.10.1 was successfully installed 🎉
linkerd version
linkerd구성
Service Mesh
37
kubectl get -n emojivoto deploy -o yaml | linkerd inject - | kubectl apply -f -
linkerd구성
Service Mesh linkerd구성
Service Mesh linkerd구성
Service Mesh linkerd구성
Service Mesh
cat <<EOF | kubectl apply -f -
apiVersion: flagger.app/v1beta1
kind: Canary
metadata:
name: podinfo
namespace: test
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: podinfo
service:
port: 9898
analysis:
interval: 10s
threshold: 5
stepWeight: 10
maxWeight: 100
metrics:
- name: request-success-rate
thresholdRange:
min: 99
interval: 1m
- name: request-duration
thresholdRange:
max: 500
interval: 1m
EOF
카나리 배포
linkerd구성
Service Mesh
spec:
routes:
- name: GET /api/annotations
condition:
method: GET
pathRegex: /api/annotations
isRetryable: true ### ADD THIS LINE ###
Retry
spec:
routes:
- condition:
method: HEAD
pathRegex: /authors/[^/]*.json
name: HEAD /authors/{id}.json
timeout: 300ms
Timeout
linkerd구성
Service Mesh
kubectl -n emojivoto set env --all deploy OC_AGENT_HOST=collector.linkerd-jaeger:55678
linkerd구성
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
Service Mesh
Linkerd mutlti-cluster | 내부 Architecture Multi-cluster | 상세 설명
Multi-cluster
• 통합 도메인의 신뢰성 - 클러스터 경계간의 통신
• 장애 도메인 분리 – 장애시 격리필요
• 이기종 네트워크 지원 - clouds/VPC/on-premises
datacenter간의 네트워크 통신지원
• 통합된 클러스터 간 통신 – 클러스터간 통신과 같은
observability, reliability, and security features가 요구
됨
• 클러스터간에 서비스 정보를 "미러링"하여 작동
• 서비스 미러 와 게이트웨이 라는 두 가지 구성 요소로 구현
1. 공유 신뢰 앵커를 사용하여 두 개의 클러스터에 Linkerd 를 설치
2. 클러스터를 준비
3. 클러스터를 연결
4. 데모를 설치
5. 가시성을 제어하려면 데모 서비스를 export
6. 클러스터의 보안을 확인
7. 소스 클러스터 ( west) 의 Pod 에서 대상 클러스터 ( east)로 트
래픽 분할
• Requirement I: Support Hierarchical Networks
• Requirement II: Maintain Independent State
• Requirement III: Have an Independent Control
Plane
• linkerd --context=east multicluster link --cluster-
name east | kubectl --context=west apply -f -
Service Mesh
cat <<EOF | kubectl --context=west apply -f -
apiVersion: split.smi-spec.io/v1alpha1
kind: TrafficSplit
metadata:
name: podinfo
namespace: test
spec:
service: podinfo
backends:
- service: podinfo
weight: 50
- service: podinfo-east
weight: 50
EOF
Traffic split
Multi-cluster
Grafana –1
• 양쪽노드를모두모니터링
가능
• 수요량을직접적으로확인
가능
T. 02-516-0711 E. sales@osci.kr
서울시강남구테헤란로83길32,5층(삼성동,나라키움삼성동A빌딩)
THANK YOU

More Related Content

PDF
마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017
PDF
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20
PDF
모두의 쿠버네티스 (Kubernetes for everyone)
PPTX
MSA ( Microservices Architecture ) 발표 자료 다운로드
PDF
금융 회사를 위한 클라우드 이용 가이드 – 신은수 AWS 솔루션즈 아키텍트, 김호영 AWS 정책협력 담당:: AWS Cloud Week ...
PPTX
Spring Boot
PPSX
Docker Kubernetes Istio
PDF
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20
모두의 쿠버네티스 (Kubernetes for everyone)
MSA ( Microservices Architecture ) 발표 자료 다운로드
금융 회사를 위한 클라우드 이용 가이드 – 신은수 AWS 솔루션즈 아키텍트, 김호영 AWS 정책협력 담당:: AWS Cloud Week ...
Spring Boot
Docker Kubernetes Istio
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개

What's hot (20)

PPTX
Comprehensive Terraform Training
PDF
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
PDF
대용량 데이터베이스의 클라우드 네이티브 DB로 전환 시 확인해야 하는 체크 포인트-김지훈, AWS Database Specialist SA...
PDF
Microservices with Java, Spring Boot and Spring Cloud
PDF
AWS로 게임의 공통 기능 개발하기! - 채민관, 김민석, 한준식 :: AWS Game Master 온라인 세미나 #2
PDF
AWS Fargate on EKS 실전 사용하기
PPTX
ECS+Locust로 부하 테스트 진행하기
PPTX
Kubernetes for Beginners: An Introductory Guide
PPTX
PDF
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
PDF
[AWS Builders] AWS상의 보안 위협 탐지 및 대응
PPTX
Kubernetes
PDF
AWS를 이용한 렌더링 아키텍처 및 사용 사례 :: 박철수 솔루션즈 아키텍트 :: AWS Media Day
PDF
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
PPTX
Introduction to microservices
PPTX
Grafana.pptx
ODP
Istio
PDF
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
PDF
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
PDF
DevOps for beginners
Comprehensive Terraform Training
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
대용량 데이터베이스의 클라우드 네이티브 DB로 전환 시 확인해야 하는 체크 포인트-김지훈, AWS Database Specialist SA...
Microservices with Java, Spring Boot and Spring Cloud
AWS로 게임의 공통 기능 개발하기! - 채민관, 김민석, 한준식 :: AWS Game Master 온라인 세미나 #2
AWS Fargate on EKS 실전 사용하기
ECS+Locust로 부하 테스트 진행하기
Kubernetes for Beginners: An Introductory Guide
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
[AWS Builders] AWS상의 보안 위협 탐지 및 대응
Kubernetes
AWS를 이용한 렌더링 아키텍처 및 사용 사례 :: 박철수 솔루션즈 아키텍트 :: AWS Media Day
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
Introduction to microservices
Grafana.pptx
Istio
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
DevOps for beginners
Ad

Similar to [오픈소스컨설팅] 서비스 메쉬(Service mesh) (20)

PPTX
ISTIO Deep Dive
PDF
Istio Triangle Kubernetes Meetup Aug 2019
PPTX
Service Mesh CTO Forum (Draft 3)
PPTX
Cloud computing and innovations
PPTX
PPTX
SHARE 2015 SeattleShare cics ts 52 technical overview
PDF
Service mesh on Kubernetes - Istio 101
PPT
S102 cics the future is closer abridged
PDF
Service Mesh Talk for CTO Forum
PDF
Presentation ciac
PPTX
Cloud native microservices for systems and applications ieee rev2
PDF
Agile integration: Decomposing the monolith
PDF
Cisco Prime for IP NGN
PPTX
BandWise Presentation at IP Possibilities 2013
PDF
Open Source Networking Days- Service Mesh
PDF
F5 TMOS v13.0
PDF
Managing Microservices With The Istio Service Mesh on Kubernetes
PPTX
Hybrid Cloud example for SlideShare
PDF
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
ISTIO Deep Dive
Istio Triangle Kubernetes Meetup Aug 2019
Service Mesh CTO Forum (Draft 3)
Cloud computing and innovations
SHARE 2015 SeattleShare cics ts 52 technical overview
Service mesh on Kubernetes - Istio 101
S102 cics the future is closer abridged
Service Mesh Talk for CTO Forum
Presentation ciac
Cloud native microservices for systems and applications ieee rev2
Agile integration: Decomposing the monolith
Cisco Prime for IP NGN
BandWise Presentation at IP Possibilities 2013
Open Source Networking Days- Service Mesh
F5 TMOS v13.0
Managing Microservices With The Istio Service Mesh on Kubernetes
Hybrid Cloud example for SlideShare
[APIdays Paris 2019] API Management in Service Mesh Using Istio and WSO2 API ...
Ad

More from Open Source Consulting (20)

PDF
[Atlassian System of Work] 모든 협업을 연결하는 아틀라시안의 프레임워크
PDF
[Team on Tour 2025] Atlassian의 System of Work
PDF
Playce WASup | Apache/Tomcat은 그대로, 운영은 더 강력하게
PDF
Playce Cloud 소개자료 | 글로벌 표준과 로컬라이제이션을 위한 오픈소스 패키지
PDF
Good-bye Digital Transformation, Hello AI-first Transformation
PDF
[Recap] Atlassian Team25 - Progress is impossible alone
PDF
[오픈소스컨설팅] 오픈소스로 확장하는 NKP 기반 Kubernetes 환경
PDF
[오픈소스컨설팅] 먼데이닷컴 소개서
PDF
[Next-Gen ITSM | Atlassian이 제시하는 ITSM 혁신] 04. Rovo가 적용된 ITSM 시스템 ᄃ...
PDF
[Next-Gen ITSM | Atlassian이 제시하는 ITSM 혁신] 03. ITSM 구현과 고객 사례_신철ᄆ...
PDF
[Next-Gen ITSM | Atlassian이 제시하는 ITSM 혁신] 02. 클라우드 기반 ITSM 최적화를...
PDF
[Next-Gen ITSM | Atlassian이 제시하는 ITSM 혁신] 01. Gen Next ITSM_김윤희.pdf
PDF
[발표 자료] 시각화로 전략을 실현하는 스마트 워크플로우 with 먼데이닷컴.pdf
PDF
[The Future of IT] 1. AI 시대의 일하는 방법_김대일 고문
PDF
[The Future of IT] 2. 조직 목표 Align 및 전사 협업 확장_한진규 부사장
PDF
[The Future of IT] 3. AI 시대의 인프라_오픈소스를 활용한 인프라 구축 및 GPU as a Service 구현사례_김호진 상무
PDF
[발표자료] 오픈소스 기반 클라우드 네이티브 애플리케이션 구축 방안 (feat. Kubernetes)
PDF
[202412 SAFe Meetup] SAFe Transfomration Journey
PDF
[워크숍] Get to know AI, Meet your new teammate!
PDF
[웨비나 발표자료] VMware 정책 변화 대응 - 왜 오픈소스 기반 클라우드 네이티브 인프라로 가야하는가?
[Atlassian System of Work] 모든 협업을 연결하는 아틀라시안의 프레임워크
[Team on Tour 2025] Atlassian의 System of Work
Playce WASup | Apache/Tomcat은 그대로, 운영은 더 강력하게
Playce Cloud 소개자료 | 글로벌 표준과 로컬라이제이션을 위한 오픈소스 패키지
Good-bye Digital Transformation, Hello AI-first Transformation
[Recap] Atlassian Team25 - Progress is impossible alone
[오픈소스컨설팅] 오픈소스로 확장하는 NKP 기반 Kubernetes 환경
[오픈소스컨설팅] 먼데이닷컴 소개서
[Next-Gen ITSM | Atlassian이 제시하는 ITSM 혁신] 04. Rovo가 적용된 ITSM 시스템 ᄃ...
[Next-Gen ITSM | Atlassian이 제시하는 ITSM 혁신] 03. ITSM 구현과 고객 사례_신철ᄆ...
[Next-Gen ITSM | Atlassian이 제시하는 ITSM 혁신] 02. 클라우드 기반 ITSM 최적화를...
[Next-Gen ITSM | Atlassian이 제시하는 ITSM 혁신] 01. Gen Next ITSM_김윤희.pdf
[발표 자료] 시각화로 전략을 실현하는 스마트 워크플로우 with 먼데이닷컴.pdf
[The Future of IT] 1. AI 시대의 일하는 방법_김대일 고문
[The Future of IT] 2. 조직 목표 Align 및 전사 협업 확장_한진규 부사장
[The Future of IT] 3. AI 시대의 인프라_오픈소스를 활용한 인프라 구축 및 GPU as a Service 구현사례_김호진 상무
[발표자료] 오픈소스 기반 클라우드 네이티브 애플리케이션 구축 방안 (feat. Kubernetes)
[202412 SAFe Meetup] SAFe Transfomration Journey
[워크숍] Get to know AI, Meet your new teammate!
[웨비나 발표자료] VMware 정책 변화 대응 - 왜 오픈소스 기반 클라우드 네이티브 인프라로 가야하는가?

Recently uploaded (20)

PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Introduction to Artificial Intelligence
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
System and Network Administraation Chapter 3
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
history of c programming in notes for students .pptx
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
top salesforce developer skills in 2025.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
AI in Product Development-omnex systems
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
Operating system designcfffgfgggggggvggggggggg
Introduction to Artificial Intelligence
Online Work Permit System for Fast Permit Processing
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
System and Network Administraation Chapter 3
How Creative Agencies Leverage Project Management Software.pdf
history of c programming in notes for students .pptx
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
top salesforce developer skills in 2025.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Design an Analysis of Algorithms I-SECS-1021-03
VVF-Customer-Presentation2025-Ver1.9.pptx
Odoo Companies in India – Driving Business Transformation.pdf
Digital Strategies for Manufacturing Companies
AI in Product Development-omnex systems
ManageIQ - Sprint 268 Review - Slide Deck
Which alternative to Crystal Reports is best for small or large businesses.pdf
L1 - Introduction to python Backend.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle

[오픈소스컨설팅] 서비스 메쉬(Service mesh)

  • 6. Service Mesh CNCF Landscape: landscape.cncf.io/
  • 9. Service Mesh 9 • 일반적인 서비스들이 제공해야하는 서비스 검색,로드 밸런싱, 장애 복구, 메트릭 및 모니터링을 서비스 코드의 변경없이 유기 적으로 생성/결합하는 서비스 필요 • 추가적으로 속도제한 / 액세스제어 / 종단인증등의 연계된 서비 스를 관리/제어하는 기능이 필요 전 세계적으로 가장 큰 마이크로 서비스 응용 프로그램 중 하나를 작업 한 결과, 마이크로 서비 스는 확장이나 유연성, 보안 또는 신뢰성이 마법같이 이루어지는 것이 아니라는 것입니다. 실제, 모놀리식 제품보다 작동하기가 훨씬 어렵습니다. 구성 관리, 로그 처리, strace, tcpdump 등 우리가 익숙하고 익숙한 도구는 마이크로 서비스 에 적용 할 때 적용 불가능한 도구입니다. 한 번의 요청으로 수 백 개의 인스턴스가 있는 수백 개의 서비스에 액세스 할 수 있는 세상에서 tcpdump를 어디에서 실행할 수 있습니까? 어떤 로그를 읽습니까? 느린 경우 어떻게 그 이유 를 알아낼 수 있습니까? 이것이 새로운 기능인 Service Mesh 를 탄생시킨 이유입니다. 정의 • 애플리케이션을 독립적으로 배포가능한 환경으로 변경 • 가볍고, 다른 언어일수 있고, 다양한 팀에서 관리되는 경향 • 서비스 수가 증가하고, 관리가 어려워짐 • 더 이상 서비스가 단순화 되지 않음 • 보안 /네트워크 트래픽 제어/서비스 모니터에 대한 요건 증가
  • 11. Service Mesh 구현기능 핵심 구현 기능 연결 서비스가 서로를 검색하고 대화 지능형 라우팅을 통해 서비스 / 엔드 포인트 간의 트래픽 및 API 호출 흐름을 제어 블루 / 그린, 카나리아 또는 롤링 업그레이드 등과 같은 배포 전략 구현 가능 “분산 마이크로 서비스의 전체 네트워크 동작에 대한 운영 제어 및 관찰 가능성을 제공" 보안 서비스 간의 보안 통신 통신을 허용하거나 거부하는 정책 수행 가능 모니터 분산 된 마이크로 서비스 시스템을 모니터 모니터링 및 추적 도구와 즉시 통합되어 서비스, 트래픽 흐름, API 지연 시간 및 추적 간의 종속성을 검색하고 시각화 함 정책 적용 서비스 간의 상호작용에 조직 정책/액세스 정책을 정의하고, 리소스의 분산을 관리함 정책변경을 매시를 통해서 구현함 필요성 제공기능 실현내용 • Service Discovery • Load Balancing • Dynamic Request Routing • Circuit Breaking • Retry and Timeout • TLS • Distributed Tracing • metrics 수집 마이크로 서비스 확산 확산/배포 시 • 확장을 위한 핵심 • 서비스 통신을 안전하고 안정적으로 만들어야 하는 요청 제공기능 • 라우팅 규칙 추적 • 트래픽 경로 지시 • 패키지 경로 지시 • 가속화 및 수신 보장 연결 보안 모니터 정책 One Team 방식의 효율적 대응체계 • 개발자들이 서비스를 연결하는 대신 비즈니스 가치를 추가하는 일에 집중가능 . • 분산된 요청 추적은 서비스와 함께 가시적인 인프라 계층을 형성하므로 문제를 손쉽게 인식하고 진단 • Service Mesh 는 장애가 발생한 서비스로부터 요청을 재 라우팅할 수 있기 때문에 다운타임 발생 시 애플리케이션 복구 능력이 향상 11
  • 14. Service Mesh Istio | 내부 Architecture Istio | 상세 설명 Istio Lyft에서 처음 출시 한 Kubernetes 네이티브 솔루션이며 IBM, 구 글과 Lyft 후원인 오픈 플랫폼 •트래픽 관리 : 지능형 트래픽 라우팅 규칙, 흐름 제어 및 회로 차 단기, 시간 초과 및 재시도와 같은 서비스 수준 속성 관리. 이를 통 해 A / B 테스트, 카나리아 출시, 백분율 기반 트래픽 분할로 단계 적 출시를 쉽게 설정할 수있었습니다. •보안 : 서비스 간의 안전한 통신 채널을 제공하고 인증, 권한 부 여 및 암호화를 대규모로 관리합니다. •관찰 가능성 : 강력한 추적, 모니터링 및 로깅 기능은 깊은 통찰 력과 가시성을 제공합니다. 효율적인 문제 감지 및 해결에 도움이 됩니다. Istio에는 마이크로 서비스 모니터링을 지원하는 추가 인 프라 서비스도 있습니다. Envoy 프록시는 plane끼리 상호 작용하는 유일한 Istio 구성 요소 Lyft가 C ++ 언어로 작성한 고성능 프록시로, 서비스 메시의 모든 서비스에 대한 모든 인바운드 및 아웃 바운드 트래픽을 중재 • Dynamic service discovery • Load balancing • TLS termination • HTTP/2 and gRPC proxies • Circuit breakers • Health checks • Staged rollouts with percentage-basedtraffic split • Fault injection • Rich metrics • Istiod는 서비스 검색, 구성 및 인증서 관리를 제공 1. input yaml detected by galley 2. configuration converted to Istio format 3. Istio format passed to pilot 4. pilot convert it to envoy configuration • Pilot – 사이드카 프록시, 트래픽 관리 기능 및 복원 • citadel - 서비스 및 최종 사용자 인증을 지원 • Galley - Istio 구성 유효성 검사, 수집, 처리 및 배포 구성 요소 • Kiali - Istio Dashboard • Jaeger - tracing • Prometheus + Grafana - metrics • Entity - Virtual Service / Destination Rule Gateway • Canary Releases / Circuit Breakers • 데이터 플레인은 사이드카 인 프록시 (엔보이)로 구성. 이러한 프록시는 마이크로 서비스 간의 모든 네트워크 통신을 중재 및 제어하고 모든 메시 트래픽에 대한 원격 분석을 수집. • 컨트롤 플레인은 트래픽을 라우팅하도록 프록시를 구성/관리
  • 15. Service Mesh linkerd | 내부 Architecture linkerd | 상세 설명 linkerd Buoyant의 Kubernetes 용으로 설계된 오픈 소스 경량 서비스 메시 Linkerd는 쿠버네티스용 Service Mesh이며, 코드를 변경할 필요없 이 런타임 디버깅, 관찰 가능성, 안정성 및 보안을 제공하여 서비스 를 보다 쉽고 안전하게 실행할 수 있음. (proxy는 rust로 작성) UI, 데이터 플레인 및 컨트롤 플레인의 세 가지 구성 요소 Service mesh용으로 만들어진 보안이 강화된 초경량 proxy • HTTP, HTTP / 2 및 임의 TCP 프로토콜을 위한 쉽고, 간단한 proxy • HTTP 및 TCP 트래픽에 대한 자동 Prometheus 메트릭 전달 • 쉽고, 간단한 WebSocket 프록시. • 대기 시간을 인식하는 자동 레이어 7로드 밸런싱. • HTTP가 아닌 트래픽을 위한 layer-4 자동 부하 분산. • 자동 TLS. • On-demand 진단 TAP API. • 데이터 플레인의 각 프록시 는 이 구성 요소를 사용하여 요청을 보낼 위치를 조회합니다. 경로 별 메트릭, 재시도 및 timeout등 을 위한 서비스 프로파일로 구성 • 이 구성 요소는 프록시에서 CSR 을 수락 하고 올바른 ID로 서명 된 인증서를 반환 하는 인증 기관 을 제공합니다 . Linkerd 프록 시 간의 연결에 사용되어 mTLS를 구현합니다. • 인젝터는 포드가 생성 될 때마다 웹훅 요청을 수신 하는 승인 컨 트롤러 입니다. • 새 서비스 프로필 을 저장하기 전에 유효성을 검사 하는 승인 컨 트롤러 . • CLI 및 대시 보드에서 요청을 수신하여 요청과 응답을 실시간으 로 확인하여 애플리케이션에서 관찰 가능성을 제공
  • 16. Service Mesh 솔루션비교 ✓ Rate limiting - 초당 request thresholds를 구성하고, 예측 불가능한 트래픽이나 공격에 대한 방어 ✓ Circuit Breaking - Connection Max & Pending 수에 따른 circuit break / Load balancing pool의 인스턴스의 상태에 기반하는 circuit break
  • 17. Service Mesh 17 출처: https://linkerd.io/2019/05/18/linkerd-benchmarks/ Linkerd 2.3-edge-19.5.2 vs Istio 1.1.6 https://kinvolk.io/blog/2019/05/performance- benchmark-analysis-of-istio-and-linkerd/
  • 21. Service Mesh NAME READY STATUS RESTARTS AGE grafana-7f6cd4bf56-f7hr4 1/1 Running 0 1m istio-citadel-7dd558dcf-dxqv4 1/1 Running 0 1m istio-cleanup-secrets-xtd8v 0/1 Completed 0 1m istio-egressgateway-88887488d-xnfsn 1/1 Running 0 1m istio-galley-787758f7b8-762nb 1/1 Running 0 1m istio-grafana-post-install-pnvsc 0/1 Completed 0 1m istio-ingressgateway-58c77897cc-lw7j5 1/1 Running 0 1m istio-pilot-86cd68f5d9-r4jqh 2/2 Running 0 1m istio-policy-56c4579578-2xvhj 2/2 Running 0 1m istio-security-post-install-5jgkj 0/1 Completed 0 1m istio-sidecar-injector-d7f98d9cb-rrp9l 1/1 Running 0 1m istio-telemetry-7fb48dc68b-6g2sv 2/2 Running 0 1m istio-tracing-7596597bd7-tnxcg 1/1 Running 0 1m prometheus-76db5fddd5-db5jl 1/1 Running 0 1m servicegraph-56dddff777-8bh9c 0/1 Running 1 1m Kubectl get pods –n istio-system Version: 1.0.5 GitRevision: c1707e45e71c75d74bf3a5dec8c7086f32f32fad User: root@6f6ea1061f2b Hub: docker.io/istio GolangVersion: go1.10.4 BuildStatus: Clean istioctl version 고객사 서비스는 고객선호도를 조사해서 이를 추천항목에 넣는 서비스임 Istio구성
  • 22. Service Mesh [INFO] Scanning for projects... [INFO] ----------------< com.redhat.developer.demos:customer >----------------- [INFO] Building customer 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ customer --- [INFO] Building jar: /root/projects/istio- tutorial/customer/java/springboot/target/customer.jar [INFO] [INFO] --- spring-boot-maven-plugin:1.5.8.RELEASE:repackage (default) @ customer --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.337 s [INFO] Finished at: 2021-05-16T01:04:25Z [INFO] ------------------------------------------------------------------------ [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ customer --- [INFO] Building jar: /root/projects/istio- tutorial/customer/java/springboot/target/customer.jar [INFO] [INFO] --- spring-boot-maven-plugin:1.5.8.RELEASE:repackage (default) @ customer --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.337 s [INFO] Finished at: 2021-05-16T01:04:25Z [INFO] ------------------------------------------------------------------------ Springboot - mvn package FROM fabric8/java-jboss-openjdk8-jdk:1.5.2 ENV JAVA_APP_DIR=/deployments ENV JAEGER_SERVICE_NAME=customer JAEGER_ENDPOINT=http://jaeger-collector.istio-system.svc:14268/api/traces JAEGER_PROPAGATION=b3 JAEGER_SAMPLER_TYPE=const JAEGER_SAMPLER_PARAM=1 EXPOSE 8080 8778 9779 COPY target/customer.jar /deployments/ Create Docker image Sending build context to Docker daemon 23.29 MB Step 1/5 : FROM fabric8/java-jboss-openjdk8-jdk:1.5.2 ---> 2d81027cb149 Step 2/5 : ENV JAVA_APP_DIR /deployments ---> 46fc95691e7a Step 3/5 : ENV JAEGER_SERVICE_NAME customer JAEGER_ENDPOINT http://jaeger- collector.istio-system.svc:14268/api/traces JAEGER_PROPAGATION b3 JAEGER_SAMPLER_TYPE const JAEGER_SAMPLER_PARAM 1 ---> 518b64a43cc9 Step 4/5 : EXPOSE 8080 8778 9779 ---> 0000990f2810 Step 5/5 : COPY target/customer.jar /deployments/ ---> 57d20b60ca5b Successfully built 57d20b60ca5b Docker build Istio구성
  • 23. Service Mesh /root/installation/istio-1.0.5/bin/istioctl kube-inject -f /root/projects/istio- tutorial/customer/kubernetes/Deployment.yml | kubectl apply -n tutorial -f - $ cat kubernetes/Deployment.yml --- apiVersion: "v1" kind: "ServiceAccount" metadata: name: "customer" --- apiVersion: apps/v1 kind: Deployment metadata: labels: app: customer version: v1 name: customer spec: replicas: 1 selector: matchLabels: app: customer version: v1 template: metadata: labels: app: customer version: v1 annotations: sidecar.istio.io/inject: "true" 사이드카 프록시를 삽입 NAME READY STATUS RESTARTS AGE pod/customer-6d49bb8ffc-6dt8m 1/1 Running 0 3m pod/preference-v1-d86f66d76-nbxxv 1/1 Running 0 7m pod/recommendation-v1-5f9b4d8fcf-4wbnx 1/1 Running 0 8m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/customer ClusterIP 172.30.248.116 <none> 8080/TCP 36m service/preference ClusterIP 172.30.139.105 <none> 8080/TCP 11m service/recommendation ClusterIP 172.30.115.139 <none> 8080/TCP 4m NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE deployment.apps/customer 1 1 1 1 13m deployment.apps/preference-v1 1 1 1 1 11m deployment.apps/recommendation-v1 1 1 0 1 9m NAME DESIRED CURRENT READY AGE replicaset.apps/customer-6d49bb8ffc 1 1 1 3m replicaset.apps/customer-77cc64968b 0 0 0 13m replicaset.apps/preference-v1-59fcbbdcd9 0 0 0 11m replicaset.apps/preference-v1-d86f66d76 1 1 1 7m replicaset.apps/recommendation-v1-5f9b4d8fcf 1 1 1 8m replicaset.apps/recommendation-v1-8589878566 1 0 0 9m 서비스 구현 완료 Istio구성
  • 24. Service Mesh apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: recommendation spec: hosts: - recommendation http: - route: - destination: host: recommendation subset: version-v1 weight: 90 - destination: host: recommendation subset: version-v2 weight: 10 --- 카나리 배포 apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: recommendation spec: hosts: - recommendation http: - match: - headers: baggage-user-agent: regex: .*Safari.* route: - destination: host: recommendation subset: version-v2 - route: - destination: host: recommendation subset: version-v1 --- 사용자 에이전트 헤더를 기반으로 한 스마트 라우팅 - route: - destination: host: recommendation subset: version-v1 weight: 50 - destination: host: recommendation subset: version-v2 weight: 50 --- VirtualService는 정규표현식(regex)인 .*Safari.* 의 값을 가지는 baggage header (baggage-user-agent)의 http 중에서 version=v2 로 라벨을 포함하는 subset:version- v2 로만 라우팅 됨 Istio구성
  • 25. Service Mesh apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata: name: recommendation spec: host: recommendation trafficPolicy: loadBalancer: simple: RANDOM LaodBalancer apiVersion: "config.istio.io/v1alpha2" kind: memquota metadata: name: handler spec: quotas: - name: requestcount.quota.istio-system # default rate limit is 5000qps maxAmount: 5000 validDuration: 1s # The first matching override is applied. # A requestcount instance is checked against override dimensions. overrides: - dimensions: destination: recommendation destinationVersion: v2 source: preference maxAmount: 1 validDuration: 1s 속도제한 customer => preference => recommendation v1 from '99634814-d2z2t': 1145 customer => preference => recommendation v2 from '2819441432-525lh': 1 customer => preference => recommendation v2 from '2819441432-rg45q': 2 customer => preference => recommendation v2 from '2819441432-bs5ck': 181 customer => preference => recommendation v1 from '99634814-d2z2t': 1146 customer => preference => recommendation v2 from '2819441432-rg45q': 3 customer => preference => recommendation v2 from '2819441432-rg45q': 4 customer => preference => recommendation v2 from '2819441432-bs5ck': 182 customer => preference => recommendation v2 from '2819441432-f4ls5': 108 customer => preference => recommendation v1 from '99634814-d2z2t': 1932 customer => preference => recommendation v2 from '2819441432-f4ls5': 109 customer => preference => recommendation v1 from '99634814-d2z2t': 1933 customer => 503 preference => 429 Too Many Requests customer => preference => recommendation v1 from '99634814-d2z2t': 1934 customer => preference => recommendation v2 from '2819441432-f4ls5': 110 customer => preference => recommendation v1 from '99634814-d2z2t': 1935 customer => 503 preference => 429 Too Many Requests Istio구성
  • 26. Service Mesh http: - fault: abort: httpStatus: 503 percent: 50 route: - destination: host: recommendation subset: app-recommendation --- HTTP 오류 503 http: - fault: delay: fixedDelay: 7.000s percent: 50 route: - destination: host: recommendation subset: app-recommendation --- Delay에 대한 제한 503이 50%이상 나면 abort요청 VirtualServices는 http Fault를 제공한다. fixedDelay=7s. 50% of the time의 경우 작동 - route: - destination: host: recommendation retries: attempts: 3 perTryTimeout: 2s Retry http: - route: - destination: host: recommendation timeout: 1.000s Timeout 503이 50%이상나면 abort요청 VirtualService timeout의 1 second 제공 Istio구성
  • 27. Service Mesh apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata: name: recommendation spec: host: recommendation subsets: - name: version-v2 labels: version: v2 trafficPolicy: connectionPool: http: http1MaxPendingRequests: 1 maxRequestsPerConnection: 1 tcp: maxConnections: 1 outlierDetection: baseEjectionTime: 120.000s consecutiveErrors: 1 interval: 1.000s maxEjectionPercent: 100 Circuit Breaker name: recommendation spec: host: recommendation subsets: - labels: version: v1 name: version-v1 trafficPolicy: connectionPool: http: {} tcp: {} loadBalancer: simple: RANDOM outlierDetection: baseEjectionTime: 15.000s consecutiveErrors: 1 interval: 5.000s maxEjectionPercent: 100 - labels: version: v2 name: version-v2 trafficPolicy: connectionPool: http: {} tcp: {} loadBalancer: simple: RANDOM outlierDetection: baseEjectionTime: 15.000s consecutiveErrors: 1 interval: 5.000s maxEjectionPercent: 100 Pool ejection 풀 제거 또는 이상 값 감지 (outlier detection)는 클라이언트 요청을 처리 할 인스턴스 / 포드 풀이있을 때마다 발생하는 탄력적 회복 전략 Connection pool에 요청사항에 따라서 1초마다 체크해서, 한번이라도 에러가 발생하면, 120초 동안 서비스에서 배제(circuit breaking) 시킴 → [503 Service Unavailable] error 발생시킴 Istio구성
  • 28. Service Mesh Ultimate resilience with retries, circuit breaker, and pool ejection name: recommendation spec: apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata: name: recommendation spec: host: recommendation subsets: - name: version-v1 labels: version: v1 - name: version-v2 labels: version: v2 trafficPolicy: connectionPool: http: http1MaxPendingRequests: 1 maxRequestsPerConnection: 1 tcp: maxConnections: 1 outlierDetection: baseEjectionTime: 120.000s consecutiveErrors: 1 interval: 1.000s maxEjectionPercent: 100 • 인스턴스에 대한 여러 동시 요청을 방지하는 회로 차단기 • 인스턴스를 응답의 풀을 이용하여, 실패하는 인스턴스 pool rejection • 개방 회로 차단기 및 / 또는 풀 방출이 발생하는 경우를 대비하여 요청을 다른 인스턴스로 전달하기 위해 재 시도 mTLS apiVersion: "authentication.istio.io/v1alpha1" kind: "Policy" metadata: name: "default" spec: peers: - mtls: {} ------------------- apiVersion: "networking.istio.io/v1alpha3" kind: "DestinationRule" metadata: name: "default" spec: host: "*.tutorial.svc.cluster.local" trafficPolicy: tls: mode: ISTIO_MUTUAL • host: 0192.168.64.70:31380 user-agent: curl/7.54.0 accept: */* x-forwarded-for: 172.17.0.1 x-forwarded-proto: http x-envoy-internal: true x-request-id: e5c0b90f- 341b-9edc-ac3e-7dd8b33f0e8b x-envoy-decorator-operation: customer.tutorial.svc.cluster.local:8080/ x-b3-traceid: ce289e960a639d11 x-b3- spanid: ce289e960a639d11 x-b3-sampled: 1 • 14:24:55.078222 IP (tos 0x0, ttl 64, id 32578, offset 0, flags [DF], proto TCP (6), length 967) 172.17.0.15.33260 > customer-7dcd544ff9-652ds.8080: Flags [P.], cksum 0x5bf5 (incorrect -> 0x595e), seq 2211080917:2211081832, ack 2232186801, win 391, options [nop,nop,TS val 5958433 ecr 5779275], length 915: HTTP E....B@.@._........ ......j...w.....[...... Istio구성
  • 29. Service Mesh Kiali • 전체서비스관찰가능 • 네임스페이스별pod내용 확인가능 • 각각의traffic확인가능 Istio구성
  • 30. Service Mesh Kiali-2 Kiali-1 • Namespace내에서비스 연결점확인 • 전체성공률과에러코드넘 버제공 • http/tcp전체서비스 traffic제공 • Pod간서비스시간확인 가능 • 상세세부버전에대한 graph제공 Kiali-3 • 에러코드에대한실시간화 면표시 • 서비스코드별색상표시 로가독성높은아웃풋제 공 Istio구성
  • 31. Service Mesh Kiali-2 Kiali-1 • Metric에대한서비스데이 터정보 • 서비스time에대한정보 와그pod정보 • 상세정보를들어가서,배 포후버전에따른응답시 간확인가능 Kiali-3 • 서비스상세내용에대한 duration • 시간별비교맵제공 • 색깔별로response 상태 확인 Istio구성 Kiali-4 • 애플리케이션request volume&duration&size 정보전달
  • 32. Service Mesh Grafana –2 Grafana –1 • 전체요청에대한응답시간 • 서비스latency • 성공률 • 전체요청에대한백분율 • 서비스워크로드 Istio구성
  • 33. Service Mesh istioctl create -f istiofiles/recommendation_requestcount.yml -n istio-system apiVersion: "config.istio.io/v1alpha2" kind: metric metadata: name: recommendationrequestcount spec: value: "1" dimensions: user_agent: request.headers["user-agent"] | "unknown" monitored_resource_type: '"UNSPECIFIED"' --- apiVersion: "config.istio.io/v1alpha2" kind: prometheus metadata: name: recommendationrequestcounthandler spec: metrics: - name: recommendation_request_count instance_name: recommendationrequestcount.metric.istio-system kind: COUNTER --- apiVersion: "config.istio.io/v1alpha2" kind: rule metadata: name: recommendationrequestcountprom spec: match: destination.service == "recommendation.tutorial.svc.cluster.local" actions: - handler: recommendationrequestcounthandler.prometheus instances: - recommendationrequestcount.metric 사용자 지정 메트릭 Prometheus-1 • Recommend에대한 전체요청수에대한정보 Istio구성
  • 36. Service Mesh NAME READY STATUS RESTARTS AGE linkerd-controller-68fdf874c-p458b 0/2 PodInitializing 0 80s linkerd-destination-db79d6d8f-sw7x7 0/2 PodInitializing 0 80s linkerd-identity-5bc6c6c894-2bnkz 0/2 PodInitializing 0 80s linkerd-proxy-injector-55bcb8fd99-dht7p 0/2 Running 0 80s linkerd-sp-validator-56bf5b5896-22gbf 0/2 PodInitializing 0 80s Kubectl get pods –n linkerd -l linkerd.io/control-plane-ns=linkerd Linkerd stable-2.10.1 was successfully installed 🎉 linkerd version linkerd구성
  • 37. Service Mesh 37 kubectl get -n emojivoto deploy -o yaml | linkerd inject - | kubectl apply -f - linkerd구성
  • 41. Service Mesh cat <<EOF | kubectl apply -f - apiVersion: flagger.app/v1beta1 kind: Canary metadata: name: podinfo namespace: test spec: targetRef: apiVersion: apps/v1 kind: Deployment name: podinfo service: port: 9898 analysis: interval: 10s threshold: 5 stepWeight: 10 maxWeight: 100 metrics: - name: request-success-rate thresholdRange: min: 99 interval: 1m - name: request-duration thresholdRange: max: 500 interval: 1m EOF 카나리 배포 linkerd구성
  • 42. Service Mesh spec: routes: - name: GET /api/annotations condition: method: GET pathRegex: /api/annotations isRetryable: true ### ADD THIS LINE ### Retry spec: routes: - condition: method: HEAD pathRegex: /authors/[^/]*.json name: HEAD /authors/{id}.json timeout: 300ms Timeout linkerd구성
  • 43. Service Mesh kubectl -n emojivoto set env --all deploy OC_AGENT_HOST=collector.linkerd-jaeger:55678 linkerd구성
  • 45. Service Mesh Linkerd mutlti-cluster | 내부 Architecture Multi-cluster | 상세 설명 Multi-cluster • 통합 도메인의 신뢰성 - 클러스터 경계간의 통신 • 장애 도메인 분리 – 장애시 격리필요 • 이기종 네트워크 지원 - clouds/VPC/on-premises datacenter간의 네트워크 통신지원 • 통합된 클러스터 간 통신 – 클러스터간 통신과 같은 observability, reliability, and security features가 요구 됨 • 클러스터간에 서비스 정보를 "미러링"하여 작동 • 서비스 미러 와 게이트웨이 라는 두 가지 구성 요소로 구현 1. 공유 신뢰 앵커를 사용하여 두 개의 클러스터에 Linkerd 를 설치 2. 클러스터를 준비 3. 클러스터를 연결 4. 데모를 설치 5. 가시성을 제어하려면 데모 서비스를 export 6. 클러스터의 보안을 확인 7. 소스 클러스터 ( west) 의 Pod 에서 대상 클러스터 ( east)로 트 래픽 분할 • Requirement I: Support Hierarchical Networks • Requirement II: Maintain Independent State • Requirement III: Have an Independent Control Plane • linkerd --context=east multicluster link --cluster- name east | kubectl --context=west apply -f -
  • 46. Service Mesh cat <<EOF | kubectl --context=west apply -f - apiVersion: split.smi-spec.io/v1alpha1 kind: TrafficSplit metadata: name: podinfo namespace: test spec: service: podinfo backends: - service: podinfo weight: 50 - service: podinfo-east weight: 50 EOF Traffic split Multi-cluster Grafana –1 • 양쪽노드를모두모니터링 가능 • 수요량을직접적으로확인 가능
  • 47. T. 02-516-0711 E. sales@osci.kr 서울시강남구테헤란로83길32,5층(삼성동,나라키움삼성동A빌딩) THANK YOU