© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EKS를 활용한
'타다' 서비스 구축기
김태호, VCNC
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
안녕하세요
• 김태호입니다.
• VCNC에서 백엔드 개발 및 운영을 하고 있습니다.
• sapzil.org (블로그)
• github.com/dittos
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
VCNC 주요 서비스
기능 라이드 헤일링
출시 2018년 10월
다운로드 330,000 (2019년 02월 기준)
서비스 국가 한국
기능 커플 메신저, 사진 저장, 달력 공유
출시 2012년 3월
다운로드 27,000,000 (2018년 11월 기준)
서비스 국가 전세계
이미지: © VCNC
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
타다는...
새로운 이동의 기준을 제시하는 모빌리티 플랫폼으로, 스마트폰을 이용하여 언제든 원하는 곳까지
더욱 편리하고 안전하게 이동할 수 있습니다.
이미지: © VCNC
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
타다는...
2018년 10월 론칭 후 한 달 만에 약 15만 라이더가 사용하는 주요 모빌리티 서비스로 자리 잡았으
며, 호출수 기준 프리미엄 서비스 시장 1위 사업자로 성장했습니다.
400,000 80% ★ 4.415,000
앱 설치수 재탑승률 앱스토어 평가일일 활성 사용자수
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
타다: 기술 선택 배경
• 빠르게 변화하는 시장 상황
• 짧은 초기 개발 기간 (6월 개발 시작, 10월 정식 출시)
• 비트윈 개발 경험
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
비트윈: 흔하지 않은 기술 선택
• 메인 데이터베이스: HBase + Haeinsa
• RPC/메시징, 로그 수집: 인하우스 프레임워크
• 덜 중요한 문제 해결에 시간 소모
• 금방 낡기 쉬움
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
타다: 흔한 기술 선택
• 지루한(?) 기술
• MySQL
• Spring Boot
• Redis
• 비교적 새롭지만 충분히 성숙한 기술
• gRPC
• Kubernetes
• Kotlin
• AWS에서 제공하는 기술
• RDS Aurora / ElastiCache
• Kinesis (Firehose)
• CloudWatch Logs
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
비트윈: 느리고 복잡한 배포 프로세스
• 많은 서비스 / 다양한 기술스택
• Ansible + Packer
• 비용 절약을 위해 여러 서비스를 수동으로 묶어서 한 인스턴스에?
• 프로비저닝 (AMI 이미지 생성) 하는데 오래걸림
• 서비스끼리 서로 영향을 줌
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
타다: 빠르고 간단한 배포 프로세스
• 통일된 기술 스택 (Kotlin + Spring Boot)
• 컨테이너
• 컨테이너 오케스트레이션 (Kubernetes)
• "Binpacking"
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
라이더 앱
차량 호출, 차량 위치 확인
드라이버 앱
배차 확인, 차량 위치 전송
이미지: © VCNC
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API 서버
Aurora MySQL
(main)
API 서버
API 서버
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API 서버
각종 워커
Redis
subscribe
publish
gRPC 서버
subscribe
gRPC 서버gRPC 서버
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
gRPC: 특징
• 오픈소스 RPC 프레임워크
• 다양한 언어 지원 (Java - Server/Android, Swift - iOS)
• HTTP/2 프로토콜 기반
• 적은 데이터 전송량 (Protocol Buffers)
• 스트리밍 지원 (단방향, 양방향)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API 서버
Aurora MySQL
(tracker)
API 서버
위치수집 서버
Kinesis
Streams
Tracker
Tracker
Tracker
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API 서버
Aurora MySQL
(tracker)
API 서버
API 서버
SQS
Tracker
Tracker
Dispatcher
Aurora MySQL
(main)
차량 호출
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
로그 수집
애플리케이션 (서버/워커)
Logging Framework
(Logback)
Kinesis Appender
Kinesis
Data Streams
S3
Athena
Kinesis
Data Firehose
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
RDS
(Aurora MySQL)
Kinesis
SQS
ElastiCache
(Redis)
AWS managed
Server
Server
Server
LB
Kubernetes
ServerServerWorkers
요약
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon EKS?
• AWS의 관리형 Kubernetes 서비스
• 2017년 11월: re:Invent에서 프리뷰 버전 출시
• 2018년 6월: 상용(GA) 버전이 미국 리전에만 출시
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon EKS?
올해 1월: 서울 리전에 출시!
https://github.com/aws/containers-
roadmap/issues/37
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes 아키텍처
K8S User
...
워커 노드 (가상or물리)
kubelet
Pod Pod
워커 노드 (가상or물리)
kubelet
Pod Pod
마스터 노드
(API 서버, 스케줄러)
Pod Spec
(Docker
이미지들)
마스터 노드
(API 서버, 스케줄러)마스터 노드
(API 서버, 스케줄러)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes w/ EKS
K8S User
...
워커 노드 (EC2)
kubelet
Pod Pod
워커 노드 (EC2)
kubelet
Pod Pod
마스터 노드
(API 서버, 스케줄러)
Pod Spec
(Docker
이미지들)
K8S API
EKS (“관리형”)
Bring your own node
(EKS 최적화 AMI 제공)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
비교: ECS w/ EC2
ECS User
...
컨테이너 인스턴스 (EC2)
ECS agent
Task Task
컨테이너 인스턴스 (EC2)
ECS agent
Task Task
ECS Master(?)
Task Def.
(Docker
이미지들)
ECS API
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EKS 기본 구성
• AWS IAM 기반 Kubernetes API 서버 인증
• ENI 기반 네트워킹 플러그인
• 노드 당 Pod 개수 제한
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
RDS
(Aurora MySQL)
Kinesis
SQS
ElastiCache
(Redis)
AWS managed
Server
Server
Server
LB
Kubernetes
ServerServerWorkers
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
RDS
(Aurora MySQL)
Kinesis
SQS
ElastiCache
(Redis)
AWS managed
(persistent)
Server
Server
Server
LB
Kubernetes(old)
Server
Server
Server
LB
EKS
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
RDS
(Aurora MySQL)
Kinesis
SQS
ElastiCache
(Redis)
AWS managed
(persistent)
Server
Server
Server
LB
Kubernetes(old)
Server
Server
Server
LB
EKS
Route 53
WeightedRouting
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
VPC
ap-northeast-2a ap-northeast-2c
k8s subnet 1 k8s subnet 2
master master master
worker
worker
worker
worker
worker
worker
default subnet 1
RDS, ElastiCache (Multi-AZ)
default subnet 2
RDS, ElastiCache (Multi-AZ)
NLB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
VPC
ap-northeast-2a ap-northeast-2c
k8s subnet 1 k8s subnet 2
master master master
worker
worker
worker
worker
worker
worker
default subnet 1
RDS, ElastiCache (Multi-AZ)
default subnet 2
RDS, ElastiCache (Multi-AZ)
EKS subnet 1
worker
worker
worker
EKS subnet 2
worker
worker
worker
NLB
NLB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
모든 서비스 다시 설치
● Helm 차트로 Kubernetes 리소스가 선언되어 있음
● 기반 서비스 설치
○ nginx
○ fluentd (로깅)
○ …
● 워커 설치, 잘 동작하는지 확인
● 서버 설치
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
트래픽을 새 클러스터로 보내기
*.tadatada.com
Old NLB New NLB
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
New k8s nodes
weight=100 weight=0
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
트래픽을 새 클러스터로 보내기
*.tadatada.com
Old NLB New NLB
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
New k8s nodes
weight=100 weight=10
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
트래픽을 새 클러스터로 보내기
*.tadatada.com
Old NLB New NLB
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
New k8s nodes
weight=0 weight=100
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
이전 클러스터 제거
*.tadatada.com
Old NLB New NLB
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
New k8s nodes
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
이전 클러스터 제거
*.tadatada.com
Old NLB New NLB
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
Old k8s nodes
New k8s nodes
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
이전 클러스터 제거
*.tadatada.com
New NLB
Old k8s nodes
Old k8s nodes
New k8s nodes
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ingress Controller
• Ingress: 클러스터 내부 서비스를 외부에 HTTP(S)로 노출
• 실제로 작동하기 위해서는 Ingress Controller가 필요
• 다양한 종류의 Ingress Controller 솔루션
• NGINX Ingress Controller
• AWS ALB Ingress Controller
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ingress Controller
• AWS ALB Ingress Controller
• 현재 Ingress 하나마다 ALB를 1개 생성하는 구조
• gRPC 미지원 (ALB)
• NGINX Ingress Controller
• NGINX 웹서버 기반
• gRPC 모듈 지원
• 외부 로드밸런서 필요
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
gRPC와 로드밸런싱
• Classic ELB (HTTP)
• HTTP/2, gRPC 미지원
• Classic ELB (TCP)
• 갑작스런 연결 수 증가를 처리하려면 Pre-warm up 필요
• TLS termination은 HTTP/2, gRPC 미지원 (ALPN 설정 불가)
• ALB
• HTTP/2 지원, gRPC 미지원
• NLB
• TLS termination은 HTTP/2, gRPC 미지원 (ALPN 설정 불가)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
gRPC와 로드밸런싱
• NLB + NGINX
• NGINX gRPC 모듈
• NGINX에서 TLS termination
• NGINX Ingress Controller
• Kubernetes pod load balancing
NLB
nginx
nginx
service
service
k8s nodes
https
(443)
https
(30000) http
(80)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
kube2iam
• IAM으로 인증하는 AWS 서비스에 접근하려면 인증 정보가 필요
• 액세스 키?
• EC2 인스턴스 프로파일로 인스턴스에 IAM 역할을 부여
• Kubernetes 환경에서는 인스턴스 프로파일 활용 어려움
• 하나의 Kubernetes 노드 (=EC2 인스턴스)에는 여러 Pod이 실행될 수 있기 때문
• kube2iam을 사용하여 Pod에 IAM 역할 부여
• Pod annotation으로 IAM role 설정
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
로그 수집 (container-level)
애플리케이션 컨테이너
stdout/stderr CloudWatch
Logs
CloudWatch
Logs Insights
Kubernetes 노드
로컬 디스크
컨테이너와 함께
삭제
용량이 커지면
삭제
fluentd
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
CloudWatch Logs Insights
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
참고 자료
• 타다 시스템 아키텍처
• 서비스 중단 없이 Amazon EKS로 옮긴 이야기
• AWS 서비스를 활용한 Kubernetes 클러스터 구축

EKS를 통한 차량 공유 서비스 '타다' 서비스 구축기 - 김태호, VCNC :: AWS Summit Seoul 2019

  • 1.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. EKS를 활용한 '타다' 서비스 구축기 김태호, VCNC
  • 2.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 안녕하세요 • 김태호입니다. • VCNC에서 백엔드 개발 및 운영을 하고 있습니다. • sapzil.org (블로그) • github.com/dittos
  • 3.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. VCNC 주요 서비스 기능 라이드 헤일링 출시 2018년 10월 다운로드 330,000 (2019년 02월 기준) 서비스 국가 한국 기능 커플 메신저, 사진 저장, 달력 공유 출시 2012년 3월 다운로드 27,000,000 (2018년 11월 기준) 서비스 국가 전세계 이미지: © VCNC
  • 4.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 타다는... 새로운 이동의 기준을 제시하는 모빌리티 플랫폼으로, 스마트폰을 이용하여 언제든 원하는 곳까지 더욱 편리하고 안전하게 이동할 수 있습니다. 이미지: © VCNC
  • 5.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 타다는... 2018년 10월 론칭 후 한 달 만에 약 15만 라이더가 사용하는 주요 모빌리티 서비스로 자리 잡았으 며, 호출수 기준 프리미엄 서비스 시장 1위 사업자로 성장했습니다. 400,000 80% ★ 4.415,000 앱 설치수 재탑승률 앱스토어 평가일일 활성 사용자수
  • 6.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved.
  • 7.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 타다: 기술 선택 배경 • 빠르게 변화하는 시장 상황 • 짧은 초기 개발 기간 (6월 개발 시작, 10월 정식 출시) • 비트윈 개발 경험
  • 8.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 비트윈: 흔하지 않은 기술 선택 • 메인 데이터베이스: HBase + Haeinsa • RPC/메시징, 로그 수집: 인하우스 프레임워크 • 덜 중요한 문제 해결에 시간 소모 • 금방 낡기 쉬움
  • 9.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 타다: 흔한 기술 선택 • 지루한(?) 기술 • MySQL • Spring Boot • Redis • 비교적 새롭지만 충분히 성숙한 기술 • gRPC • Kubernetes • Kotlin • AWS에서 제공하는 기술 • RDS Aurora / ElastiCache • Kinesis (Firehose) • CloudWatch Logs
  • 10.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 비트윈: 느리고 복잡한 배포 프로세스 • 많은 서비스 / 다양한 기술스택 • Ansible + Packer • 비용 절약을 위해 여러 서비스를 수동으로 묶어서 한 인스턴스에? • 프로비저닝 (AMI 이미지 생성) 하는데 오래걸림 • 서비스끼리 서로 영향을 줌
  • 11.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 타다: 빠르고 간단한 배포 프로세스 • 통일된 기술 스택 (Kotlin + Spring Boot) • 컨테이너 • 컨테이너 오케스트레이션 (Kubernetes) • "Binpacking"
  • 12.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 라이더 앱 차량 호출, 차량 위치 확인 드라이버 앱 배차 확인, 차량 위치 전송 이미지: © VCNC
  • 13.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. API 서버 Aurora MySQL (main) API 서버 API 서버
  • 14.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. API 서버 각종 워커 Redis subscribe publish gRPC 서버 subscribe gRPC 서버gRPC 서버
  • 15.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. gRPC: 특징 • 오픈소스 RPC 프레임워크 • 다양한 언어 지원 (Java - Server/Android, Swift - iOS) • HTTP/2 프로토콜 기반 • 적은 데이터 전송량 (Protocol Buffers) • 스트리밍 지원 (단방향, 양방향)
  • 16.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. API 서버 Aurora MySQL (tracker) API 서버 위치수집 서버 Kinesis Streams Tracker Tracker Tracker
  • 17.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. API 서버 Aurora MySQL (tracker) API 서버 API 서버 SQS Tracker Tracker Dispatcher Aurora MySQL (main) 차량 호출
  • 18.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 로그 수집 애플리케이션 (서버/워커) Logging Framework (Logback) Kinesis Appender Kinesis Data Streams S3 Athena Kinesis Data Firehose
  • 19.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. RDS (Aurora MySQL) Kinesis SQS ElastiCache (Redis) AWS managed Server Server Server LB Kubernetes ServerServerWorkers 요약
  • 20.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved.
  • 21.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. Amazon EKS? • AWS의 관리형 Kubernetes 서비스 • 2017년 11월: re:Invent에서 프리뷰 버전 출시 • 2018년 6월: 상용(GA) 버전이 미국 리전에만 출시
  • 22.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. Amazon EKS? 올해 1월: 서울 리전에 출시! https://github.com/aws/containers- roadmap/issues/37
  • 23.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. Kubernetes 아키텍처 K8S User ... 워커 노드 (가상or물리) kubelet Pod Pod 워커 노드 (가상or물리) kubelet Pod Pod 마스터 노드 (API 서버, 스케줄러) Pod Spec (Docker 이미지들) 마스터 노드 (API 서버, 스케줄러)마스터 노드 (API 서버, 스케줄러)
  • 24.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. Kubernetes w/ EKS K8S User ... 워커 노드 (EC2) kubelet Pod Pod 워커 노드 (EC2) kubelet Pod Pod 마스터 노드 (API 서버, 스케줄러) Pod Spec (Docker 이미지들) K8S API EKS (“관리형”) Bring your own node (EKS 최적화 AMI 제공)
  • 25.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 비교: ECS w/ EC2 ECS User ... 컨테이너 인스턴스 (EC2) ECS agent Task Task 컨테이너 인스턴스 (EC2) ECS agent Task Task ECS Master(?) Task Def. (Docker 이미지들) ECS API
  • 26.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. EKS 기본 구성 • AWS IAM 기반 Kubernetes API 서버 인증 • ENI 기반 네트워킹 플러그인 • 노드 당 Pod 개수 제한
  • 27.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. RDS (Aurora MySQL) Kinesis SQS ElastiCache (Redis) AWS managed Server Server Server LB Kubernetes ServerServerWorkers
  • 28.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. RDS (Aurora MySQL) Kinesis SQS ElastiCache (Redis) AWS managed (persistent) Server Server Server LB Kubernetes(old) Server Server Server LB EKS
  • 29.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. RDS (Aurora MySQL) Kinesis SQS ElastiCache (Redis) AWS managed (persistent) Server Server Server LB Kubernetes(old) Server Server Server LB EKS Route 53 WeightedRouting
  • 30.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. VPC ap-northeast-2a ap-northeast-2c k8s subnet 1 k8s subnet 2 master master master worker worker worker worker worker worker default subnet 1 RDS, ElastiCache (Multi-AZ) default subnet 2 RDS, ElastiCache (Multi-AZ) NLB
  • 31.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. VPC ap-northeast-2a ap-northeast-2c k8s subnet 1 k8s subnet 2 master master master worker worker worker worker worker worker default subnet 1 RDS, ElastiCache (Multi-AZ) default subnet 2 RDS, ElastiCache (Multi-AZ) EKS subnet 1 worker worker worker EKS subnet 2 worker worker worker NLB NLB
  • 32.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 모든 서비스 다시 설치 ● Helm 차트로 Kubernetes 리소스가 선언되어 있음 ● 기반 서비스 설치 ○ nginx ○ fluentd (로깅) ○ … ● 워커 설치, 잘 동작하는지 확인 ● 서버 설치
  • 33.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 트래픽을 새 클러스터로 보내기 *.tadatada.com Old NLB New NLB Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes New k8s nodes weight=100 weight=0
  • 34.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 트래픽을 새 클러스터로 보내기 *.tadatada.com Old NLB New NLB Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes New k8s nodes weight=100 weight=10
  • 35.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 트래픽을 새 클러스터로 보내기 *.tadatada.com Old NLB New NLB Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes New k8s nodes weight=0 weight=100
  • 36.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 이전 클러스터 제거 *.tadatada.com Old NLB New NLB Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes New k8s nodes
  • 37.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 이전 클러스터 제거 *.tadatada.com Old NLB New NLB Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes Old k8s nodes New k8s nodes
  • 38.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 이전 클러스터 제거 *.tadatada.com New NLB Old k8s nodes Old k8s nodes New k8s nodes
  • 39.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. Ingress Controller • Ingress: 클러스터 내부 서비스를 외부에 HTTP(S)로 노출 • 실제로 작동하기 위해서는 Ingress Controller가 필요 • 다양한 종류의 Ingress Controller 솔루션 • NGINX Ingress Controller • AWS ALB Ingress Controller
  • 40.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. Ingress Controller • AWS ALB Ingress Controller • 현재 Ingress 하나마다 ALB를 1개 생성하는 구조 • gRPC 미지원 (ALB) • NGINX Ingress Controller • NGINX 웹서버 기반 • gRPC 모듈 지원 • 외부 로드밸런서 필요
  • 41.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. gRPC와 로드밸런싱 • Classic ELB (HTTP) • HTTP/2, gRPC 미지원 • Classic ELB (TCP) • 갑작스런 연결 수 증가를 처리하려면 Pre-warm up 필요 • TLS termination은 HTTP/2, gRPC 미지원 (ALPN 설정 불가) • ALB • HTTP/2 지원, gRPC 미지원 • NLB • TLS termination은 HTTP/2, gRPC 미지원 (ALPN 설정 불가)
  • 42.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. gRPC와 로드밸런싱 • NLB + NGINX • NGINX gRPC 모듈 • NGINX에서 TLS termination • NGINX Ingress Controller • Kubernetes pod load balancing NLB nginx nginx service service k8s nodes https (443) https (30000) http (80)
  • 43.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. kube2iam • IAM으로 인증하는 AWS 서비스에 접근하려면 인증 정보가 필요 • 액세스 키? • EC2 인스턴스 프로파일로 인스턴스에 IAM 역할을 부여 • Kubernetes 환경에서는 인스턴스 프로파일 활용 어려움 • 하나의 Kubernetes 노드 (=EC2 인스턴스)에는 여러 Pod이 실행될 수 있기 때문 • kube2iam을 사용하여 Pod에 IAM 역할 부여 • Pod annotation으로 IAM role 설정
  • 44.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 로그 수집 (container-level) 애플리케이션 컨테이너 stdout/stderr CloudWatch Logs CloudWatch Logs Insights Kubernetes 노드 로컬 디스크 컨테이너와 함께 삭제 용량이 커지면 삭제 fluentd
  • 45.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. CloudWatch Logs Insights
  • 46.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved. 참고 자료 • 타다 시스템 아키텍처 • 서비스 중단 없이 Amazon EKS로 옮긴 이야기 • AWS 서비스를 활용한 Kubernetes 클러스터 구축