SlideShare a Scribd company logo
Source To URL without Dockerfile
정원천 (hardy.jung)
카카오 클라우드디플로이셀
hardy.jung@kakaocorp.com
발표자 소개
• Kakao CloudDeploy Cell Lead
• Certified Kubernetes Administrator
• SNS
• Kubernetes Korea Group : https://www.facebook.com/groups/k8skr/
• Blog : https://arisu1000.tistory.com/
• Book
• 자바 프로그래밍 면접, 이렇게 준비한다
• BACK TO THE BASIC, C++ 버그 헌팅
• 프로 윈도우폰 7 개발
• 클라우드 컴퓨팅 바이블
• Patent
• Method for Predicting a Property of Compound and System for Predicting a Property of Compound
• Automatic Method Using Quantum Mechanics Calculation Program and Materials Property Predictive Module and System therefor
• Multiple Linear Regression―Artificial Neural Network Model Predicting Absolute Entropy of Ideal Gas for Pure Organic Compound
• Etc +38
개요 – cloud app launcher
• 목적
• 개발자는 개발만 빌드 및 실행은 app launcher
• Main component
• Github
• Buildpack
• 소스기반으로 컨테이너 이미지 빌드
• Knative
• 컨테이너를 실행 및 관리
개요 – cloud app launcher
Github Build Kubernetes
push
webhook deploy
Buildpack Knative
Buildpacks
• 용도 : 소스를 탐지해서 컨테이너화
• https://buildpacks.io/
• CNCF sandbox project
• 주요 참여 기업 : Pivotal, Heroku
Buildpacks
Buildpacks - 구성요소
• Pack(not packs)
• https://github.com/buildpack/pack
• CLI 명령어
• 소스코드를 실행가능한 컨테이너 이미지로 변경
• Lifecycle
• https://github.com/buildpack/lifecycle
• Buildpack API v3의 구현체
Buildpacks - 구성요소
• Buildpack
• 특정 소스를 빌드하는 방법에 대한 코드들의 모음
• Lifecycle에 지정된 spec에 해당하는 명령어가 들어있어야 함
Buildpacks
• “pack build” 명령으로 빌드 실행
• Build가 진행되서 이미지가 만들어지는 과정
detect
/lifecycle/detector
restore
/lifecycle/restorer
analyze
/lifecycle/analyzer
build
/lifecycle/builder
export
/lifecycle/exporter
cache
/lifecycle/cacher
bin/detect
plan.toml
bin/build
plan.toml
launch.toml
Buildpacks
• https://github.com/buildpack/samples
Buildpacks
• bin/detect
#!/usr/bin/env bash
set -eo pipefail
if [[ -f pom.xml ]]; then
exit 0
fi
exit 1
Buildpacks
• bin/build
echo "---> Installing JDK"
echo "---> Running Maven”
if [[ -x mvnw ]]; then
echo "---> Running Maven Wrapper"
./mvnw clean install -B -DskipTests
else
mvn clean install -B -DskipTests
fi
# Set default start command
for jarFile in $(find target -maxdepth 1 -name "*.jar" -type f); do
echo "processes = [{ type = "web", command = "java -jar
$jarFile"}]" > "$layers_dir/launch.toml"
break;
done
Buildpacks
• 이미지 실행 Entrypoint
• launch.toml 파일을 해석해서 실행
• 현재는 type에 web만 지원
• Command에 실행할 명령어를 추가
"Entrypoint": [
"/lifecycle/launcher"
],
[[processes]]
type = "web"
command = "java -jar target/java-springboot-0.0.1-SNAPSHOT.jar"
Buildpacks 사용하기 - Demo
git clone https://github.com/arisu1000/helloworld-java-spring.git
cd helloworld-java-spring
pack build arisu1000/helloworld-java-spring
docker volume ls
docker inspect arisu1000/helloworld-java-spring
docker push arisu1000/helloworld-java-spring
Knative
• 용도 : 컨테이너를 실행하고 관리하는 역할
• Kubernetes 에서 실행되는 serverless 플랫폼
• 2018년 7월 공개
• https://knative.dev/
• 주요 참여 기업 : Google, Pivotal, IBM, Red Hat, SAP
• 2019년 7월 버전 : 0.7
Knative
Knative
• 각 컴포넌트가 독립적으로 구성되어 있음
• 주요 컴포넌트
• Build : 컨테이너 빌드를 담당
• Serving : 컨테이너 실행 및 운영을 담당
• Eventing : 이벤트를 발생시키고 구독하는 역할을 담당
Knative - build
• Kubernetes CRD(Custom Resource Definition)를 생성해서 사용
• 주요 개념
• Source : 빌드할 소스
• Steps : 작업을 실행하기위한 컨테이너 이미지와 작업 내역들
• BuildTemplate : 재사용 가능한 템플릿
• 인증 : kubernetes 시크릿을 이용하도록 ServiceAccount를 사용
Knative - build
• Build yaml apiVersion: build.knative.dev/v1alpha1
kind: Build
metadata:
name: kaniko-build
spec:
serviceAccountName: build-bot
source:
git:
url: https://github.com/my-user/my-repo
revision: master
template:
name: kaniko
arguments:
- name: IMAGE
value: us.gcr.io/my-project/my-app
Knative - build
• BuildTemplate yaml
apiVersion: build.knative.dev/v1alpha1
kind: BuildTemplate
metadata:
name: kaniko
spec:
parameters:
- name: IMAGE
description: The name of the image to push
- name: DOCKERFILE
description: Path to the Dockerfile to build.
default: /workspace/Dockerfile
steps:
- name: build-and-push
image: gcr.io/kaniko-project/executor
args:
- --dockerfile=${DOCKERFILE}
- --destination=${IMAGE}
env:
- name: DOCKER_CONFIG
value: /builder/home/.docker
Knative - build
• Build-templates : https://github.com/knative/build-templates
Knative - serving
• Kubernetes CRD를 생성해서 사용
• 목적
• 서버리스 컨테이너의 빠른 배포
• 컨테이너 오토스케일링 관리
• Istio를 이용한 라우팅과 네트워크 프로그래밍
• 배포된 코드와 설정을 Point-in-time 스냅샷 형식으로 관리
Knative – serving resource
• Service
• service.serving.knative.dev : 워크로드의 전체 라이프 사이클을 자동으로 관리.
• Route, configuration, revision같은 다른 객체들을 만들고 관리한다.
• Route
• route.serving.knative.dev : 네트워크 엔드포인트를 revision에 매핑하는 역할.
• Configuration
• configuration.serving.knative.dev : 배포의 원하는 상태(desired state)를 관리함.
• 코드와 설정을 분리하기 위해서 필요함.
• Revision
• revision.serving.knative.dev : 코드와 configuration의 시점별(point-in-time) 스냅샷.
• 이뮤터블객체이고 필요한만큼 유지가능하다.
Knative – serving 구조
Knative – serving 구성요소
• Controller
• Serving 전체 상태를 관리하는 프로세스
• pkg/reconciler/v1alpha1/ 하위에 보면 각종 리소스(autoscaling,
cluster ingress, configuration, labeler, revision, route, service, testing)
에 대한 컨트롤러들이 있고 각각이 고루틴으로 떠서 실행된다.
• Webhook
• knative/pkg 하위의 webhook을 사용하는 공통 모듈
• 모든 Kubernetes API 호출과 CRD 관련 내용을 중간에 확인해서 유효
한 요청인지 검증하고 관리하는 역할을 한다.
Knative – serving 구성요소
• Activator
• 비활성화된 revision에 대한 요청을 받아서 버퍼링
• autoscaler에 메트릭 리포팅
• revision이 리포팅된 메트릭 기반으로 스케일이 된 다음에 revision에
요청을 다시 전송
• Autoscaler
• 어노테이션을 이용해서 오토스케일링될 Min, max를 설정할 수 있음.
• configuration.revisionTemplate 이나 revision에 다음 어노테이션을 사
용하면 됨. # +optional
# When not specified, the revision can scale down to 0 pods
autoscaling.knative.dev/minScale: "2"
# +optional
# When not specified, there's no upper scale bound
autoscaling.knative.dev/maxScale: "10"
Knative - serving
• Serving yaml apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
name: helloworld-java-spring
namespace: default
spec:
runLatest:
configuration:
revisionTemplate:
metadata:
annotations:
autoscaling.knative.dev/minScale: "1"
spec:
container:
image: arisu1000/helloworld-java-spring
env:
- name: TARGET
value: ”Java Sample v1"
$ kubectl get ksvc
NAME URL LATESTCREATED LATESTREADY READY REASON
helloworld-java-spring http://helloworld-java-spring.default.example.com helloworld-java-spring-dws5r helloworld-java-spring-dws5r True
Knative 설치
• https://knative.dev/docs/install/
• Install to Docker for mac
• Install Istio
• Install Knative Serving
curl -L https://raw.githubusercontent.com/knative/serving/v0.7.0/third_party/istio-1.0.7/istio.yaml 
| sed 's/LoadBalancer/NodePort/' 
| kubectl apply --filename -
# Label the default namespace with istio-injection=enabled.
kubectl label namespace default istio-injection=enabled
kubectl get pods --namespace istio-system
curl -L https://github.com/knative/serving/releases/download/v0.7.0/serving.yaml 
| sed 's/LoadBalancer/NodePort/' 
| kubectl apply --selector networking.knative.dev/certificate-provider!=cert-manager --filename -
kubectl get pods --namespace knative-serving
Knative : App Deployment
• https://github.com/knative/docs/tree/master/docs/serving/sa
mples/hello-world/helloworld-java-spring
$ kubectl get svc istio-ingressgateway --namespace istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
istio-ingressgateway NodePort 10.111.180.86 <none>
80:30593/TCP,443:32276/TCP,31400:31895/TCP,15011:30766/TCP,8060:31075/TC
P,853:32694/TCP,15030:32027/TCP,15031:30882/TCP 22m
$ kubectl get ksvc helloworld-java-spring 
--output=custom-columns=NAME:.metadata.name,URL:.status.url
NAME URL
helloworld-java-spring http://helloworld-java-spring.default.example.com
$ curl -H "Host: helloworld-java-spring.default.example.com"
http://localhost:30593
Hello Spring Boot Sample v1!%
Q&A
감사합니다

More Related Content

What's hot (20)

PDF
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
OpenStack Korea Community
 
PDF
모두의 쿠버네티스 (Kubernetes for everyone)
Eunwoo Cho
 
PDF
카카오 전사 모니터링/로깅/알람플랫폼 KEMI
issac lim
 
PDF
해외 사례로 보는 Billing for OpenStack Solution
Nalee Jang
 
PDF
2017 k8s and OpenStack-Helm
SK Telecom
 
PDF
Prometheus in openstack-helm
성일 임
 
PDF
[오픈소스컨설팅] ARM & OpenStack Community
Open Source Consulting
 
PDF
[OpenInfra Days Korea 2018] K8s workshop: with containers & K8s on OpenStack ...
OpenStack Korea Community
 
PPTX
대용량 로그분석 Bigquery로 간단히 사용하기
Jaikwang Lee
 
PDF
User Story :: Cloudike with KT UCloud Biz
Nalee Jang
 
PDF
[221] docker orchestration
NAVER D2
 
PDF
[2015-05월 세미나] 파이선 초심자의 Openstack
OpenStack Korea Community
 
PDF
[네이버클라우드플랫폼 온라인 교육 시리즈] 네이버클라우드플랫폼 쿠버네티스 소개(정낙수 클라우드 솔루션 아키텍트)
NAVER CLOUD PLATFORMㅣ네이버 클라우드 플랫폼
 
PDF
쉽고 빠르게 접하는 오픈스택
OpenStack Korea Community
 
PDF
[OpenStack Days Korea 2016] Track2 - 데이터센터에 부는 오픈 소스 하드웨어 바람
OpenStack Korea Community
 
PDF
Knative로 서버리스 워크로드 구현
Jinwoong Kim
 
PDF
cbhoilab vagrant와 ansible 쿠버네티스 설치 v2
choi sungwook
 
PPTX
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱
uEngine Solutions
 
PDF
대용량 로그분석 Bigquery로 간단히 사용하기 (20170215 T아카데미)
Jaikwang Lee
 
PDF
[OpenStack Days Korea 2016] Track3 - VDI on OpenStack with LeoStream Connecti...
OpenStack Korea Community
 
[OpenInfra Days Korea 2018] Day 2 - E5: Mesos to Kubernetes, Cloud Native 서비스...
OpenStack Korea Community
 
모두의 쿠버네티스 (Kubernetes for everyone)
Eunwoo Cho
 
카카오 전사 모니터링/로깅/알람플랫폼 KEMI
issac lim
 
해외 사례로 보는 Billing for OpenStack Solution
Nalee Jang
 
2017 k8s and OpenStack-Helm
SK Telecom
 
Prometheus in openstack-helm
성일 임
 
[오픈소스컨설팅] ARM & OpenStack Community
Open Source Consulting
 
[OpenInfra Days Korea 2018] K8s workshop: with containers & K8s on OpenStack ...
OpenStack Korea Community
 
대용량 로그분석 Bigquery로 간단히 사용하기
Jaikwang Lee
 
User Story :: Cloudike with KT UCloud Biz
Nalee Jang
 
[221] docker orchestration
NAVER D2
 
[2015-05월 세미나] 파이선 초심자의 Openstack
OpenStack Korea Community
 
[네이버클라우드플랫폼 온라인 교육 시리즈] 네이버클라우드플랫폼 쿠버네티스 소개(정낙수 클라우드 솔루션 아키텍트)
NAVER CLOUD PLATFORMㅣ네이버 클라우드 플랫폼
 
쉽고 빠르게 접하는 오픈스택
OpenStack Korea Community
 
[OpenStack Days Korea 2016] Track2 - 데이터센터에 부는 오픈 소스 하드웨어 바람
OpenStack Korea Community
 
Knative로 서버리스 워크로드 구현
Jinwoong Kim
 
cbhoilab vagrant와 ansible 쿠버네티스 설치 v2
choi sungwook
 
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱
uEngine Solutions
 
대용량 로그분석 Bigquery로 간단히 사용하기 (20170215 T아카데미)
Jaikwang Lee
 
[OpenStack Days Korea 2016] Track3 - VDI on OpenStack with LeoStream Connecti...
OpenStack Korea Community
 

Similar to Source To URL Without Dockerfile (20)

PPTX
[NDC17] Kubernetes로 개발서버 간단히 찍어내기
SeungYong Oh
 
PDF
Kubernetes in action
Bingu Shim
 
PDF
Kubernetes on GCP
Daegeun Kim
 
PDF
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
Ji-Woong Choi
 
PDF
Kubernetes를 통한 laravel 개발프로세스 개선하기
Changyeop Kim
 
PDF
Cloud Native Days Korea 2019 - kakao's k8s_as_a_service
Dennis Hong
 
PPTX
Deploying Hyperledger Fabric on Kubernetes.pptx
wonyong hwang
 
PDF
Cloud for Kubernetes : Session1
WhaTap Labs
 
PPTX
쿠버네티스의 이해 #1
상욱 송
 
PDF
Bon voyage Docker_Kubernetes
ssuseraada82
 
PDF
K8s in action02
Sunggon Song
 
PPTX
Introduce Google Kubernetes
Yongbok Kim
 
PDF
Kubernetes & helm 활용
SK Telecom
 
PPTX
[2019.04] 쿠버네티스 기반 하이퍼레저 패브릭 네트워크 구축하기
Hyperledger Korea User Group
 
PDF
AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
Amazon Web Services Korea
 
PDF
[OpenInfra Days Korea 2018] (Track 4) Provisioning Dedicated Game Server on K...
OpenStack Korea Community
 
PDF
Provisioning Dedicated Game Server on Kubernetes Cluster
Jinwoong Kim
 
PDF
세션3_데보션테크데이_gitopsinfra_v1.1.pdf
Jaesuk Ahn
 
PPTX
Ch7,8. Configmaps, Secrets and API
Hongmin Park
 
PDF
Kubernetes on Premise
Chan Shik Lim
 
[NDC17] Kubernetes로 개발서버 간단히 찍어내기
SeungYong Oh
 
Kubernetes in action
Bingu Shim
 
Kubernetes on GCP
Daegeun Kim
 
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
Ji-Woong Choi
 
Kubernetes를 통한 laravel 개발프로세스 개선하기
Changyeop Kim
 
Cloud Native Days Korea 2019 - kakao's k8s_as_a_service
Dennis Hong
 
Deploying Hyperledger Fabric on Kubernetes.pptx
wonyong hwang
 
Cloud for Kubernetes : Session1
WhaTap Labs
 
쿠버네티스의 이해 #1
상욱 송
 
Bon voyage Docker_Kubernetes
ssuseraada82
 
K8s in action02
Sunggon Song
 
Introduce Google Kubernetes
Yongbok Kim
 
Kubernetes & helm 활용
SK Telecom
 
[2019.04] 쿠버네티스 기반 하이퍼레저 패브릭 네트워크 구축하기
Hyperledger Korea User Group
 
AWS Kubernetes 서비스 자세히 살펴보기 (정영준 & 이창수, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
Amazon Web Services Korea
 
[OpenInfra Days Korea 2018] (Track 4) Provisioning Dedicated Game Server on K...
OpenStack Korea Community
 
Provisioning Dedicated Game Server on Kubernetes Cluster
Jinwoong Kim
 
세션3_데보션테크데이_gitopsinfra_v1.1.pdf
Jaesuk Ahn
 
Ch7,8. Configmaps, Secrets and API
Hongmin Park
 
Kubernetes on Premise
Chan Shik Lim
 
Ad

Source To URL Without Dockerfile

  • 1. Source To URL without Dockerfile 정원천 (hardy.jung) 카카오 클라우드디플로이셀 [email protected]
  • 2. 발표자 소개 • Kakao CloudDeploy Cell Lead • Certified Kubernetes Administrator • SNS • Kubernetes Korea Group : https://www.facebook.com/groups/k8skr/ • Blog : https://arisu1000.tistory.com/ • Book • 자바 프로그래밍 면접, 이렇게 준비한다 • BACK TO THE BASIC, C++ 버그 헌팅 • 프로 윈도우폰 7 개발 • 클라우드 컴퓨팅 바이블 • Patent • Method for Predicting a Property of Compound and System for Predicting a Property of Compound • Automatic Method Using Quantum Mechanics Calculation Program and Materials Property Predictive Module and System therefor • Multiple Linear Regression―Artificial Neural Network Model Predicting Absolute Entropy of Ideal Gas for Pure Organic Compound • Etc +38
  • 3. 개요 – cloud app launcher • 목적 • 개발자는 개발만 빌드 및 실행은 app launcher • Main component • Github • Buildpack • 소스기반으로 컨테이너 이미지 빌드 • Knative • 컨테이너를 실행 및 관리
  • 4. 개요 – cloud app launcher Github Build Kubernetes push webhook deploy Buildpack Knative
  • 5. Buildpacks • 용도 : 소스를 탐지해서 컨테이너화 • https://buildpacks.io/ • CNCF sandbox project • 주요 참여 기업 : Pivotal, Heroku
  • 7. Buildpacks - 구성요소 • Pack(not packs) • https://github.com/buildpack/pack • CLI 명령어 • 소스코드를 실행가능한 컨테이너 이미지로 변경 • Lifecycle • https://github.com/buildpack/lifecycle • Buildpack API v3의 구현체
  • 8. Buildpacks - 구성요소 • Buildpack • 특정 소스를 빌드하는 방법에 대한 코드들의 모음 • Lifecycle에 지정된 spec에 해당하는 명령어가 들어있어야 함
  • 9. Buildpacks • “pack build” 명령으로 빌드 실행 • Build가 진행되서 이미지가 만들어지는 과정 detect /lifecycle/detector restore /lifecycle/restorer analyze /lifecycle/analyzer build /lifecycle/builder export /lifecycle/exporter cache /lifecycle/cacher bin/detect plan.toml bin/build plan.toml launch.toml
  • 11. Buildpacks • bin/detect #!/usr/bin/env bash set -eo pipefail if [[ -f pom.xml ]]; then exit 0 fi exit 1
  • 12. Buildpacks • bin/build echo "---> Installing JDK" echo "---> Running Maven” if [[ -x mvnw ]]; then echo "---> Running Maven Wrapper" ./mvnw clean install -B -DskipTests else mvn clean install -B -DskipTests fi # Set default start command for jarFile in $(find target -maxdepth 1 -name "*.jar" -type f); do echo "processes = [{ type = "web", command = "java -jar $jarFile"}]" > "$layers_dir/launch.toml" break; done
  • 13. Buildpacks • 이미지 실행 Entrypoint • launch.toml 파일을 해석해서 실행 • 현재는 type에 web만 지원 • Command에 실행할 명령어를 추가 "Entrypoint": [ "/lifecycle/launcher" ], [[processes]] type = "web" command = "java -jar target/java-springboot-0.0.1-SNAPSHOT.jar"
  • 14. Buildpacks 사용하기 - Demo git clone https://github.com/arisu1000/helloworld-java-spring.git cd helloworld-java-spring pack build arisu1000/helloworld-java-spring docker volume ls docker inspect arisu1000/helloworld-java-spring docker push arisu1000/helloworld-java-spring
  • 15. Knative • 용도 : 컨테이너를 실행하고 관리하는 역할 • Kubernetes 에서 실행되는 serverless 플랫폼 • 2018년 7월 공개 • https://knative.dev/ • 주요 참여 기업 : Google, Pivotal, IBM, Red Hat, SAP • 2019년 7월 버전 : 0.7
  • 17. Knative • 각 컴포넌트가 독립적으로 구성되어 있음 • 주요 컴포넌트 • Build : 컨테이너 빌드를 담당 • Serving : 컨테이너 실행 및 운영을 담당 • Eventing : 이벤트를 발생시키고 구독하는 역할을 담당
  • 18. Knative - build • Kubernetes CRD(Custom Resource Definition)를 생성해서 사용 • 주요 개념 • Source : 빌드할 소스 • Steps : 작업을 실행하기위한 컨테이너 이미지와 작업 내역들 • BuildTemplate : 재사용 가능한 템플릿 • 인증 : kubernetes 시크릿을 이용하도록 ServiceAccount를 사용
  • 19. Knative - build • Build yaml apiVersion: build.knative.dev/v1alpha1 kind: Build metadata: name: kaniko-build spec: serviceAccountName: build-bot source: git: url: https://github.com/my-user/my-repo revision: master template: name: kaniko arguments: - name: IMAGE value: us.gcr.io/my-project/my-app
  • 20. Knative - build • BuildTemplate yaml apiVersion: build.knative.dev/v1alpha1 kind: BuildTemplate metadata: name: kaniko spec: parameters: - name: IMAGE description: The name of the image to push - name: DOCKERFILE description: Path to the Dockerfile to build. default: /workspace/Dockerfile steps: - name: build-and-push image: gcr.io/kaniko-project/executor args: - --dockerfile=${DOCKERFILE} - --destination=${IMAGE} env: - name: DOCKER_CONFIG value: /builder/home/.docker
  • 21. Knative - build • Build-templates : https://github.com/knative/build-templates
  • 22. Knative - serving • Kubernetes CRD를 생성해서 사용 • 목적 • 서버리스 컨테이너의 빠른 배포 • 컨테이너 오토스케일링 관리 • Istio를 이용한 라우팅과 네트워크 프로그래밍 • 배포된 코드와 설정을 Point-in-time 스냅샷 형식으로 관리
  • 23. Knative – serving resource • Service • service.serving.knative.dev : 워크로드의 전체 라이프 사이클을 자동으로 관리. • Route, configuration, revision같은 다른 객체들을 만들고 관리한다. • Route • route.serving.knative.dev : 네트워크 엔드포인트를 revision에 매핑하는 역할. • Configuration • configuration.serving.knative.dev : 배포의 원하는 상태(desired state)를 관리함. • 코드와 설정을 분리하기 위해서 필요함. • Revision • revision.serving.knative.dev : 코드와 configuration의 시점별(point-in-time) 스냅샷. • 이뮤터블객체이고 필요한만큼 유지가능하다.
  • 25. Knative – serving 구성요소 • Controller • Serving 전체 상태를 관리하는 프로세스 • pkg/reconciler/v1alpha1/ 하위에 보면 각종 리소스(autoscaling, cluster ingress, configuration, labeler, revision, route, service, testing) 에 대한 컨트롤러들이 있고 각각이 고루틴으로 떠서 실행된다. • Webhook • knative/pkg 하위의 webhook을 사용하는 공통 모듈 • 모든 Kubernetes API 호출과 CRD 관련 내용을 중간에 확인해서 유효 한 요청인지 검증하고 관리하는 역할을 한다.
  • 26. Knative – serving 구성요소 • Activator • 비활성화된 revision에 대한 요청을 받아서 버퍼링 • autoscaler에 메트릭 리포팅 • revision이 리포팅된 메트릭 기반으로 스케일이 된 다음에 revision에 요청을 다시 전송 • Autoscaler • 어노테이션을 이용해서 오토스케일링될 Min, max를 설정할 수 있음. • configuration.revisionTemplate 이나 revision에 다음 어노테이션을 사 용하면 됨. # +optional # When not specified, the revision can scale down to 0 pods autoscaling.knative.dev/minScale: "2" # +optional # When not specified, there's no upper scale bound autoscaling.knative.dev/maxScale: "10"
  • 27. Knative - serving • Serving yaml apiVersion: serving.knative.dev/v1alpha1 kind: Service metadata: name: helloworld-java-spring namespace: default spec: runLatest: configuration: revisionTemplate: metadata: annotations: autoscaling.knative.dev/minScale: "1" spec: container: image: arisu1000/helloworld-java-spring env: - name: TARGET value: ”Java Sample v1" $ kubectl get ksvc NAME URL LATESTCREATED LATESTREADY READY REASON helloworld-java-spring http://helloworld-java-spring.default.example.com helloworld-java-spring-dws5r helloworld-java-spring-dws5r True
  • 28. Knative 설치 • https://knative.dev/docs/install/ • Install to Docker for mac • Install Istio • Install Knative Serving curl -L https://raw.githubusercontent.com/knative/serving/v0.7.0/third_party/istio-1.0.7/istio.yaml | sed 's/LoadBalancer/NodePort/' | kubectl apply --filename - # Label the default namespace with istio-injection=enabled. kubectl label namespace default istio-injection=enabled kubectl get pods --namespace istio-system curl -L https://github.com/knative/serving/releases/download/v0.7.0/serving.yaml | sed 's/LoadBalancer/NodePort/' | kubectl apply --selector networking.knative.dev/certificate-provider!=cert-manager --filename - kubectl get pods --namespace knative-serving
  • 29. Knative : App Deployment • https://github.com/knative/docs/tree/master/docs/serving/sa mples/hello-world/helloworld-java-spring $ kubectl get svc istio-ingressgateway --namespace istio-system NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE istio-ingressgateway NodePort 10.111.180.86 <none> 80:30593/TCP,443:32276/TCP,31400:31895/TCP,15011:30766/TCP,8060:31075/TC P,853:32694/TCP,15030:32027/TCP,15031:30882/TCP 22m $ kubectl get ksvc helloworld-java-spring --output=custom-columns=NAME:.metadata.name,URL:.status.url NAME URL helloworld-java-spring http://helloworld-java-spring.default.example.com $ curl -H "Host: helloworld-java-spring.default.example.com" http://localhost:30593 Hello Spring Boot Sample v1!%
  • 30. Q&A