SlideShare una empresa de Scribd logo
1 de 135
Spring Cloud로 개발하는 Micro Service Architecture
Leonardo Park
Spring Cloud on Kubernetes
Spring Cloud on Kubernetes
소개
Leonardo Park
codingman@outlook.krcodingman
쿠팡_ Software Engineer
API Gateway 담당
ktds_Application Architecture
Giga ginie 개발자 포털 IoT Makers Platform,
한글과컴퓨터_ 선임연구원
Webkit, ePub Rendering, HWP Filter
엠군미디어_ 선임연구원
ffmpeg, Live Streaming, Server Side Encoding
Spring Cloud on Kubernetes
Prerequisite Tools
Spring Cloud on Kubernetes
SDKMAN Prerequisite Tools
MAC OS & Linux User only
http://sdkman.io/install.html
curl -s "https://get.sdkman.io" | bash
Spring Cloud on Kubernetes
Install Java Prerequisite Tools
$ sdk list java
================================================================================
Available Java Versions
================================================================================
9u181-openjdk
9.0.4-zulu
9.0.4-oracle
9.0.1-zulu
9.0.0-zulu
8u161-oracle
8u152-zulu
10u23-openjdk
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
$ sdk install java 8u152-zulu
Spring Cloud on Kubernetes
Install Gradle Prerequisite Tools
$ sdk list gradle
================================================================================
Available Gradle Versions
================================================================================
4.6-rc-2 4.3.1 3.5 2.2.1
4.6-rc-1 4.3-rc-4 3.4.1 2.2
4.6 4.3-rc-3 3.4 2.14.1
4.5.1 4.3-rc-2 3.3 2.14
4.5-rc-2 4.3-rc-1 3.2.1 2.13
4.5-rc-1 4.3 3.2 2.12
~
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
$ sdk install gradle 4.6
Spring Cloud on Kubernetes
Install IntelliJ Prerequisite Tools
https://www.jetbrains.com/idea/
Spring Cloud on Kubernetes
Create Accounts
Spring Cloud on Kubernetes
Docker hub Create Accounts
https://hub.docker.com
Spring Cloud on Kubernetes
Github
https://github.com
Spring Cloud on Kubernetes
Micro Service Architecture
Spring Cloud on Kubernetes
MSA 빠르게 알아보기 Micro Service Architecture
전통적인 애플리케이션 개발
모노리딕 아키텍쳐(Monolithic Architecture)
하나의 애플리케이션이 하나의 모듈에 모두 들어가 있는 구조.
업무 컴포넌트들이 모두 하나의 강 결합 구조로 연결됨.
강결합의 Call By Ref 형태로 성능 상 많이 유리함.
작은 크기의 애플리케이션에는 유리함.
하나의 모듈 수정을 위해 전체 애플리케이션을 재 배포하는 구조.
모듈의 크기가 크기 때문에, 빌드 및 배포 시간, 서버의 기동 시간이 오래 걸림.
통일성 있는 아키텍처 기술구조를 가짐.
…
DATABASE
애플리케이션
JBOSS
JSP
사용자 상품 주문
재고 이벤트 배송
Spring Cloud on Kubernetes
MSA 빠르게 알아보기 Micro Service Architecture
기술과 문화의 발전
데이터와 애플리케이션을 설계하는 경우 업무 도메인별로 분리하여 설계 하는 방식
하드웨어 가상화, 네트워크 가상화 등의 기술의 발전으로 컴퓨팅 자원에 대한 기
지속적인 통합과 배포를 통한 비즈니스 신속성과 시스템 안정성을 위한 기술
요구사항이나 시스템의 성격에 맞는 프로그래밍 언어를 이용하여 시스템을 개발하는 방식
클라우드 컴퓨팅 자원을 프로그래밍을 통해 자동화 하여 시스템 안정성을 확보하는 기술
비즈니스를 신속하게 지원할 수 있는 개발 방법론
개발과 운영을 하나의 팀에서 모두 수행하는 시스템 개발/운영 방식
Domain Driven Development
Cloud Computing
CI / CD
Polyglot Programming
Infrastructure Automation
Agile Development
DevOps
Spring Cloud on Kubernetes
MSA 빠르게 알아보기 Micro Service Architecture
마이크로 서비스 아키텍처 (Micro Service Architecture)
업무 모듈을 마이크로 서비스 단위로 분리하고 경량화 된 메시지를 통하여 통신.
서비스별 데이터도 역시 분리 하여 구성
서비스별 기능/비 기능 요구사항에 맞는 다양한 기술 사용.
클라우드의 인프라 기능을 적극적으로 활용하여 시스템 구성
마이크로 서비스 배포의 자동화 및 전체 서비스에 대한 영향 최소화
개발과 운영을 같은 모듈의 팀에서 수행
API Gateway
사용자서비스
사용자
DATA
BASE
상품서비스
상품
DATA
BASE
주문서비스
주문
DATA
BASE
재고서비스
재고
DATA
BASE
이벤트서비스
이벤트
DATA
BASE
배송서비스
배송
DATA
BASE
프론트엔드
UI
Session
Storage
Polyglot Programming
Cloud Computing Infrastructure Automation
CI / CD
DevOps
Domain Driven Development
Agile Development
Lightweight Communication
Spring Cloud on Kubernetes
MSA 빠르게 알아보기 Micro Service Architecture
전통적인 아키텍처와 마이크로 서비스
User Interface
Business Logic
Data Access
Layer
Database
User Interface (SPA or Mobile …)
Micro Service
Database
Micro Service Micro Service
Database Database
Monolithic Architecture Micro Service Architecture
Spring Cloud on Kubernetes
MSA 빠르게 알아보기 Micro Service Architecture
마이크로 서비스란?
작고
API로 다른 서비스와 연계하는
자율적이며
한가지일을 잘하는데 초점이 맞춰진 서비스
서비스별 독자적인 데이터베이스
어떤 언어로 개발해도 상관없음.
서비스 별로 팀 구성 (컨웨이의 법칙)
Spring Cloud on Kubernetes
MSA 빠르게 알아보기 Micro Service Architecture
12 Factors App
I. 코드베이스 : 버전 관리되는 하나의 코드베이스와 다양한 배포
II. 종속성 : 명시적으로 선언되고 분리된 종속성
III. 설정 : 환경(environment)에 저장된 설정
IV. 백엔드 서비스 : 백엔드 서비스를 연결된 리소스로 취급
V. 빌드, 릴리즈, 실행 : 철저하게 분리된 빌드와 실행 단계
VI. 프로세스 : 애플리케이션을 하나 혹은 여러 개의 무 상태(stateless) 프로세스로 실행
VII. 포트 바인딩 : 포트 바인딩을 사용해서 서비스를 공개함
VIII. 동시성(Concurrency) : 프로세스 모델을 사용한 확장
IX. 폐기 가능(Disposability) : 빠른 시작과 안정적인 종료 (graceful shutdown)을 통한 안정성 극대화
X. dev/prod 일치 : development, staging, production 환경을 최대한 비슷하게 유지
XI. 로그 : 로그를 이벤트 스트림으로 취급
XII. Admin 프로세스 : admin/maintenance 작업을 일회성 프로세스로 실행
Spring Cloud on Kubernetes
MSA 빠르게 알아보기 Micro Service Architecture
마이크로 서비스 아키텍처를 위한 준비
실력이 전체적으로 좋은 조직이 운영 가능. DevOps 가 가능해야 함.
좋은 커뮤니케이션 문화가 전제 되어야 함.
서비스나 솔루션 개발에 적당하고… (SI 개발에서는 적당하지 않음)
테스트가 어려움. 경험이 많은 개발자가 필요함.
여러가지 언어와 신기술 난무 – 계속하여 공부
Spring Cloud on Kubernetes
Micro Service Architecture 이해하기 Micro Service Architecture
Spring Cloud
분산 시스템 환경에서 많이 사용하는 설계 패턴을 개발자가 빠르게 개발할 수 있는 툴을 제공.
configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-
time tokens, global locks, leadership election, distributed sessions, cluster state
Spring Framework 4
Java 1.7+
Spring Boot
Spring Cloud
Netflix OSS
Spring Cloud on Kubernetes
Micro Service Architecture 이해하기 Micro Service Architecture
Netflix OSS
https://netflix.github.io/
Zuul, Eureka, Hystrix, Ribbon, Sleuth 등의 오픈소스를 Spring Boot 기반으로 통합.
개발자는 편하게 Spring 의 방식대로 설정하고 빌드 배포.
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
클라우드 네이티브는 클라우드 컴퓨팅 장점을 모두 활용하는 애플리케이션을 개발하고 실행하기 위한 접근 방식
클라우드는 데이터 센터를 운영할 자본 투자와 직원에 대한 집중도를 제거하는 대신 무한한 주문형 및 종량제 컴퓨팅 능력으로 대체
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
IaaS
Provisioning
Runtime
Orchestration
Application Definition & Development
Registry
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Docker
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Docker-Swarm
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Kubernetes
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Docker-Swarm & Kubernetes
설치와 클러스터 설정
• Easy and fast to install and configure
Docker 설치는 OS 패키지 관리자로 간단하게 설치.
Swarm을 사용하면 노드를 배치하고 클러스터에 가입.
사용 용이성을 위해 새로운 노드가 기존 클러스터에 관리자
또는 작업자로 참여하도록 허용하고 두 역할 사이의 노드를
원활하게 조율(승격 또는 강등) 시켜 유연성을 제공함.
• Takes some work to get up and running
etcd, flannel 및 docker 엔진과 같은 구성 요소를 함께 묶는 데
수 많은 수동 구성이 필요.
설치 방법은 OS마다 다름.
노드의 IP 주소, 각 노드가 수행 할 역할, 총 노드 수와 같이
클러스터 구성의 많은 부분을 미리 알아야함.
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Docker-Swarm & Kubernetes
컨테이너 설치
기능은 Docker API에 의존적으로 제공되며 제한됨.
Swarm API는 Docker에서 사용하던 친숙한 기능을 대부분을
제공하지만 모든 명령을 완전히 포함하지는 않음.
고유의 클라이언트, API 및 YAML 정의
Kubernetes는 자체 클라이언트, API 및 YAML 정의를 사용.
표준 Docker SW와 상이함.
Docker CLI 나 Docker Compose를 사용하여 컨테이너를
정의 할 수 없음.
확장성 (Scalability)
초대형 클러스터에서도 빠른 컨테이너 배포 및 확장
빠르게 컨테이너를 배포 할 수 있으므로 요구에 맞게 신속하게
시스템 운영 가능.
속도를 희생하여 강력한 클러스터 상태 보장
복잡성하고 통합된 API 집합을 제공하고 클러스터 상태에 대한
강력한 보장성을 제공하는 대신 컨테이너 배포 및 확장 속도
느림.
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Docker-Swarm & Kubernetes
고가용성 (High availability)
고 가용성은 컨테이너 복제 및 서비스 복제를 통해 제공
Kubernetes와 Docker Swarm은 복제를 통해 서비스의 고 가용성을 보장함.
같은 컨테이너를 여러 노드에 배포하여 복제 기능을 제공.
컨테이너를 단일 서버에서 실행할 수는 있지만 진정한 복제기능을 위해서는 추가 노드가 필요.
Load balancing
클러스터의 모든 노드를 통해 자동화 된 내부로드 균형 조정
Load balancing 기능을 기본으로 제공.
단일 클러스터 내의 모든 컨테이너는 모든 노드에서 모든
컨테이너에 연결할 수 있는 공통 네트워크에 가입됨.
Swarm의 노드를 통한 연결 요청은 내부적으로 서비스
인스턴스를 실행하는 노드로 리디렉션됨.
로드 균형 조정을 사용하려면 수동 서비스 구성이 필요.
Pods가 Service로 정의 될 때 로드 밸런싱 추가됨.
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Docker-Swarm & Kubernetes
Container updates and rollbacks
업데이트하는 동안 서비스를 유지하기위한 프로세스 스케줄링
컨테이너 업데이트는 스케쥴러가 새 이미지를 대신 사용하도록
알려줌으로써 수행.
그런 다음 업데이트가 단계적으로 롤 아웃되어 서비스 중단을
방지하며 잘못되면 롤백을 허용함.
업데이트를 통한 점진적 업데이트 및 서비스 상태 모니터링
업데이트 프로세스를 통해 서비스 상태를 점진적으로
모니터링하여 업데이트 프로세스 전반에서 가용성을 유지하며
서비스 중단을 방지하는 동시에 Pod 단위 변경.
Data Volumes
단순 공유 로컬 볼륨
Docker 데이터 볼륨은 하나 이상의 컨테이너에서 공유되는
디렉터리. 볼륨은 개별적으로 또는 컨테이너와 함께 생성되며
여러 컨테이너 간에 공유 가능.
볼륨 자체는 작성된 노드에서만 공유 가능.
글로벌 볼륨을 생성하기 위해 플러그인을 지원.
Pod 안에서 공유되는 볼륨
Kubernetes 볼륨은 컨테이너가 동일한 포드 내에서 데이터를
공유 할 수 있도록 하는 추상화 개념.
볼륨은 명시적인 유효 기간을 가지며 포함 된 Pod과 함께
작성되고 제거.
외부 데이터 볼륨 관리자를 지원하여 Pods간에 데이터 전송.
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Docker-Swarm & Kubernetes
Networking
자동 구성된 TLS 인증 및 컨테이너 네트워킹
모든 클러스터 노드에서 실행되는 컨테이너를 연결하는 다중
호스트 진입 네트워크 오버레이를 형성함.
더 많은 컨테이너 간 네트워크를 수동 구성 가능.
노드 간의 연결은 TLS 인증을 통해 보호.
일반적으로 컨테이너 네트워킹을 수행하기 위해 flannel 사용.
컨테이너는 가상 네트워크에 합류되고 etcd를 통해 발표됩니다.
TLS 인증도 가능하지만 모든 노드에 수동으로 인증서 생성 설치.
Service Discovery
클러스터 네트워크 전체에서 서비스를 검색 가능
Swarm 네트워킹은 서비스 검색을 크게 단순화함.
모든 컨테이너는 배포시 클러스터 전체 입구 네트워크
오버레이에 참가합니다. 컨테이너를 사용하면 기본 호스트와
상관없이 가상 사설 IP 주소 및 서비스 이름을 통해 통신 할 수
있습니다.
컨테이너는 쉽게 발견 할 수 있는 서비스로 정의
etcd에 의존하여 수동으로 발견 된 서비스를 정의.
컨테이너는 시작할 때 자신을 알리고 관련 정보를 분산 된 키 -
값 저장소에 추가.
DNS 서버 통신을 지원.
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Docker-Swarm & Kubernetes
Docker Swarm
Kubernetes
장점 단점
• 상대적으로 쉽고 빠른 설치
• 다른 Docker Tools랑 같이 사용 가능.
• 가벼운 설치
• 오픈소스
• Docker API 를 기반으로 되어 있어 상대적으로 제한
적인 기능 제공.
• 제한적인 장애 허용.
장점 단점
• 오픈소스이며 모듈화.
• 어떤 OS에서도 잘 실행됨.
• Pod을 기반으로 쉬운 서비스 구성 가능.
• 수년간의 전문 경험이 기반이 됨
• 다소 힘든 설치와 설정
• Docker CLI와 Compose Tool과 호환이 되지 않음.
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Spring Cloud on Kubernetes
Cloud Native Architecture Micro Service Architecture
Spring Cloud on Kubernetes
Architecture 마이크로 서비스 구성
클라우드 시스템 구성
Spring Cloud on Kubernetes
Architecture 마이크로 서비스 구성
Build & Deploy
Spring Cloud on Kubernetes
Architecture 마이크로 서비스 구성
Build & Deploy
Spring Cloud on Kubernetes
Architecture 마이크로 서비스 구성
시스템 구성도
Spring Cloud
Config
Config
Service Discovery
Gateway
- Service Routing
- Client-Side Load-balancing
- Fail-Over & Easy Scale-Out
- Cross-Cutting Concern
기능 공통화
- API L-C Management
- Token Relay (RBAC)
Sidecar
- Polyglot Support
- Non Java Platform Support
Hystrix
- Service Monitoring
Service Register
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Cloud Zuul
API GATEWAY
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Routing
Service Management
Micro Service
Edge Service
Service Registry
- Service Discovery
- Health check
Configuration
- Centralized Environment
Service Discovery
User Resource
Spring Cloud
Hystrix
Monitoring
Service Monitoring
Centralized Configuration
Spring Cloud
Zipkin
Trace
Distributed Trace Collect
External Git SCM
Spring Cloud on Kubernetes
Architecture 마이크로 서비스 구성
시스템 구성도
Spring Cloud Zuul
API GATEWAY
Spring Cloud
Config
Config
Spring Cloud
Hystrix
Monitoring
Spring Cloud
Zipkin
Trace
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Centralized
Configuration
Developer
DevOps Center
Service Monitoring
Distributed
Trace
IaaS
Configuration
Backend
Source
Continuous
Integration
Continuous
Delivery
Deployment
Docker Registry
Provisioning
Database
Storage
Master HA
Node
●●●●●●
클
레
임
볼
륨
추
상
화
Infra Operation
● Infra Automation
● Provisioning
● DevOps
● CI/CD
Spring Cloud on Kubernetes
Architecture 마이크로 서비스 구성
시스템 구성도
Developer
Continuous Integration
Data Structure
ManagementDeployment
Docker Registry
Source
Configuration
Management
Orchestration Database
Storage
Master HA
Node
●●●●●●
클
레
임
볼
륨
추
상
화
Docker Image
Docker Image Pull
Continuous Delivery
Binary Build
Application
Configuration
Spring Cloud on Kubernetes
Install Jenkins
Spring Cloud on Kubernetes
Install Tomcat Install Jenkins
http://tomcat.apache.org
http://apache.mirror.cdnetworks.com/tomcat/tomcat-9/v9.0.6/bin/apache-tomcat-9.0.6.tar.gz
$ tar xvfz apache-tomcat-9.0.6.tar.gz
압축 해제 후 적당한 폴더로 이동
Spring Cloud on Kubernetes
Install Jenkins Install Jenkins
https://jenkins.io
http://mirrors.jenkins.io/war-stable/latest/jenkins.war
$ mv jenkins.war <Tomcat-Home>/webapps/
$ <Tomcat-Home>/bin/startup.sh
Spring Cloud on Kubernetes
Configuration Jenkins Install Jenkins
http://localhost:8080/jenkins
cat /Users/ageofblue/.jenkins/secrets/initialAdminPassword
aa17d8af63f346e8b5a84db6687efefa
Spring Cloud on Kubernetes
Configuration Jenkins Install Jenkins
Install Plugin
Spring Cloud on Kubernetes
Configuration Jenkins Install Jenkins
Install Plugin
Spring Cloud on Kubernetes
Configuration Jenkins Install Jenkins
Install Plugin
Spring Cloud on Kubernetes
Configuration Jenkins Install Jenkins
Install Plugin
Spring Cloud on Kubernetes
Configuration Jenkins Install Jenkins
Install Plugin
Spring Cloud on Kubernetes
Configuration Jenkins Install Jenkins
Install Plugin
Spring Cloud on Kubernetes
Configuration Jenkins Install Jenkins
Install Plugin
Spring Cloud on Kubernetes
Build Kubernetes Cluster
Spring Cloud on Kubernetes
Install VirtualBox Build Kubernetes Cluster
Download URL
▪ https://www.virtualbox.org/wiki/Downloads
For OS X
▪ https://download.virtualbox.org/virtualbox/5.2.8/VirtualBox-5.2.8-121009-OSX.dmg
For Linux
▪ https://www.virtualbox.org/wiki/Linux_Downloads
For Windows
▪ https://download.virtualbox.org/virtualbox/5.2.8/VirtualBox-5.2.8-121009-Win.exe
Spring Cloud on Kubernetes
Install Docker Build Kubernetes Cluster
Download URL
▪ https://www.docker.com/community-edition#/download
For OS X
▪ https://store.docker.com/editions/community/docker-ce-desktop-mac
For Linux
▪ CENTOS : https://store.docker.com/editions/community/docker-ce-server-centos
▪ DEBIAN : https://store.docker.com/editions/community/docker-ce-server-debian
▪ FEDORA : https://store.docker.com/editions/community/docker-ce-server-fedora
▪ UBUNTU : https://store.docker.com/editions/community/docker-ce-server-ubuntu
For Windows
▪ https://store.docker.com/editions/community/docker-ce-desktop-windows
Spring Cloud on Kubernetes
Install Kubectl Build Kubernetes Cluster
For OSX
Download URL
▪ https://kubernetes.io/docs/tasks/tools/install-kubectl/
$ curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl –s
https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/darwin/amd64/kubectl
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin/kubectl
Spring Cloud on Kubernetes
Install Kubectl Build Kubernetes Cluster
For Linux
Download URL
▪ https://kubernetes.io/docs/tasks/tools/install-kubectl/
$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s
https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin/kubectl
Spring Cloud on Kubernetes
Install Kubectl Build Kubernetes Cluster
For Linux
Download URL
▪ https://kubernetes.io/docs/tasks/tools/install-kubectl/
EXE Download
▪ https://storage.googleapis.com/kubernetes-release/release/v1.9.0/bin/windows/amd64/kubectl.exe
PATH 추가
Spring Cloud on Kubernetes
Install minikube Build Kubernetes Cluster
Download URL
▪ https://github.com/kubernetes/minikube/releases
Spring Cloud on Kubernetes
Kubernetes Cluster Configuration Build Kubernetes Cluster
Start Cluster
$ minikube start --cpus 4 --memory 8192
Starting local Kubernetes v1.9.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.
Spring Cloud on Kubernetes
Kubernetes Cluster Configuration Build Kubernetes Cluster
Stop Cluster
$ minikube stop
Stopping local Kubernetes cluster...
Machine stopped.
Spring Cloud on Kubernetes
Kubernetes Cluster Configuration Build Kubernetes Cluster
Add hosts
$ minikube update-context
Kubeconfig IP correctly configured, pointing at 192.168.64.5
$ sudo vi /etc/hosts
~
~
192.168.64.5 eureka.k8s.com
192.168.64.5 config.k8s.com
192.168.64.5 hystrix.k8s.com
192.168.64.5 zipkin.k8s.com
192.168.64.5 api.k8s.com
192.168.64.5 user.k8s.com
192.168.64.5 client.k8s.com
Spring Cloud on Kubernetes
Kubernetes Cluster Configuration Build Kubernetes Cluster
Cluster Dashboard
$ minikube dashboard
Spring Cloud on Kubernetes
CI/CD
Spring Cloud on Kubernetes
Jenkins CI/CD
Jenkinsfile
#!groovy
node {
def git
def commitHash
def buildImage
stage('Checkout') {
git = checkout scm
commitHash = git.GIT_COMMIT
}
stage('Test') {
try{
sh './gradlew check'
} finally {
junit 'build/test-results/**/*.xml'
}
}
stage('Build') {
sh './gradlew build -x test'
}
Spring Cloud on Kubernetes
Jenkins CI/CD
Jenkinsfile
stage('Build Docker Image') {
buildImage = docker.build("hubtea/spring-cloud-hystrix:${commitHash}")
}
stage('Archive') {
parallel (
"Archive Artifacts" : {
archiveArtifacts artifacts: '**/build/libs/*.jar', fingerprint: true
},
"Docker Image Push" : {
buildImage.push("${commitHash}")
buildImage.push("latest")
}
)
}
stage('Kubernetes Deploy') {
sh 'kubectl apply --namespace=development -f deployment.yaml'
}
}
Spring Cloud on Kubernetes
Jenkins CI/CD
Dockerfile
FROM openjdk:8-jdk-alpine
LABEL maintainer="Leonardo Park"
VOLUME /tmp
ADD ./build/libs/app.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Xmx384m","-jar","/app.jar"]
Spring Cloud on Kubernetes
Jenkins CI/CD
Kubernetes Resource
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: hystrix
spec:
rules:
- host: hystrix.k8s.com
http:
paths:
- path: /
backend:
serviceName: hystrix
servicePort: 8080
Spring Cloud on Kubernetes
Jenkins CI/CD
Kubernetes Resource
kind: Service
apiVersion: v1
metadata:
name: hystrixa
spec:
type: ClusterIP
selector:
app: spring-cloud-hystrix
ports:
- protocol: TCP
port: 8080
targetPort: 8080
Spring Cloud on Kubernetes
Jenkins CI/CD
Kubernetes Resource
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: spring-cloud-hystrix
labels:
app: spring-cloud-hystrix
spec:
replicas: 1
selector:
matchLabels:
app: spring-cloud-hystrix
template:
spec:
hostname: hystrix
subdomain: hystrix
containers:
- name: spring-cloud-hystrix
image: hubtea/spring-cloud-hystrix:latest
env:
- name: SPRING_PROFILES_ACTIVE
value: dev
ports:
- name: http
containerPort: 8080
Spring Cloud on Kubernetes
Configuration
Spring Cloud on Kubernetes
Architecture Spring Cloud Config
시스템 구성도
Spring Cloud
Config
Config
Service Discovery
Gateway
- Service Routing
- Client-Side Load-balancing
- Fail-Over & Easy Scale-Out
- Cross-Cutting Concern
기능 공통화
- API L-C Management
- Token Relay (RBAC)
Sidecar
- Polyglot Support
- Non Java Platform Support
Hystrix
- Service Monitoring
Service Register
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Cloud Zuul
API GATEWAY
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Routing
Service Management
Micro Service
Edge Service
Service Registry
- Service Discovery
- Health check
Configuration
- Centralized Environment
Service Discovery
User Resource
Spring Cloud
Hystrix
Monitoring
Service Monitoring
Centralized Configuration
Spring Cloud
Zipkin
Trace
Distributed Trace Collect
External Git SCM
Spring Cloud on Kubernetes
Architecture Spring Cloud Config
시스템 구성도
Spring Cloud Zuul
API GATEWAY
Spring Cloud
Config
ConfigSpring Cloud
Hystrix
Monitoring
Spring Cloud
Zipkin
Trace
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Boot
User Service
Spring Boot
Client Service
Centralized
Configuration
Configuration
Backend
Spring Boot
GSP Console
Spring Cloud on Kubernetes
Source Spring Cloud Config
Application.java
package com.ktds.msa.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Spring Cloud on Kubernetes
Spring Cloud Config으로 환경 관리 Spring Cloud Config
application.yml
server:
port: 8080
spring:
cloud:
config:
server:
git:
uri: https://github.com/ageofblue/cloud-config-repo
endpoints:
shutdown:
enabled: true
sensitive: false
Spring Cloud on Kubernetes
Spring Cloud Config으로 환경 관리 Spring Cloud Config
Client bootstrap.yml
spring:
application:
name: apigw
cloud:
config:
uri: http://config.development.svc.cluster.local:8888
Spring Cloud on Kubernetes
Spring Cloud Config
Make Configuration Repository
Name
▪ spring-cloud-config-repo
Git URL
▪ https://github.com/<아이디>/spring-cloud-config-repo.git
Configuration
▪ <application name>-<profile>.yml
Spring Cloud on Kubernetes
Practice Spring Cloud Config
Spring Cloud on Kubernetes
Service Registry & Sidecar
Spring Cloud on Kubernetes
Architecture Service Registry & Sidecar
시스템 구성도
Spring Cloud
Config
Config
Service Discovery
Gateway
- Service Routing
- Client-Side Load-balancing
- Fail-Over & Easy Scale-Out
- Cross-Cutting Concern
기능 공통화
- API L-C Management
- Token Relay (RBAC)
Sidecar
- Polyglot Support
- Non Java Platform Support
Hystrix
- Service Monitoring
Service Register
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Cloud Zuul
API GATEWAY
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Routing
Service Management
Micro Service
Edge Service
Service Registry
- Service Discovery
- Health check
Configuration
- Centralized Environment
Service Discovery
User Resource
Spring Cloud
Hystrix
Monitoring
Service Monitoring
Centralized Configuration
Spring Cloud
Zipkin
Trace
Distributed Trace Collect
External Git SCM
Spring Cloud on Kubernetes
Architecture Service Registry & Sidecar
Spring Cloud Zuul
API GATEWAY
Spring Cloud
Hystrix
Monitoring
Spring Cloud
Zipkin
Trace
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Boot
User Service
Spring Boot
Client Service
Service Discovery
Service Register
Spring Cloud on Kubernetes
Eureka & Sidecar Service Registry & Sidecar
Netflix OSS
서비스 Registration, Discovery
Health Check
Spring Cloud on Kubernetes
Eureka & Sidecar Service Registry & Sidecar
Sidecar
Spring Cloud on Kubernetes
Eureka & Sidecar Service Registry & Sidecar
Eureka Dashboard
Spring Cloud on Kubernetes
Eureka & Sidecar Service Registry & Sidecar
Application.java
package com.ktds.msa.apireg;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Spring Cloud on Kubernetes
Eureka & Sidecar Service Registry & Sidecar
application.yml
server:
port: 8761
eureka:
instance:
hostname: localhost
leaseExpirationDurationInSeconds: 30
leaseRenewalIntervalInSeconds: 10
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
Spring Cloud on Kubernetes
Eureka & Sidecar Service Registry & Sidecar
Client Code
package com.ktds.msa.apireg;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@EnableEurekaClient
@EnableCircuitBreaker
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Spring Cloud on Kubernetes
Practice Service Registry & Sidecar
Spring Cloud on Kubernetes
Circuit Breaker
Spring Cloud on Kubernetes
Architecture Circuit Breaker
시스템 구성도
Spring Cloud
Config
Config
Service Discovery
Gateway
- Service Routing
- Client-Side Load-balancing
- Fail-Over & Easy Scale-Out
- Cross-Cutting Concern
기능 공통화
- API L-C Management
- Token Relay (RBAC)
Sidecar
- Polyglot Support
- Non Java Platform Support
Hystrix
- Service Monitoring
Service Register
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Cloud Zuul
API GATEWAY
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Routing
Service Management
Micro Service
Edge Service
Service Registry
- Service Discovery
- Health check
Configuration
- Centralized Environment
Service Discovery
User Resource
Spring Cloud
Hystrix
Monitoring
Service Monitoring
Centralized Configuration
Spring Cloud
Zipkin
Trace
Distributed Trace Collect
External Git SCM
Spring Cloud on Kubernetes
Architecture Circuit Breaker
Spring Cloud Zuul
API GATEWAYSpring Cloud
Hystrix
Monitoring
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Monitoring
Spring Cloud on Kubernetes
Circuit Breaker Pattern 구현하기 Circuit Breaker
Circuit Breaker Pattern 소개
분산 환경에서는 느린 네트워크 연결, 시간 초과 또는 일시적으로 사용할 수 없는 리소스와 같은 일시적인 장애로 인해 원격 리소스와
서비스 호출이 실패. Retry 패턴 과 같은 전략을 사용해 장애를 처리하도록 설계되어야 함
응용 프로그램은 작업 실패를 신속하게 처리하고 이런 종류의 장애를 적절하게 처리해야 함.
시스템의 한 부분에서 발생한 장애는 단계적 장애로 이어질 수 있음.
서비스를 호출하는 작업에 시간 제한을 구현한 뒤 서비스가 제한 시간 이내에 응답에 실패하는 경우 실패 메시지를 표시하도록 구성할
수 있으나 이런 전략으로 인해 동일한 작업에 대한 많은 동시 요청이 제한 시간이 경과할 때까지 차단되는 결과가 초래될 수 있는데, 이
렇게 차단된 요청은 메모리, 스레드, 데이터베이스 연결 등과 같은 중요한 시스템 리소스를 차지함.
동일한 리소스를 사용해야 하는 관련 없는 부분의 장애가 초래될 수 있음.
작업을 즉시 실패하게 하고 성공할 가능성이 있는 서비스의 호출만 시도하는 것이 바람직함.
Fault-Tolerance, Latency - Tolerance
Spring Cloud on Kubernetes
Circuit Breaker Pattern 구현하기 Circuit Breaker
Circuit Breaker Pattern 소개
응용 프로그램이 실패할 가능성이 있는 작업의 실행을 반복적으로 시도하지 못하도록 제어.
장애가 해결될 때까지 기다리거나 장애가 오래 지속되는 유형인지 여부를 결정하는 동안 CPU 사이클을 낭비하지 않고 계속 운영.
응용 프로그램이 문제가 해결되었다고 판단하면 작업의 호출을 시도.
Spring Cloud on Kubernetes
Circuit Breaker Pattern 구현하기 Circuit Breaker
Hystrix Dashboard
Spring Cloud on Kubernetes
Circuit Breaker Pattern 구현하기 Circuit Breaker
Circuit Breaker Pattern 소개
Spring Cloud on Kubernetes
Circuit Breaker Pattern 구현하기 Circuit Breaker
Circuit Breaker Pattern 소개
원의 색과 크기는 시스템 상태와
트래픽 볼륨을 표현함
2분간 요청률의 트래픽 추이를
표현함
서킷 브레이커스 상태를
표현
초당 요청 비율
10초내 에러를
백분율로 표현
10초내 에러를 백분율로 표현
클러스터에 리포팅 되는 호스트 수
Spring Cloud on Kubernetes
Circuit Breaker Pattern 구현하기 Circuit Breaker
Dashboard Application.java
import ...
@SpringBootApplication
@EnableHystrixDashboard
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Spring Cloud on Kubernetes
Circuit Breaker Pattern 구현하기 Circuit Breaker
Client Application.java
package com.ktds.msa.user;
import ...
@EnableEurekaClient
@EnableCircuitBreaker
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Spring Cloud on Kubernetes
Practice Circuit Breaker
Spring Cloud on Kubernetes
Trace
Spring Cloud on Kubernetes
Architecture Trace
시스템 구성도
Spring Cloud
Config
Config
Service Discovery
Gateway
- Service Routing
- Client-Side Load-balancing
- Fail-Over & Easy Scale-Out
- Cross-Cutting Concern
기능 공통화
- API L-C Management
- Token Relay (RBAC)
Sidecar
- Polyglot Support
- Non Java Platform Support
Hystrix
- Service Monitoring
Service Register
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Cloud Zuul
API GATEWAY
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Routing
Service Management
Micro Service
Edge Service
Service Registry
- Service Discovery
- Health check
Configuration
- Centralized Environment
Service Discovery
User Resource
Spring Cloud
Hystrix
Monitoring
Service Monitoring
Centralized Configuration
Spring Cloud
Zipkin
Trace
Distributed Trace Collect
External Git SCM
Spring Cloud on Kubernetes
Architecture Trace
시스템 구성도
Spring Cloud Zuul
API GATEWAY
Spring Cloud
Zipkin
Trace
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Distributed
Trace
Spring Cloud on Kubernetes
Api Trace 구현하기 Trace
Zipkin Server
Spring Cloud on Kubernetes
Api Trace 구현하기 Trace
Zipkin Server
Spring Cloud on Kubernetes
Api Trace 구현하기 Trace
Zipkin Server
Spring Cloud on Kubernetes
Api Trace 구현하기 Trace
API Side Configuration
spring:
zipkin:
baseUrl: http://ip-172-31-12-174.ap-northeast-2.compute.internal:9411sleuth:
sampler:
percentage: 0.2
Spring Cloud on Kubernetes
Api Trace 구현하기 Trace
API Side Dependency
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-zipkin’)
}
Spring Cloud on Kubernetes
Api Trace 구현하기 Trace
Zipkin Server
package com.ktds.msa.trace;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import zipkin.server.EnableZipkinServer;
@SpringBootApplication
@EnableEurekaClient
@EnableZipkinServer
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Spring Cloud on Kubernetes
Api Trace 구현하기 Trace
Zipkin Server
zipkin:
store:
type: mem
Spring Cloud on Kubernetes
Practice Trace
Spring Cloud on Kubernetes
OAuth
Spring Cloud on Kubernetes
Architecture OAuth
시스템 구성도
Spring Cloud
Config
Config
Service Discovery
Gateway
- Service Routing
- Client-Side Load-balancing
- Fail-Over & Easy Scale-Out
- Cross-Cutting Concern
기능 공통화
- API L-C Management
- Token Relay (RBAC)
Sidecar
- Polyglot Support
- Non Java Platform Support
Hystrix
- Service Monitoring
Service Register
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Cloud Zuul
API GATEWAY
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Routing
Service Management
Micro Service
Edge Service
Service Registry
- Service Discovery
- Health check
Configuration
- Centralized Environment
Service Discovery
User Resource
Spring Cloud
Hystrix
Monitoring
Service Monitoring
Centralized Configuration
Spring Cloud
Zipkin
Trace
Distributed Trace Collect
External Git SCM
Spring Cloud on Kubernetes
Architecture OAuth
시스템 구성도
Spring Cloud Zuul
API GATEWAY
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Boot
User Service
Spring Boot
Client Service
Service Discovery
Request with TokenRequest Token1 2
Spring Cloud on Kubernetes
Spring Cloud Oauth 인증서버 구현하기 OAuth
Oauth 란?
사실상 API 인증 표준.
Spring Cloud on Kubernetes
Spring Cloud Oauth 인증서버 구현하기 OAuth
Client Credentials Grant Flow
Spring Cloud on Kubernetes
Spring Cloud Oauth 인증서버 구현하기 OAuth
Resource Owner Password Credentials Grant Flow
Spring Cloud on Kubernetes
Spring Cloud Oauth 인증서버 구현하기 OAuth
Authorization Code Grant Flow
Spring Cloud on Kubernetes
Spring Cloud Oauth로 인증서버 구현하기 OAuth
AuthorizationConfiguration.java
package com.ktds.msa.oauth.config;
Import ...
@Configuration
@EnableAuthorizationServer
public class AuthorizationConfiguration extends AuthorizationServerConfigurerAdapter {
@Autowired
@Qualifier("authenticationManagerBean")
private AuthenticationManager authenticationManager;
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("client1").secret("1234567890").autoApprove(true).authorizedGrantTypes("client_cre
dentials", "password")
.scopes("read",
"write").authorities("ROLE_CLIENT").resourceIds("MSA").accessTokenValiditySeconds(60 * 10)
.refreshTokenValiditySeconds(60 * 10);
}
...
Spring Cloud on Kubernetes
Spring Cloud Oauth로 인증서버 구현하기 OAuth
AuthorizationConfiguration.java
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.tokenStore(tokenStore()).tokenEnhancer(jwtAccessTokenConverter()).authenticationManager(authenticati
onManager);
}
@Bean
public TokenStore tokenStore() {
return new JwtTokenStore(jwtAccessTokenConverter());
}
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
KeyStoreKeyFactory factory = new KeyStoreKeyFactory(new ClassPathResource("ktds.jks"),
"new1234!".toCharArray());
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
converter.setKeyPair(factory.getKeyPair("ktds"));
return converter;
}
Spring Cloud on Kubernetes
Practice OAuth
Spring Cloud on Kubernetes
Micro Service
Spring Cloud on Kubernetes
Architecture 마이크로 서비스 구성
시스템 구성도
Spring Cloud
Config
Config
Service Discovery
Gateway
- Service Routing
- Client-Side Load-balancing
- Fail-Over & Easy Scale-Out
- Cross-Cutting Concern
기능 공통화
- API L-C Management
- Token Relay (RBAC)
Sidecar
- Polyglot Support
- Non Java Platform Support
Hystrix
- Service Monitoring
Service Register
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Cloud Zuul
API GATEWAY
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Routing
Service Management
Micro Service
Edge Service
Service Registry
- Service Discovery
- Health check
Configuration
- Centralized Environment
Service Discovery
User Resource
Spring Cloud
Hystrix
Monitoring
Service Monitoring
Centralized Configuration
Spring Cloud
Zipkin
Trace
Distributed Trace Collect
External Git SCM
Spring Cloud on Kubernetes
마이크로 서비스의 구현 Micro Service
Spring Boot 기반으로 구현하기
@RestController 로 손쉽게 구현.
dependencies {
compile('org.springframework.boot:spring-boot-starter-web’)
}
Controller
Service
Repository
Domain
Spring Cloud on Kubernetes
Practice OAuth
Spring Cloud on Kubernetes
API Gateway
Spring Cloud on Kubernetes
Architecture API Gateway
시스템 구성도
Spring Cloud
Config
Config
Service Discovery
Gateway
- Service Routing
- Client-Side Load-balancing
- Fail-Over & Easy Scale-Out
- Cross-Cutting Concern
기능 공통화
- API L-C Management
- Token Relay (RBAC)
Sidecar
- Polyglot Support
- Non Java Platform Support
Hystrix
- Service Monitoring
Service Register
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Cloud Zuul
API GATEWAY
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Routing
Service Management
Micro Service
Edge Service
Service Registry
- Service Discovery
- Health check
Configuration
- Centralized Environment
Service Discovery
User Resource
Spring Cloud
Hystrix
Monitoring
Service Monitoring
Centralized Configuration
Spring Cloud
Zipkin
Trace
Distributed Trace Collect
External Git SCM
Spring Cloud on Kubernetes
Architecture API Gateway
시스템 구성도
Spring Cloud Zuul
API GATEWAY
Spring Cloud Eureka
API REGISTRY
Spring Cloud OAuth
OAUTH
Spring Boot
User Service
Spring Boot
Client Service
NodeJS
User Interface
Service Discovery
Request
Spring Cloud on Kubernetes
Zuul 기반으로 API Gateway 구현하기 API Gateway
Spring Cloud Netflix Zuul
Netflix 사에서의 본인 들의 서비스 클라우드 환경에서 글로벌로 서비스하기 위해서 만든 API Gateway
Open Source .
Apache License 2.0
Java 언어로 만들어짐.
Spring Cloud on Kubernetes
Zuul 기반으로 API Gateway 구현하기 API Gateway
Spring Cloud Netflix Zuul
Netflix 사에서의 본인 들의 서비스 클라우드 환경에서 글로벌로 서비스하기 위해서 만든 API Gateway
Open Source .
Apache License 2.0
Java 언어로 만들어짐.
Spring Cloud on Kubernetes
Zuul 기반으로 API Gateway 구현하기 API Gateway
Spring Cloud Netflix Zuul
Spring Cloud on Kubernetes
Zuul 기반으로 API Gateway 구현하기 API Gateway
Application.java
package com.ktds.msa.apigw;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
@SpringBootApplication
@EnableZuulProxy
@EnableEurekaClient
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Spring Cloud on Kubernetes
Zuul 기반으로 API Gateway 구현하기 API Gateway
application.yml
server:
port: 9090
spring:
application:
name: API-GW
zuul:
routes:
api:
path: /api/**
serviceId: API-PORTAL
stripPrefix: true
eureka:
client:
registerWithEureka: true
fetchRegistry: true
instance:
leaseRenewalIntervalInSeconds: 1
leaseExpirationDurationInSeconds: 2
preferIpAddress: true
Spring Cloud on Kubernetes
Zuul 기반으로 API Gateway 구현하기 API Gateway
application.yml
security:
oauth2:
resource:
id: KTDS-RESOURCE
loadBalanced: true
jwt:
keyValue: -----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAse3h8oBH3KzQo/2bm2d0
R1o1GZfCsxvlAWFrXYf/IBQ4ciUuZ9l7Xy1bqFJTU4XfbRcDL2j1YOnBm+35ejSV
UDjDTZYG3A23W/fsSrQJZ4asjbaXDxToYSDyVE/tE2pNsv7sGK3buJLZhKsYzDgt
30b1UQypfSgwj9R3rpAGARG6Mk4DuqXJJRkV3wfTwe/3jSBxfs28rMNcKZB8LWq3
I0EgQkGlxQ09AjcYuWqHlmXf4feHDVSWL8fobaE/mNZ+bBaK6Meb3eNBFJndE/GS
xMJ8Dmsfc/pmX7YiblDWwXj9rGFNaQYBEf7JJsf/CzE19TuhojzavTepfRQV/omZ
2QIDAQAB
-----END PUBLIC KEY-----
Spring Cloud on Kubernetes
Practice API Gateways

Más contenido relacionado

La actualidad más candente

[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)Open Source Consulting
 
Building .NET Microservices
Building .NET MicroservicesBuilding .NET Microservices
Building .NET MicroservicesVMware Tanzu
 
Kubernetes Networking 101
Kubernetes Networking 101Kubernetes Networking 101
Kubernetes Networking 101Weaveworks
 
MSA ( Microservices Architecture ) 발표 자료 다운로드
MSA ( Microservices Architecture ) 발표 자료 다운로드MSA ( Microservices Architecture ) 발표 자료 다운로드
MSA ( Microservices Architecture ) 발표 자료 다운로드Opennaru, inc.
 
Kubernetes
KubernetesKubernetes
KubernetesHenry He
 
Autoscaling Kubernetes
Autoscaling KubernetesAutoscaling Kubernetes
Autoscaling Kubernetescraigbox
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudEberhard Wolff
 
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해Terry Cho
 
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브Open Source Consulting
 
SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개
SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개
SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개CURVC Corp
 
Open infradays 2019_msa_k8s
Open infradays 2019_msa_k8sOpen infradays 2019_msa_k8s
Open infradays 2019_msa_k8sHyoungjun Kim
 
Getting Started with Kubernetes
Getting Started with Kubernetes Getting Started with Kubernetes
Getting Started with Kubernetes VMware Tanzu
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopBob Killen
 
Microservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring CloudMicroservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring CloudEberhard Wolff
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack ArchitectureMirantis
 
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개if kakao
 
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축Ji-Woong Choi
 
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20Amazon Web Services Korea
 

La actualidad más candente (20)

[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
 
Building .NET Microservices
Building .NET MicroservicesBuilding .NET Microservices
Building .NET Microservices
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
Kubernetes Networking 101
Kubernetes Networking 101Kubernetes Networking 101
Kubernetes Networking 101
 
MSA ( Microservices Architecture ) 발표 자료 다운로드
MSA ( Microservices Architecture ) 발표 자료 다운로드MSA ( Microservices Architecture ) 발표 자료 다운로드
MSA ( Microservices Architecture ) 발표 자료 다운로드
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Autoscaling Kubernetes
Autoscaling KubernetesAutoscaling Kubernetes
Autoscaling Kubernetes
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
 
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
소프트웨어 개발 트랜드 및 MSA (마이크로 서비스 아키텍쳐)의 이해
 
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
[열린기술공방] Container기반의 DevOps - 클라우드 네이티브
 
SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개
SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개
SonarQube와 함께하는 소프트웨어 품질 세미나 - SonarQube 소개
 
Open infradays 2019_msa_k8s
Open infradays 2019_msa_k8sOpen infradays 2019_msa_k8s
Open infradays 2019_msa_k8s
 
Getting Started with Kubernetes
Getting Started with Kubernetes Getting Started with Kubernetes
Getting Started with Kubernetes
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
 
Microservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring CloudMicroservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring Cloud
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack Architecture
 
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
 
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20
 

Similar a Spring cloud on kubernetes

[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기Amazon Web Services Korea
 
클라우드 네이티브를 위한 Confluent Cloud
클라우드 네이티브를 위한 Confluent Cloud클라우드 네이티브를 위한 Confluent Cloud
클라우드 네이티브를 위한 Confluent Cloudconfluent
 
Deployment techniques for cloud native
Deployment techniques for cloud nativeDeployment techniques for cloud native
Deployment techniques for cloud nativeAlex Jeong
 
[오픈테크넷서밋2022] 국내 PaaS(Kubernetes) Best Practice 및 DevOps 환경 구축 사례.pdf
[오픈테크넷서밋2022] 국내 PaaS(Kubernetes) Best Practice 및 DevOps 환경 구축 사례.pdf[오픈테크넷서밋2022] 국내 PaaS(Kubernetes) Best Practice 및 DevOps 환경 구축 사례.pdf
[오픈테크넷서밋2022] 국내 PaaS(Kubernetes) Best Practice 및 DevOps 환경 구축 사례.pdfOpen Source Consulting
 
유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)
유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)
유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)uEngine Solutions
 
클라우드 네이티브로 가는길 - AWS 컨테이너 서비스 파헤치기 - 최진영 AWS 테크니컬 트레이너 / 배주혁 소프트웨어 엔지니어, 삼성전자...
클라우드 네이티브로 가는길 - AWS 컨테이너 서비스 파헤치기 - 최진영 AWS 테크니컬 트레이너 / 배주혁 소프트웨어 엔지니어, 삼성전자...클라우드 네이티브로 가는길 - AWS 컨테이너 서비스 파헤치기 - 최진영 AWS 테크니컬 트레이너 / 배주혁 소프트웨어 엔지니어, 삼성전자...
클라우드 네이티브로 가는길 - AWS 컨테이너 서비스 파헤치기 - 최진영 AWS 테크니컬 트레이너 / 배주혁 소프트웨어 엔지니어, 삼성전자...Amazon Web Services Korea
 
Kubernetes & Istio in Multi-Cloud
Kubernetes & Istio in Multi-Cloud Kubernetes & Istio in Multi-Cloud
Kubernetes & Istio in Multi-Cloud Sangwon Seo
 
Confluent Tech Talk
Confluent Tech TalkConfluent Tech Talk
Confluent Tech Talkconfluent
 
Cloud-Barista 제6차 오픈 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
Cloud-Barista 제6차 오픈 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)Cloud-Barista 제6차 오픈 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
Cloud-Barista 제6차 오픈 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)Cloud-Barista Community
 
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...Amazon Web Services Korea
 
애플리케이션 최적화를 위한 컨테이너 인프라 구축
애플리케이션 최적화를 위한 컨테이너 인프라 구축애플리케이션 최적화를 위한 컨테이너 인프라 구축
애플리케이션 최적화를 위한 컨테이너 인프라 구축rockplace
 
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...Cloud-Barista Community
 
Openshift 활용을 위한 Application의 준비, Cloud Native
Openshift 활용을 위한 Application의 준비, Cloud NativeOpenshift 활용을 위한 Application의 준비, Cloud Native
Openshift 활용을 위한 Application의 준비, Cloud Nativerockplace
 
Toward kubernetes native data center
Toward kubernetes native data centerToward kubernetes native data center
Toward kubernetes native data center어형 이
 
데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online Series
데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online Series데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online Series
데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online SeriesAmazon Web Services Korea
 
Nexclipper_1905_summary_kor
Nexclipper_1905_summary_korNexclipper_1905_summary_kor
Nexclipper_1905_summary_korJinyong Kim
 
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원BESPIN GLOBAL
 
[OpenInfra Days Korea 2018] (Track 2) - OpenStack 기반의 IaaS, PaaS 통합 Orchestra...
[OpenInfra Days Korea 2018] (Track 2) - OpenStack 기반의 IaaS, PaaS 통합 Orchestra...[OpenInfra Days Korea 2018] (Track 2) - OpenStack 기반의 IaaS, PaaS 통합 Orchestra...
[OpenInfra Days Korea 2018] (Track 2) - OpenStack 기반의 IaaS, PaaS 통합 Orchestra...OpenStack Korea Community
 
Cloud-Barista 제7차 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
Cloud-Barista 제7차 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)Cloud-Barista 제7차 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
Cloud-Barista 제7차 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)Cloud-Barista Community
 
Cloud market trends, what is kubernets? (Korean)
Cloud market trends, what is kubernets? (Korean)Cloud market trends, what is kubernets? (Korean)
Cloud market trends, what is kubernets? (Korean)DonghwanKim85
 

Similar a Spring cloud on kubernetes (20)

[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
 
클라우드 네이티브를 위한 Confluent Cloud
클라우드 네이티브를 위한 Confluent Cloud클라우드 네이티브를 위한 Confluent Cloud
클라우드 네이티브를 위한 Confluent Cloud
 
Deployment techniques for cloud native
Deployment techniques for cloud nativeDeployment techniques for cloud native
Deployment techniques for cloud native
 
[오픈테크넷서밋2022] 국내 PaaS(Kubernetes) Best Practice 및 DevOps 환경 구축 사례.pdf
[오픈테크넷서밋2022] 국내 PaaS(Kubernetes) Best Practice 및 DevOps 환경 구축 사례.pdf[오픈테크넷서밋2022] 국내 PaaS(Kubernetes) Best Practice 및 DevOps 환경 구축 사례.pdf
[오픈테크넷서밋2022] 국내 PaaS(Kubernetes) Best Practice 및 DevOps 환경 구축 사례.pdf
 
유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)
유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)
유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)
 
클라우드 네이티브로 가는길 - AWS 컨테이너 서비스 파헤치기 - 최진영 AWS 테크니컬 트레이너 / 배주혁 소프트웨어 엔지니어, 삼성전자...
클라우드 네이티브로 가는길 - AWS 컨테이너 서비스 파헤치기 - 최진영 AWS 테크니컬 트레이너 / 배주혁 소프트웨어 엔지니어, 삼성전자...클라우드 네이티브로 가는길 - AWS 컨테이너 서비스 파헤치기 - 최진영 AWS 테크니컬 트레이너 / 배주혁 소프트웨어 엔지니어, 삼성전자...
클라우드 네이티브로 가는길 - AWS 컨테이너 서비스 파헤치기 - 최진영 AWS 테크니컬 트레이너 / 배주혁 소프트웨어 엔지니어, 삼성전자...
 
Kubernetes & Istio in Multi-Cloud
Kubernetes & Istio in Multi-Cloud Kubernetes & Istio in Multi-Cloud
Kubernetes & Istio in Multi-Cloud
 
Confluent Tech Talk
Confluent Tech TalkConfluent Tech Talk
Confluent Tech Talk
 
Cloud-Barista 제6차 오픈 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
Cloud-Barista 제6차 오픈 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)Cloud-Barista 제6차 오픈 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
Cloud-Barista 제6차 오픈 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
 
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...
 
애플리케이션 최적화를 위한 컨테이너 인프라 구축
애플리케이션 최적화를 위한 컨테이너 인프라 구축애플리케이션 최적화를 위한 컨테이너 인프라 구축
애플리케이션 최적화를 위한 컨테이너 인프라 구축
 
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
 
Openshift 활용을 위한 Application의 준비, Cloud Native
Openshift 활용을 위한 Application의 준비, Cloud NativeOpenshift 활용을 위한 Application의 준비, Cloud Native
Openshift 활용을 위한 Application의 준비, Cloud Native
 
Toward kubernetes native data center
Toward kubernetes native data centerToward kubernetes native data center
Toward kubernetes native data center
 
데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online Series
데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online Series데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online Series
데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online Series
 
Nexclipper_1905_summary_kor
Nexclipper_1905_summary_korNexclipper_1905_summary_kor
Nexclipper_1905_summary_kor
 
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
Session 1. 디지털 트렌스포메이션의 핵심, 클라우드 마이그레이션 A to Z - 베스핀글로벌 이근우 위원
 
[OpenInfra Days Korea 2018] (Track 2) - OpenStack 기반의 IaaS, PaaS 통합 Orchestra...
[OpenInfra Days Korea 2018] (Track 2) - OpenStack 기반의 IaaS, PaaS 통합 Orchestra...[OpenInfra Days Korea 2018] (Track 2) - OpenStack 기반의 IaaS, PaaS 통합 Orchestra...
[OpenInfra Days Korea 2018] (Track 2) - OpenStack 기반의 IaaS, PaaS 통합 Orchestra...
 
Cloud-Barista 제7차 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
Cloud-Barista 제7차 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)Cloud-Barista 제7차 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
Cloud-Barista 제7차 컨퍼런스 : 멀티클라우드 애플리케이션 실행환경 통합 관리 (CB-Ladybug)
 
Cloud market trends, what is kubernets? (Korean)
Cloud market trends, what is kubernets? (Korean)Cloud market trends, what is kubernets? (Korean)
Cloud market trends, what is kubernets? (Korean)
 

Spring cloud on kubernetes

  • 1. Spring Cloud로 개발하는 Micro Service Architecture Leonardo Park Spring Cloud on Kubernetes
  • 2. Spring Cloud on Kubernetes 소개 Leonardo Park codingman@outlook.krcodingman 쿠팡_ Software Engineer API Gateway 담당 ktds_Application Architecture Giga ginie 개발자 포털 IoT Makers Platform, 한글과컴퓨터_ 선임연구원 Webkit, ePub Rendering, HWP Filter 엠군미디어_ 선임연구원 ffmpeg, Live Streaming, Server Side Encoding
  • 3. Spring Cloud on Kubernetes Prerequisite Tools
  • 4. Spring Cloud on Kubernetes SDKMAN Prerequisite Tools MAC OS & Linux User only http://sdkman.io/install.html curl -s "https://get.sdkman.io" | bash
  • 5. Spring Cloud on Kubernetes Install Java Prerequisite Tools $ sdk list java ================================================================================ Available Java Versions ================================================================================ 9u181-openjdk 9.0.4-zulu 9.0.4-oracle 9.0.1-zulu 9.0.0-zulu 8u161-oracle 8u152-zulu 10u23-openjdk ================================================================================ + - local version * - installed > - currently in use ================================================================================ $ sdk install java 8u152-zulu
  • 6. Spring Cloud on Kubernetes Install Gradle Prerequisite Tools $ sdk list gradle ================================================================================ Available Gradle Versions ================================================================================ 4.6-rc-2 4.3.1 3.5 2.2.1 4.6-rc-1 4.3-rc-4 3.4.1 2.2 4.6 4.3-rc-3 3.4 2.14.1 4.5.1 4.3-rc-2 3.3 2.14 4.5-rc-2 4.3-rc-1 3.2.1 2.13 4.5-rc-1 4.3 3.2 2.12 ~ ================================================================================ + - local version * - installed > - currently in use ================================================================================ $ sdk install gradle 4.6
  • 7. Spring Cloud on Kubernetes Install IntelliJ Prerequisite Tools https://www.jetbrains.com/idea/
  • 8. Spring Cloud on Kubernetes Create Accounts
  • 9. Spring Cloud on Kubernetes Docker hub Create Accounts https://hub.docker.com
  • 10. Spring Cloud on Kubernetes Github https://github.com
  • 11. Spring Cloud on Kubernetes Micro Service Architecture
  • 12. Spring Cloud on Kubernetes MSA 빠르게 알아보기 Micro Service Architecture 전통적인 애플리케이션 개발 모노리딕 아키텍쳐(Monolithic Architecture) 하나의 애플리케이션이 하나의 모듈에 모두 들어가 있는 구조. 업무 컴포넌트들이 모두 하나의 강 결합 구조로 연결됨. 강결합의 Call By Ref 형태로 성능 상 많이 유리함. 작은 크기의 애플리케이션에는 유리함. 하나의 모듈 수정을 위해 전체 애플리케이션을 재 배포하는 구조. 모듈의 크기가 크기 때문에, 빌드 및 배포 시간, 서버의 기동 시간이 오래 걸림. 통일성 있는 아키텍처 기술구조를 가짐. … DATABASE 애플리케이션 JBOSS JSP 사용자 상품 주문 재고 이벤트 배송
  • 13. Spring Cloud on Kubernetes MSA 빠르게 알아보기 Micro Service Architecture 기술과 문화의 발전 데이터와 애플리케이션을 설계하는 경우 업무 도메인별로 분리하여 설계 하는 방식 하드웨어 가상화, 네트워크 가상화 등의 기술의 발전으로 컴퓨팅 자원에 대한 기 지속적인 통합과 배포를 통한 비즈니스 신속성과 시스템 안정성을 위한 기술 요구사항이나 시스템의 성격에 맞는 프로그래밍 언어를 이용하여 시스템을 개발하는 방식 클라우드 컴퓨팅 자원을 프로그래밍을 통해 자동화 하여 시스템 안정성을 확보하는 기술 비즈니스를 신속하게 지원할 수 있는 개발 방법론 개발과 운영을 하나의 팀에서 모두 수행하는 시스템 개발/운영 방식 Domain Driven Development Cloud Computing CI / CD Polyglot Programming Infrastructure Automation Agile Development DevOps
  • 14. Spring Cloud on Kubernetes MSA 빠르게 알아보기 Micro Service Architecture 마이크로 서비스 아키텍처 (Micro Service Architecture) 업무 모듈을 마이크로 서비스 단위로 분리하고 경량화 된 메시지를 통하여 통신. 서비스별 데이터도 역시 분리 하여 구성 서비스별 기능/비 기능 요구사항에 맞는 다양한 기술 사용. 클라우드의 인프라 기능을 적극적으로 활용하여 시스템 구성 마이크로 서비스 배포의 자동화 및 전체 서비스에 대한 영향 최소화 개발과 운영을 같은 모듈의 팀에서 수행 API Gateway 사용자서비스 사용자 DATA BASE 상품서비스 상품 DATA BASE 주문서비스 주문 DATA BASE 재고서비스 재고 DATA BASE 이벤트서비스 이벤트 DATA BASE 배송서비스 배송 DATA BASE 프론트엔드 UI Session Storage Polyglot Programming Cloud Computing Infrastructure Automation CI / CD DevOps Domain Driven Development Agile Development Lightweight Communication
  • 15. Spring Cloud on Kubernetes MSA 빠르게 알아보기 Micro Service Architecture 전통적인 아키텍처와 마이크로 서비스 User Interface Business Logic Data Access Layer Database User Interface (SPA or Mobile …) Micro Service Database Micro Service Micro Service Database Database Monolithic Architecture Micro Service Architecture
  • 16. Spring Cloud on Kubernetes MSA 빠르게 알아보기 Micro Service Architecture 마이크로 서비스란? 작고 API로 다른 서비스와 연계하는 자율적이며 한가지일을 잘하는데 초점이 맞춰진 서비스 서비스별 독자적인 데이터베이스 어떤 언어로 개발해도 상관없음. 서비스 별로 팀 구성 (컨웨이의 법칙)
  • 17. Spring Cloud on Kubernetes MSA 빠르게 알아보기 Micro Service Architecture 12 Factors App I. 코드베이스 : 버전 관리되는 하나의 코드베이스와 다양한 배포 II. 종속성 : 명시적으로 선언되고 분리된 종속성 III. 설정 : 환경(environment)에 저장된 설정 IV. 백엔드 서비스 : 백엔드 서비스를 연결된 리소스로 취급 V. 빌드, 릴리즈, 실행 : 철저하게 분리된 빌드와 실행 단계 VI. 프로세스 : 애플리케이션을 하나 혹은 여러 개의 무 상태(stateless) 프로세스로 실행 VII. 포트 바인딩 : 포트 바인딩을 사용해서 서비스를 공개함 VIII. 동시성(Concurrency) : 프로세스 모델을 사용한 확장 IX. 폐기 가능(Disposability) : 빠른 시작과 안정적인 종료 (graceful shutdown)을 통한 안정성 극대화 X. dev/prod 일치 : development, staging, production 환경을 최대한 비슷하게 유지 XI. 로그 : 로그를 이벤트 스트림으로 취급 XII. Admin 프로세스 : admin/maintenance 작업을 일회성 프로세스로 실행
  • 18. Spring Cloud on Kubernetes MSA 빠르게 알아보기 Micro Service Architecture 마이크로 서비스 아키텍처를 위한 준비 실력이 전체적으로 좋은 조직이 운영 가능. DevOps 가 가능해야 함. 좋은 커뮤니케이션 문화가 전제 되어야 함. 서비스나 솔루션 개발에 적당하고… (SI 개발에서는 적당하지 않음) 테스트가 어려움. 경험이 많은 개발자가 필요함. 여러가지 언어와 신기술 난무 – 계속하여 공부
  • 19. Spring Cloud on Kubernetes Micro Service Architecture 이해하기 Micro Service Architecture Spring Cloud 분산 시스템 환경에서 많이 사용하는 설계 패턴을 개발자가 빠르게 개발할 수 있는 툴을 제공. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one- time tokens, global locks, leadership election, distributed sessions, cluster state Spring Framework 4 Java 1.7+ Spring Boot Spring Cloud Netflix OSS
  • 20. Spring Cloud on Kubernetes Micro Service Architecture 이해하기 Micro Service Architecture Netflix OSS https://netflix.github.io/ Zuul, Eureka, Hystrix, Ribbon, Sleuth 등의 오픈소스를 Spring Boot 기반으로 통합. 개발자는 편하게 Spring 의 방식대로 설정하고 빌드 배포.
  • 21. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture 클라우드 네이티브는 클라우드 컴퓨팅 장점을 모두 활용하는 애플리케이션을 개발하고 실행하기 위한 접근 방식 클라우드는 데이터 센터를 운영할 자본 투자와 직원에 대한 집중도를 제거하는 대신 무한한 주문형 및 종량제 컴퓨팅 능력으로 대체
  • 22. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture
  • 23. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture IaaS Provisioning Runtime Orchestration Application Definition & Development Registry
  • 24. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture
  • 25. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture
  • 26. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture Docker
  • 27. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture Docker-Swarm
  • 28. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture Kubernetes
  • 29. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture Docker-Swarm & Kubernetes 설치와 클러스터 설정 • Easy and fast to install and configure Docker 설치는 OS 패키지 관리자로 간단하게 설치. Swarm을 사용하면 노드를 배치하고 클러스터에 가입. 사용 용이성을 위해 새로운 노드가 기존 클러스터에 관리자 또는 작업자로 참여하도록 허용하고 두 역할 사이의 노드를 원활하게 조율(승격 또는 강등) 시켜 유연성을 제공함. • Takes some work to get up and running etcd, flannel 및 docker 엔진과 같은 구성 요소를 함께 묶는 데 수 많은 수동 구성이 필요. 설치 방법은 OS마다 다름. 노드의 IP 주소, 각 노드가 수행 할 역할, 총 노드 수와 같이 클러스터 구성의 많은 부분을 미리 알아야함.
  • 30. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture Docker-Swarm & Kubernetes 컨테이너 설치 기능은 Docker API에 의존적으로 제공되며 제한됨. Swarm API는 Docker에서 사용하던 친숙한 기능을 대부분을 제공하지만 모든 명령을 완전히 포함하지는 않음. 고유의 클라이언트, API 및 YAML 정의 Kubernetes는 자체 클라이언트, API 및 YAML 정의를 사용. 표준 Docker SW와 상이함. Docker CLI 나 Docker Compose를 사용하여 컨테이너를 정의 할 수 없음. 확장성 (Scalability) 초대형 클러스터에서도 빠른 컨테이너 배포 및 확장 빠르게 컨테이너를 배포 할 수 있으므로 요구에 맞게 신속하게 시스템 운영 가능. 속도를 희생하여 강력한 클러스터 상태 보장 복잡성하고 통합된 API 집합을 제공하고 클러스터 상태에 대한 강력한 보장성을 제공하는 대신 컨테이너 배포 및 확장 속도 느림.
  • 31. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture Docker-Swarm & Kubernetes 고가용성 (High availability) 고 가용성은 컨테이너 복제 및 서비스 복제를 통해 제공 Kubernetes와 Docker Swarm은 복제를 통해 서비스의 고 가용성을 보장함. 같은 컨테이너를 여러 노드에 배포하여 복제 기능을 제공. 컨테이너를 단일 서버에서 실행할 수는 있지만 진정한 복제기능을 위해서는 추가 노드가 필요. Load balancing 클러스터의 모든 노드를 통해 자동화 된 내부로드 균형 조정 Load balancing 기능을 기본으로 제공. 단일 클러스터 내의 모든 컨테이너는 모든 노드에서 모든 컨테이너에 연결할 수 있는 공통 네트워크에 가입됨. Swarm의 노드를 통한 연결 요청은 내부적으로 서비스 인스턴스를 실행하는 노드로 리디렉션됨. 로드 균형 조정을 사용하려면 수동 서비스 구성이 필요. Pods가 Service로 정의 될 때 로드 밸런싱 추가됨.
  • 32. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture Docker-Swarm & Kubernetes Container updates and rollbacks 업데이트하는 동안 서비스를 유지하기위한 프로세스 스케줄링 컨테이너 업데이트는 스케쥴러가 새 이미지를 대신 사용하도록 알려줌으로써 수행. 그런 다음 업데이트가 단계적으로 롤 아웃되어 서비스 중단을 방지하며 잘못되면 롤백을 허용함. 업데이트를 통한 점진적 업데이트 및 서비스 상태 모니터링 업데이트 프로세스를 통해 서비스 상태를 점진적으로 모니터링하여 업데이트 프로세스 전반에서 가용성을 유지하며 서비스 중단을 방지하는 동시에 Pod 단위 변경. Data Volumes 단순 공유 로컬 볼륨 Docker 데이터 볼륨은 하나 이상의 컨테이너에서 공유되는 디렉터리. 볼륨은 개별적으로 또는 컨테이너와 함께 생성되며 여러 컨테이너 간에 공유 가능. 볼륨 자체는 작성된 노드에서만 공유 가능. 글로벌 볼륨을 생성하기 위해 플러그인을 지원. Pod 안에서 공유되는 볼륨 Kubernetes 볼륨은 컨테이너가 동일한 포드 내에서 데이터를 공유 할 수 있도록 하는 추상화 개념. 볼륨은 명시적인 유효 기간을 가지며 포함 된 Pod과 함께 작성되고 제거. 외부 데이터 볼륨 관리자를 지원하여 Pods간에 데이터 전송.
  • 33. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture Docker-Swarm & Kubernetes Networking 자동 구성된 TLS 인증 및 컨테이너 네트워킹 모든 클러스터 노드에서 실행되는 컨테이너를 연결하는 다중 호스트 진입 네트워크 오버레이를 형성함. 더 많은 컨테이너 간 네트워크를 수동 구성 가능. 노드 간의 연결은 TLS 인증을 통해 보호. 일반적으로 컨테이너 네트워킹을 수행하기 위해 flannel 사용. 컨테이너는 가상 네트워크에 합류되고 etcd를 통해 발표됩니다. TLS 인증도 가능하지만 모든 노드에 수동으로 인증서 생성 설치. Service Discovery 클러스터 네트워크 전체에서 서비스를 검색 가능 Swarm 네트워킹은 서비스 검색을 크게 단순화함. 모든 컨테이너는 배포시 클러스터 전체 입구 네트워크 오버레이에 참가합니다. 컨테이너를 사용하면 기본 호스트와 상관없이 가상 사설 IP 주소 및 서비스 이름을 통해 통신 할 수 있습니다. 컨테이너는 쉽게 발견 할 수 있는 서비스로 정의 etcd에 의존하여 수동으로 발견 된 서비스를 정의. 컨테이너는 시작할 때 자신을 알리고 관련 정보를 분산 된 키 - 값 저장소에 추가. DNS 서버 통신을 지원.
  • 34. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture Docker-Swarm & Kubernetes Docker Swarm Kubernetes 장점 단점 • 상대적으로 쉽고 빠른 설치 • 다른 Docker Tools랑 같이 사용 가능. • 가벼운 설치 • 오픈소스 • Docker API 를 기반으로 되어 있어 상대적으로 제한 적인 기능 제공. • 제한적인 장애 허용. 장점 단점 • 오픈소스이며 모듈화. • 어떤 OS에서도 잘 실행됨. • Pod을 기반으로 쉬운 서비스 구성 가능. • 수년간의 전문 경험이 기반이 됨 • 다소 힘든 설치와 설정 • Docker CLI와 Compose Tool과 호환이 되지 않음.
  • 35. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture
  • 36. Spring Cloud on Kubernetes Cloud Native Architecture Micro Service Architecture
  • 37. Spring Cloud on Kubernetes Architecture 마이크로 서비스 구성 클라우드 시스템 구성
  • 38. Spring Cloud on Kubernetes Architecture 마이크로 서비스 구성 Build & Deploy
  • 39. Spring Cloud on Kubernetes Architecture 마이크로 서비스 구성 Build & Deploy
  • 40. Spring Cloud on Kubernetes Architecture 마이크로 서비스 구성 시스템 구성도 Spring Cloud Config Config Service Discovery Gateway - Service Routing - Client-Side Load-balancing - Fail-Over & Easy Scale-Out - Cross-Cutting Concern 기능 공통화 - API L-C Management - Token Relay (RBAC) Sidecar - Polyglot Support - Non Java Platform Support Hystrix - Service Monitoring Service Register Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Cloud Zuul API GATEWAY Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Routing Service Management Micro Service Edge Service Service Registry - Service Discovery - Health check Configuration - Centralized Environment Service Discovery User Resource Spring Cloud Hystrix Monitoring Service Monitoring Centralized Configuration Spring Cloud Zipkin Trace Distributed Trace Collect External Git SCM
  • 41. Spring Cloud on Kubernetes Architecture 마이크로 서비스 구성 시스템 구성도 Spring Cloud Zuul API GATEWAY Spring Cloud Config Config Spring Cloud Hystrix Monitoring Spring Cloud Zipkin Trace Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Boot User Service Spring Boot Client Service NodeJS User Interface Centralized Configuration Developer DevOps Center Service Monitoring Distributed Trace IaaS Configuration Backend Source Continuous Integration Continuous Delivery Deployment Docker Registry Provisioning Database Storage Master HA Node ●●●●●● 클 레 임 볼 륨 추 상 화 Infra Operation ● Infra Automation ● Provisioning ● DevOps ● CI/CD
  • 42. Spring Cloud on Kubernetes Architecture 마이크로 서비스 구성 시스템 구성도 Developer Continuous Integration Data Structure ManagementDeployment Docker Registry Source Configuration Management Orchestration Database Storage Master HA Node ●●●●●● 클 레 임 볼 륨 추 상 화 Docker Image Docker Image Pull Continuous Delivery Binary Build Application Configuration
  • 43. Spring Cloud on Kubernetes Install Jenkins
  • 44. Spring Cloud on Kubernetes Install Tomcat Install Jenkins http://tomcat.apache.org http://apache.mirror.cdnetworks.com/tomcat/tomcat-9/v9.0.6/bin/apache-tomcat-9.0.6.tar.gz $ tar xvfz apache-tomcat-9.0.6.tar.gz 압축 해제 후 적당한 폴더로 이동
  • 45. Spring Cloud on Kubernetes Install Jenkins Install Jenkins https://jenkins.io http://mirrors.jenkins.io/war-stable/latest/jenkins.war $ mv jenkins.war <Tomcat-Home>/webapps/ $ <Tomcat-Home>/bin/startup.sh
  • 46. Spring Cloud on Kubernetes Configuration Jenkins Install Jenkins http://localhost:8080/jenkins cat /Users/ageofblue/.jenkins/secrets/initialAdminPassword aa17d8af63f346e8b5a84db6687efefa
  • 47. Spring Cloud on Kubernetes Configuration Jenkins Install Jenkins Install Plugin
  • 48. Spring Cloud on Kubernetes Configuration Jenkins Install Jenkins Install Plugin
  • 49. Spring Cloud on Kubernetes Configuration Jenkins Install Jenkins Install Plugin
  • 50. Spring Cloud on Kubernetes Configuration Jenkins Install Jenkins Install Plugin
  • 51. Spring Cloud on Kubernetes Configuration Jenkins Install Jenkins Install Plugin
  • 52. Spring Cloud on Kubernetes Configuration Jenkins Install Jenkins Install Plugin
  • 53. Spring Cloud on Kubernetes Configuration Jenkins Install Jenkins Install Plugin
  • 54. Spring Cloud on Kubernetes Build Kubernetes Cluster
  • 55. Spring Cloud on Kubernetes Install VirtualBox Build Kubernetes Cluster Download URL ▪ https://www.virtualbox.org/wiki/Downloads For OS X ▪ https://download.virtualbox.org/virtualbox/5.2.8/VirtualBox-5.2.8-121009-OSX.dmg For Linux ▪ https://www.virtualbox.org/wiki/Linux_Downloads For Windows ▪ https://download.virtualbox.org/virtualbox/5.2.8/VirtualBox-5.2.8-121009-Win.exe
  • 56. Spring Cloud on Kubernetes Install Docker Build Kubernetes Cluster Download URL ▪ https://www.docker.com/community-edition#/download For OS X ▪ https://store.docker.com/editions/community/docker-ce-desktop-mac For Linux ▪ CENTOS : https://store.docker.com/editions/community/docker-ce-server-centos ▪ DEBIAN : https://store.docker.com/editions/community/docker-ce-server-debian ▪ FEDORA : https://store.docker.com/editions/community/docker-ce-server-fedora ▪ UBUNTU : https://store.docker.com/editions/community/docker-ce-server-ubuntu For Windows ▪ https://store.docker.com/editions/community/docker-ce-desktop-windows
  • 57. Spring Cloud on Kubernetes Install Kubectl Build Kubernetes Cluster For OSX Download URL ▪ https://kubernetes.io/docs/tasks/tools/install-kubectl/ $ curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl –s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/darwin/amd64/kubectl $ chmod +x ./kubectl $ sudo mv ./kubectl /usr/local/bin/kubectl
  • 58. Spring Cloud on Kubernetes Install Kubectl Build Kubernetes Cluster For Linux Download URL ▪ https://kubernetes.io/docs/tasks/tools/install-kubectl/ $ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl $ chmod +x ./kubectl $ sudo mv ./kubectl /usr/local/bin/kubectl
  • 59. Spring Cloud on Kubernetes Install Kubectl Build Kubernetes Cluster For Linux Download URL ▪ https://kubernetes.io/docs/tasks/tools/install-kubectl/ EXE Download ▪ https://storage.googleapis.com/kubernetes-release/release/v1.9.0/bin/windows/amd64/kubectl.exe PATH 추가
  • 60. Spring Cloud on Kubernetes Install minikube Build Kubernetes Cluster Download URL ▪ https://github.com/kubernetes/minikube/releases
  • 61. Spring Cloud on Kubernetes Kubernetes Cluster Configuration Build Kubernetes Cluster Start Cluster $ minikube start --cpus 4 --memory 8192 Starting local Kubernetes v1.9.0 cluster... Starting VM... Getting VM IP address... Moving files into cluster... Setting up certs... Connecting to cluster... Setting up kubeconfig... Starting cluster components... Kubectl is now configured to use the cluster. Loading cached images from config file.
  • 62. Spring Cloud on Kubernetes Kubernetes Cluster Configuration Build Kubernetes Cluster Stop Cluster $ minikube stop Stopping local Kubernetes cluster... Machine stopped.
  • 63. Spring Cloud on Kubernetes Kubernetes Cluster Configuration Build Kubernetes Cluster Add hosts $ minikube update-context Kubeconfig IP correctly configured, pointing at 192.168.64.5 $ sudo vi /etc/hosts ~ ~ 192.168.64.5 eureka.k8s.com 192.168.64.5 config.k8s.com 192.168.64.5 hystrix.k8s.com 192.168.64.5 zipkin.k8s.com 192.168.64.5 api.k8s.com 192.168.64.5 user.k8s.com 192.168.64.5 client.k8s.com
  • 64. Spring Cloud on Kubernetes Kubernetes Cluster Configuration Build Kubernetes Cluster Cluster Dashboard $ minikube dashboard
  • 65. Spring Cloud on Kubernetes CI/CD
  • 66. Spring Cloud on Kubernetes Jenkins CI/CD Jenkinsfile #!groovy node { def git def commitHash def buildImage stage('Checkout') { git = checkout scm commitHash = git.GIT_COMMIT } stage('Test') { try{ sh './gradlew check' } finally { junit 'build/test-results/**/*.xml' } } stage('Build') { sh './gradlew build -x test' }
  • 67. Spring Cloud on Kubernetes Jenkins CI/CD Jenkinsfile stage('Build Docker Image') { buildImage = docker.build("hubtea/spring-cloud-hystrix:${commitHash}") } stage('Archive') { parallel ( "Archive Artifacts" : { archiveArtifacts artifacts: '**/build/libs/*.jar', fingerprint: true }, "Docker Image Push" : { buildImage.push("${commitHash}") buildImage.push("latest") } ) } stage('Kubernetes Deploy') { sh 'kubectl apply --namespace=development -f deployment.yaml' } }
  • 68. Spring Cloud on Kubernetes Jenkins CI/CD Dockerfile FROM openjdk:8-jdk-alpine LABEL maintainer="Leonardo Park" VOLUME /tmp ADD ./build/libs/app.jar app.jar EXPOSE 8080 ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Xmx384m","-jar","/app.jar"]
  • 69. Spring Cloud on Kubernetes Jenkins CI/CD Kubernetes Resource apiVersion: extensions/v1beta1 kind: Ingress metadata: name: hystrix spec: rules: - host: hystrix.k8s.com http: paths: - path: / backend: serviceName: hystrix servicePort: 8080
  • 70. Spring Cloud on Kubernetes Jenkins CI/CD Kubernetes Resource kind: Service apiVersion: v1 metadata: name: hystrixa spec: type: ClusterIP selector: app: spring-cloud-hystrix ports: - protocol: TCP port: 8080 targetPort: 8080
  • 71. Spring Cloud on Kubernetes Jenkins CI/CD Kubernetes Resource apiVersion: extensions/v1beta1 kind: Deployment metadata: name: spring-cloud-hystrix labels: app: spring-cloud-hystrix spec: replicas: 1 selector: matchLabels: app: spring-cloud-hystrix template: spec: hostname: hystrix subdomain: hystrix containers: - name: spring-cloud-hystrix image: hubtea/spring-cloud-hystrix:latest env: - name: SPRING_PROFILES_ACTIVE value: dev ports: - name: http containerPort: 8080
  • 72. Spring Cloud on Kubernetes Configuration
  • 73. Spring Cloud on Kubernetes Architecture Spring Cloud Config 시스템 구성도 Spring Cloud Config Config Service Discovery Gateway - Service Routing - Client-Side Load-balancing - Fail-Over & Easy Scale-Out - Cross-Cutting Concern 기능 공통화 - API L-C Management - Token Relay (RBAC) Sidecar - Polyglot Support - Non Java Platform Support Hystrix - Service Monitoring Service Register Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Cloud Zuul API GATEWAY Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Routing Service Management Micro Service Edge Service Service Registry - Service Discovery - Health check Configuration - Centralized Environment Service Discovery User Resource Spring Cloud Hystrix Monitoring Service Monitoring Centralized Configuration Spring Cloud Zipkin Trace Distributed Trace Collect External Git SCM
  • 74. Spring Cloud on Kubernetes Architecture Spring Cloud Config 시스템 구성도 Spring Cloud Zuul API GATEWAY Spring Cloud Config ConfigSpring Cloud Hystrix Monitoring Spring Cloud Zipkin Trace Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Boot User Service Spring Boot Client Service Centralized Configuration Configuration Backend Spring Boot GSP Console
  • 75. Spring Cloud on Kubernetes Source Spring Cloud Config Application.java package com.ktds.msa.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; @SpringBootApplication @EnableConfigServer public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
  • 76. Spring Cloud on Kubernetes Spring Cloud Config으로 환경 관리 Spring Cloud Config application.yml server: port: 8080 spring: cloud: config: server: git: uri: https://github.com/ageofblue/cloud-config-repo endpoints: shutdown: enabled: true sensitive: false
  • 77. Spring Cloud on Kubernetes Spring Cloud Config으로 환경 관리 Spring Cloud Config Client bootstrap.yml spring: application: name: apigw cloud: config: uri: http://config.development.svc.cluster.local:8888
  • 78. Spring Cloud on Kubernetes Spring Cloud Config Make Configuration Repository Name ▪ spring-cloud-config-repo Git URL ▪ https://github.com/<아이디>/spring-cloud-config-repo.git Configuration ▪ <application name>-<profile>.yml
  • 79. Spring Cloud on Kubernetes Practice Spring Cloud Config
  • 80. Spring Cloud on Kubernetes Service Registry & Sidecar
  • 81. Spring Cloud on Kubernetes Architecture Service Registry & Sidecar 시스템 구성도 Spring Cloud Config Config Service Discovery Gateway - Service Routing - Client-Side Load-balancing - Fail-Over & Easy Scale-Out - Cross-Cutting Concern 기능 공통화 - API L-C Management - Token Relay (RBAC) Sidecar - Polyglot Support - Non Java Platform Support Hystrix - Service Monitoring Service Register Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Cloud Zuul API GATEWAY Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Routing Service Management Micro Service Edge Service Service Registry - Service Discovery - Health check Configuration - Centralized Environment Service Discovery User Resource Spring Cloud Hystrix Monitoring Service Monitoring Centralized Configuration Spring Cloud Zipkin Trace Distributed Trace Collect External Git SCM
  • 82. Spring Cloud on Kubernetes Architecture Service Registry & Sidecar Spring Cloud Zuul API GATEWAY Spring Cloud Hystrix Monitoring Spring Cloud Zipkin Trace Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Boot User Service Spring Boot Client Service Service Discovery Service Register
  • 83. Spring Cloud on Kubernetes Eureka & Sidecar Service Registry & Sidecar Netflix OSS 서비스 Registration, Discovery Health Check
  • 84. Spring Cloud on Kubernetes Eureka & Sidecar Service Registry & Sidecar Sidecar
  • 85. Spring Cloud on Kubernetes Eureka & Sidecar Service Registry & Sidecar Eureka Dashboard
  • 86. Spring Cloud on Kubernetes Eureka & Sidecar Service Registry & Sidecar Application.java package com.ktds.msa.apireg; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
  • 87. Spring Cloud on Kubernetes Eureka & Sidecar Service Registry & Sidecar application.yml server: port: 8761 eureka: instance: hostname: localhost leaseExpirationDurationInSeconds: 30 leaseRenewalIntervalInSeconds: 10 client: registerWithEureka: false fetchRegistry: false serviceUrl: defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
  • 88. Spring Cloud on Kubernetes Eureka & Sidecar Service Registry & Sidecar Client Code package com.ktds.msa.apireg; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaClient @EnableCircuitBreaker @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
  • 89. Spring Cloud on Kubernetes Practice Service Registry & Sidecar
  • 90. Spring Cloud on Kubernetes Circuit Breaker
  • 91. Spring Cloud on Kubernetes Architecture Circuit Breaker 시스템 구성도 Spring Cloud Config Config Service Discovery Gateway - Service Routing - Client-Side Load-balancing - Fail-Over & Easy Scale-Out - Cross-Cutting Concern 기능 공통화 - API L-C Management - Token Relay (RBAC) Sidecar - Polyglot Support - Non Java Platform Support Hystrix - Service Monitoring Service Register Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Cloud Zuul API GATEWAY Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Routing Service Management Micro Service Edge Service Service Registry - Service Discovery - Health check Configuration - Centralized Environment Service Discovery User Resource Spring Cloud Hystrix Monitoring Service Monitoring Centralized Configuration Spring Cloud Zipkin Trace Distributed Trace Collect External Git SCM
  • 92. Spring Cloud on Kubernetes Architecture Circuit Breaker Spring Cloud Zuul API GATEWAYSpring Cloud Hystrix Monitoring Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Monitoring
  • 93. Spring Cloud on Kubernetes Circuit Breaker Pattern 구현하기 Circuit Breaker Circuit Breaker Pattern 소개 분산 환경에서는 느린 네트워크 연결, 시간 초과 또는 일시적으로 사용할 수 없는 리소스와 같은 일시적인 장애로 인해 원격 리소스와 서비스 호출이 실패. Retry 패턴 과 같은 전략을 사용해 장애를 처리하도록 설계되어야 함 응용 프로그램은 작업 실패를 신속하게 처리하고 이런 종류의 장애를 적절하게 처리해야 함. 시스템의 한 부분에서 발생한 장애는 단계적 장애로 이어질 수 있음. 서비스를 호출하는 작업에 시간 제한을 구현한 뒤 서비스가 제한 시간 이내에 응답에 실패하는 경우 실패 메시지를 표시하도록 구성할 수 있으나 이런 전략으로 인해 동일한 작업에 대한 많은 동시 요청이 제한 시간이 경과할 때까지 차단되는 결과가 초래될 수 있는데, 이 렇게 차단된 요청은 메모리, 스레드, 데이터베이스 연결 등과 같은 중요한 시스템 리소스를 차지함. 동일한 리소스를 사용해야 하는 관련 없는 부분의 장애가 초래될 수 있음. 작업을 즉시 실패하게 하고 성공할 가능성이 있는 서비스의 호출만 시도하는 것이 바람직함. Fault-Tolerance, Latency - Tolerance
  • 94. Spring Cloud on Kubernetes Circuit Breaker Pattern 구현하기 Circuit Breaker Circuit Breaker Pattern 소개 응용 프로그램이 실패할 가능성이 있는 작업의 실행을 반복적으로 시도하지 못하도록 제어. 장애가 해결될 때까지 기다리거나 장애가 오래 지속되는 유형인지 여부를 결정하는 동안 CPU 사이클을 낭비하지 않고 계속 운영. 응용 프로그램이 문제가 해결되었다고 판단하면 작업의 호출을 시도.
  • 95. Spring Cloud on Kubernetes Circuit Breaker Pattern 구현하기 Circuit Breaker Hystrix Dashboard
  • 96. Spring Cloud on Kubernetes Circuit Breaker Pattern 구현하기 Circuit Breaker Circuit Breaker Pattern 소개
  • 97. Spring Cloud on Kubernetes Circuit Breaker Pattern 구현하기 Circuit Breaker Circuit Breaker Pattern 소개 원의 색과 크기는 시스템 상태와 트래픽 볼륨을 표현함 2분간 요청률의 트래픽 추이를 표현함 서킷 브레이커스 상태를 표현 초당 요청 비율 10초내 에러를 백분율로 표현 10초내 에러를 백분율로 표현 클러스터에 리포팅 되는 호스트 수
  • 98. Spring Cloud on Kubernetes Circuit Breaker Pattern 구현하기 Circuit Breaker Dashboard Application.java import ... @SpringBootApplication @EnableHystrixDashboard public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
  • 99. Spring Cloud on Kubernetes Circuit Breaker Pattern 구현하기 Circuit Breaker Client Application.java package com.ktds.msa.user; import ... @EnableEurekaClient @EnableCircuitBreaker @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
  • 100. Spring Cloud on Kubernetes Practice Circuit Breaker
  • 101. Spring Cloud on Kubernetes Trace
  • 102. Spring Cloud on Kubernetes Architecture Trace 시스템 구성도 Spring Cloud Config Config Service Discovery Gateway - Service Routing - Client-Side Load-balancing - Fail-Over & Easy Scale-Out - Cross-Cutting Concern 기능 공통화 - API L-C Management - Token Relay (RBAC) Sidecar - Polyglot Support - Non Java Platform Support Hystrix - Service Monitoring Service Register Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Cloud Zuul API GATEWAY Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Routing Service Management Micro Service Edge Service Service Registry - Service Discovery - Health check Configuration - Centralized Environment Service Discovery User Resource Spring Cloud Hystrix Monitoring Service Monitoring Centralized Configuration Spring Cloud Zipkin Trace Distributed Trace Collect External Git SCM
  • 103. Spring Cloud on Kubernetes Architecture Trace 시스템 구성도 Spring Cloud Zuul API GATEWAY Spring Cloud Zipkin Trace Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Boot User Service Spring Boot Client Service NodeJS User Interface Distributed Trace
  • 104. Spring Cloud on Kubernetes Api Trace 구현하기 Trace Zipkin Server
  • 105. Spring Cloud on Kubernetes Api Trace 구현하기 Trace Zipkin Server
  • 106. Spring Cloud on Kubernetes Api Trace 구현하기 Trace Zipkin Server
  • 107. Spring Cloud on Kubernetes Api Trace 구현하기 Trace API Side Configuration spring: zipkin: baseUrl: http://ip-172-31-12-174.ap-northeast-2.compute.internal:9411sleuth: sampler: percentage: 0.2
  • 108. Spring Cloud on Kubernetes Api Trace 구현하기 Trace API Side Dependency dependencies { compile('org.springframework.cloud:spring-cloud-starter-zipkin’) }
  • 109. Spring Cloud on Kubernetes Api Trace 구현하기 Trace Zipkin Server package com.ktds.msa.trace; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import zipkin.server.EnableZipkinServer; @SpringBootApplication @EnableEurekaClient @EnableZipkinServer public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
  • 110. Spring Cloud on Kubernetes Api Trace 구현하기 Trace Zipkin Server zipkin: store: type: mem
  • 111. Spring Cloud on Kubernetes Practice Trace
  • 112. Spring Cloud on Kubernetes OAuth
  • 113. Spring Cloud on Kubernetes Architecture OAuth 시스템 구성도 Spring Cloud Config Config Service Discovery Gateway - Service Routing - Client-Side Load-balancing - Fail-Over & Easy Scale-Out - Cross-Cutting Concern 기능 공통화 - API L-C Management - Token Relay (RBAC) Sidecar - Polyglot Support - Non Java Platform Support Hystrix - Service Monitoring Service Register Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Cloud Zuul API GATEWAY Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Routing Service Management Micro Service Edge Service Service Registry - Service Discovery - Health check Configuration - Centralized Environment Service Discovery User Resource Spring Cloud Hystrix Monitoring Service Monitoring Centralized Configuration Spring Cloud Zipkin Trace Distributed Trace Collect External Git SCM
  • 114. Spring Cloud on Kubernetes Architecture OAuth 시스템 구성도 Spring Cloud Zuul API GATEWAY Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Boot User Service Spring Boot Client Service Service Discovery Request with TokenRequest Token1 2
  • 115. Spring Cloud on Kubernetes Spring Cloud Oauth 인증서버 구현하기 OAuth Oauth 란? 사실상 API 인증 표준.
  • 116. Spring Cloud on Kubernetes Spring Cloud Oauth 인증서버 구현하기 OAuth Client Credentials Grant Flow
  • 117. Spring Cloud on Kubernetes Spring Cloud Oauth 인증서버 구현하기 OAuth Resource Owner Password Credentials Grant Flow
  • 118. Spring Cloud on Kubernetes Spring Cloud Oauth 인증서버 구현하기 OAuth Authorization Code Grant Flow
  • 119. Spring Cloud on Kubernetes Spring Cloud Oauth로 인증서버 구현하기 OAuth AuthorizationConfiguration.java package com.ktds.msa.oauth.config; Import ... @Configuration @EnableAuthorizationServer public class AuthorizationConfiguration extends AuthorizationServerConfigurerAdapter { @Autowired @Qualifier("authenticationManagerBean") private AuthenticationManager authenticationManager; @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("client1").secret("1234567890").autoApprove(true).authorizedGrantTypes("client_cre dentials", "password") .scopes("read", "write").authorities("ROLE_CLIENT").resourceIds("MSA").accessTokenValiditySeconds(60 * 10) .refreshTokenValiditySeconds(60 * 10); } ...
  • 120. Spring Cloud on Kubernetes Spring Cloud Oauth로 인증서버 구현하기 OAuth AuthorizationConfiguration.java @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints.tokenStore(tokenStore()).tokenEnhancer(jwtAccessTokenConverter()).authenticationManager(authenticati onManager); } @Bean public TokenStore tokenStore() { return new JwtTokenStore(jwtAccessTokenConverter()); } @Bean public JwtAccessTokenConverter jwtAccessTokenConverter() { KeyStoreKeyFactory factory = new KeyStoreKeyFactory(new ClassPathResource("ktds.jks"), "new1234!".toCharArray()); JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); converter.setKeyPair(factory.getKeyPair("ktds")); return converter; }
  • 121. Spring Cloud on Kubernetes Practice OAuth
  • 122. Spring Cloud on Kubernetes Micro Service
  • 123. Spring Cloud on Kubernetes Architecture 마이크로 서비스 구성 시스템 구성도 Spring Cloud Config Config Service Discovery Gateway - Service Routing - Client-Side Load-balancing - Fail-Over & Easy Scale-Out - Cross-Cutting Concern 기능 공통화 - API L-C Management - Token Relay (RBAC) Sidecar - Polyglot Support - Non Java Platform Support Hystrix - Service Monitoring Service Register Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Cloud Zuul API GATEWAY Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Routing Service Management Micro Service Edge Service Service Registry - Service Discovery - Health check Configuration - Centralized Environment Service Discovery User Resource Spring Cloud Hystrix Monitoring Service Monitoring Centralized Configuration Spring Cloud Zipkin Trace Distributed Trace Collect External Git SCM
  • 124. Spring Cloud on Kubernetes 마이크로 서비스의 구현 Micro Service Spring Boot 기반으로 구현하기 @RestController 로 손쉽게 구현. dependencies { compile('org.springframework.boot:spring-boot-starter-web’) } Controller Service Repository Domain
  • 125. Spring Cloud on Kubernetes Practice OAuth
  • 126. Spring Cloud on Kubernetes API Gateway
  • 127. Spring Cloud on Kubernetes Architecture API Gateway 시스템 구성도 Spring Cloud Config Config Service Discovery Gateway - Service Routing - Client-Side Load-balancing - Fail-Over & Easy Scale-Out - Cross-Cutting Concern 기능 공통화 - API L-C Management - Token Relay (RBAC) Sidecar - Polyglot Support - Non Java Platform Support Hystrix - Service Monitoring Service Register Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Cloud Zuul API GATEWAY Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Routing Service Management Micro Service Edge Service Service Registry - Service Discovery - Health check Configuration - Centralized Environment Service Discovery User Resource Spring Cloud Hystrix Monitoring Service Monitoring Centralized Configuration Spring Cloud Zipkin Trace Distributed Trace Collect External Git SCM
  • 128. Spring Cloud on Kubernetes Architecture API Gateway 시스템 구성도 Spring Cloud Zuul API GATEWAY Spring Cloud Eureka API REGISTRY Spring Cloud OAuth OAUTH Spring Boot User Service Spring Boot Client Service NodeJS User Interface Service Discovery Request
  • 129. Spring Cloud on Kubernetes Zuul 기반으로 API Gateway 구현하기 API Gateway Spring Cloud Netflix Zuul Netflix 사에서의 본인 들의 서비스 클라우드 환경에서 글로벌로 서비스하기 위해서 만든 API Gateway Open Source . Apache License 2.0 Java 언어로 만들어짐.
  • 130. Spring Cloud on Kubernetes Zuul 기반으로 API Gateway 구현하기 API Gateway Spring Cloud Netflix Zuul Netflix 사에서의 본인 들의 서비스 클라우드 환경에서 글로벌로 서비스하기 위해서 만든 API Gateway Open Source . Apache License 2.0 Java 언어로 만들어짐.
  • 131. Spring Cloud on Kubernetes Zuul 기반으로 API Gateway 구현하기 API Gateway Spring Cloud Netflix Zuul
  • 132. Spring Cloud on Kubernetes Zuul 기반으로 API Gateway 구현하기 API Gateway Application.java package com.ktds.msa.apigw; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; @SpringBootApplication @EnableZuulProxy @EnableEurekaClient public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
  • 133. Spring Cloud on Kubernetes Zuul 기반으로 API Gateway 구현하기 API Gateway application.yml server: port: 9090 spring: application: name: API-GW zuul: routes: api: path: /api/** serviceId: API-PORTAL stripPrefix: true eureka: client: registerWithEureka: true fetchRegistry: true instance: leaseRenewalIntervalInSeconds: 1 leaseExpirationDurationInSeconds: 2 preferIpAddress: true
  • 134. Spring Cloud on Kubernetes Zuul 기반으로 API Gateway 구현하기 API Gateway application.yml security: oauth2: resource: id: KTDS-RESOURCE loadBalanced: true jwt: keyValue: -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAse3h8oBH3KzQo/2bm2d0 R1o1GZfCsxvlAWFrXYf/IBQ4ciUuZ9l7Xy1bqFJTU4XfbRcDL2j1YOnBm+35ejSV UDjDTZYG3A23W/fsSrQJZ4asjbaXDxToYSDyVE/tE2pNsv7sGK3buJLZhKsYzDgt 30b1UQypfSgwj9R3rpAGARG6Mk4DuqXJJRkV3wfTwe/3jSBxfs28rMNcKZB8LWq3 I0EgQkGlxQ09AjcYuWqHlmXf4feHDVSWL8fobaE/mNZ+bBaK6Meb3eNBFJndE/GS xMJ8Dmsfc/pmX7YiblDWwXj9rGFNaQYBEf7JJsf/CzE19TuhojzavTepfRQV/omZ 2QIDAQAB -----END PUBLIC KEY-----
  • 135. Spring Cloud on Kubernetes Practice API Gateways