SlideShare a Scribd company logo
GitLab과 Kubernetes를
통한 CI/CD 구축
2018.6
콘텐츠연합플랫폼
김철구
Who am I?
콘텐츠연합플랫폼 DevOps Engineer
- Cloud System 운영
- Cloud 이전 및 MSA 설계
- CI/CD process 도입 및 운영
Email: cgkim@captv.co.kr
GitLab과 Kubernetes를 통한 CI/CD 구축
CI/CD란 무엇인가?
CI(Continuous Integration)
지속적인 통합(CI) : software 개발 방식
• 개발팀 구성원들이 각자 일단위로 code를 integration.
→ 하루에 다수의 integration이 발생.
• integration은 자동화된 build와 test로 검증.
→ integration error는 가능한 한 빠르게 감지.
위 방식의 도입으로 다수의 팀에서 만들어지는 integration 문
제를 획기적으로 줄임으로써 빠르게 software를 개발할 수 있
다.
2006… Martin Fowler
CD(Continuous Delivery)
• 지속적인 통합을 확장.
• CI 프로세스를 통과한 변경사항을
Test/Production 환경에 즉시 배포.
• 지속적인 전달(CD).
• dev/staging/production 환경에 대한
application 배치 자동화.
• 여러 application에 대한 변경 사항, 동시 배치
관리의 Pipeline.
• production 업데이트에 대한 승인 프로세스 제
공.
CI/CD workflow
MSA에서 CI/CD를
어떻게 구현할 것인가?
pooq 2.x CI/CD process
git commit
Developer
git pull
Deploy request
Trigger
build/deploy
Publish
binary
1. 개발자 - git branch에 source code commit 후 Github repository에 merge.
2. 배포 요청 → 운영자 - Jenkins build trigger를 수행.
3. Jenkins에서 Build된 binary는 codedeploy plugin을 배포 trigger.
4. AWS CodeDeploy에서 지정된 target EC2 instance들로 배포.
Administrator
AWS
CodeDeploy
EC2
instances
Docker 기반 CI/CD process 구성안
1. 개발자 - git branch에 source code
commit 후 Github repository에
merge.
2. Github webhook으로 Jenkins build
실행 – docker image build 후
private registr로 push.
3. 운영자 – push된 image를 Devops
tool(ex.Ansible)로 Docker instance
group에 배포.
Developer
git commit
GitHub webhook
triggers Jenkins
Docker Registry
Docker image
Buildsource
BuildDockerimage
CI(Continuous Integration)
CD(Continuous Deployment)
Administrator
Devops Tool
Request
deploy
Create container from latest image
docker pull [image:tag]
Container 기반 MSA에서 CI/CD 고려사항
• VCS(Version Control System) – Git 기반 repository.
• Container image registry – 내부 project들의 이미지가 외부에 노출되지 않도록 private
registry 필요.
• Container Orchestration – 다수의 Docker instance들을 clustering하여 scheduling,
network setup, 고가용성, 확장성을 관리.
• CI(Continuous Integration) – Polyglot(multi-language) programming을 지원, 다수의
MicroService CI Pipeline을 동시에 실행.
• CD(Continuous Delivery) – Container Orchestration과 통합되어 최신의 Container
image를 Roll out/back할 수 있는 기능과 인터페이스 제공.
CI/CD architecture 초안
• CI/CD는 Jenkins를 통해 관리.
• AWS ECR을 private image registr
로 사용.
• Container Orchestration platform
으로 AWS ECS 사용.
• Jenkins에서는 AWS CodePipeline
plug-in을 통해 deploy trigger.
• deploy step에서 issue 발생 시
email로 통지.
Developer
git commit
GitHub webhook
triggers Jenkins
Administrator
Request
deploy
Create container from latest image
docker pull [image:tag]
Amazon ECR
Amazon ECS
AWS
CodePipeline
triggersdeploy
appimages
CI/CD architecture 초안 문제 사항
Administrator
Amazon ECR Amazon ECS AWS
CodePipeline
Jenkins
• plug-in 관리의 복잡성.
• CI/CD Pipeline 작성의 어려움.
• 계정관리의 복잡성.
AWS Container Service
• Service discovery 미지원.(별도 solution 구축 필요.)
• Korea region 미지원(당시).
• AWS 서비스 의존성 100%.
• AWS 구성요소들에 대한 설정 복잡성 증가.
Administrator
• 모든 요소들에 대한 설정 및 제어.
• 배워야 하는 기술들의 증가.
• Microservice Project가 수 백개가 증가하면 작업량도 비례하여 증가.
Solution은?
 Open source
 Git 기반 version 관리 서비스
 통합된 CI 제공.
 Private Container Registry 통합.
 Docker 기반으로 build 및 Test, 등록, 배포 자동화.
 다수의 GitLab Runner 서버를 통해 동시작업을 병렬로
수행.
 YAML 기반의 CI workflow 정의로 code화 template화
가능.
 CLI script job executor로 Container
Orchestration(Kubernetes)에 배포가능.
GitLab
GitLab CI/CD process
• 개발자 – microservice project에 code를 commit.
• CI/CD pipelin은 .gitlab-ci.yml에 YAML code를 통해 정의.
• GitLab은 GitLab Runner들을 통해 병렬로 target에 deploy를 수행.
• pipeline 실행과정에서 발생된 issue는 slack에 통합되어 통지.
Developer
git commit Deploy
Kubernetes
notification
GitLab CI/CD
GitLab CI/CD Architecture
• GitLab CI/CD – GitLab의 일
부분으로 web applicatio과
state를 DB에 저장하는 API로
동작한다. project들과 build들
을 관리하며 사용자 친화적인
UI를 제공한다.
• GitLab Runner – build들을
처리하는 applicatio으로 별도
로 배치되어 GitLab CI/CD와
API를 통해 동작된다. 각각의
Runner는 공유되지만 project
에 dedicate될 수 있다.
GitLab CI/CD Pipeline 기초
• .gitlat-ci.yml
• CI/CD pipeline을 정의하는 file로 YAML로 기술.
• git repositor의 root director에 위치.
before_script:
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
- ruby -v
- which ruby
- gem install bundler --no-ri --no-rdoc
- bundle install --jobs $(nproc) "${FLAGS[@]}"
rspec:
script:
- bundle exec rspec
rubocop:
script:
- bundle exec rubocop
GitLab CI/CD Pipeline 기초
• Commit으로 CI를 Triggering
GitLab CI/CD Pipeline 기초
• Pipeline Tab에서 commit history 별로 배포 상황을 확인.
GitLab CI/CD Pipeline 기초
• 상세 log는 StdOut, StdErr으로 출력되어 UI에서 확인
.gitlab-ci.yml Job Example
Simple Job Example job1:
script: ls -l
Multiple Script
Commands
job1:
script:
- cd myproject
- vender/bin/phpunit
Multi Stages stages:
- test
- deploy
run_tests:
stage: test
script: php run-some-tests.php
deploy_to_server:
stage: deploy
script: php mageDeploy2.php
※ .gitlab-ci.yml Guide: https://docs.gitlab.com/ee/ci/yaml/README.html
시연
Q&A
감사합니다.

More Related Content

PDF
Introducing GitLab (September 2018)
PDF
Gitops: the kubernetes way
PPTX
Azure DevOps in Action
PDF
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
PPTX
Power of Azure Devops
PPTX
Jenkins CI
PDF
GitOps - Operation By Pull Request
PDF
Gitlab, GitOps & ArgoCD
Introducing GitLab (September 2018)
Gitops: the kubernetes way
Azure DevOps in Action
쿠버네티스를 이용한 기능 브랜치별 테스트 서버 만들기 (GitOps CI/CD)
Power of Azure Devops
Jenkins CI
GitOps - Operation By Pull Request
Gitlab, GitOps & ArgoCD

What's hot (20)

PPTX
Git Lab Introduction
PPTX
MSA ( Microservices Architecture ) 발표 자료 다운로드
PDF
클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSA
PPTX
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
PPTX
PDF
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
PDF
GitOps with ArgoCD
PDF
Devops Porto - CI/CD at Gitlab
PDF
CD using ArgoCD(KnolX).pdf
PDF
Introduction to GitHub Actions
PDF
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
PPTX
Platform engineering 101
PDF
GitOps and ArgoCD
PDF
ArgoCD Meetup PPT final.pdf
PPTX
Final terraform
PPTX
Intro to Helm for Kubernetes
PDF
GitOps 101 Presentation.pdf
PDF
Introduction to Kubernetes Workshop
PDF
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
PDF
Introducing GitLab
Git Lab Introduction
MSA ( Microservices Architecture ) 발표 자료 다운로드
클라우드 네이티브 IT를 위한 4가지 요소와 상관관계 - DevOps, CI/CD, Container, 그리고 MSA
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
GitOps with ArgoCD
Devops Porto - CI/CD at Gitlab
CD using ArgoCD(KnolX).pdf
Introduction to GitHub Actions
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Platform engineering 101
GitOps and ArgoCD
ArgoCD Meetup PPT final.pdf
Final terraform
Intro to Helm for Kubernetes
GitOps 101 Presentation.pdf
Introduction to Kubernetes Workshop
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
Introducing GitLab
Ad

Similar to GitLab과 Kubernetes를 통한 CI/CD 구축 (20)

PPTX
Travis-ci를 이용한 CI/CD와 도커를 이용한 Jenkins for Android 구성하기
PDF
효과적인 데브옵스를 위한 AWS 개발 도구 활용하기 - AWS Summit Seoul 2017
PDF
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...
PDF
Openshift 활용을 위한 Application의 준비, Cloud Native
PPTX
코드로 인프라 관리하기 - 자동화 툴 소개
PDF
[NDC17] 왓 스튜디오 서비스파트
PDF
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
PDF
Atlassian cloud 제품을 이용한 DevOps 프로세스 구축: Jira Cloud, Bitbucket Cloud
PDF
Atlassian cloud 제품을 이용한 DevOps 프로세스 구축
PDF
DevOps - CI/CD 알아보기
PDF
Knative로 서버리스 워크로드 구현
PDF
[D2 COMMUNITY] Open Container Seoul Meetup - 마이크로 서비스 아키텍쳐와 Docker kubernetes
PDF
데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online Series
PDF
Windows Kubernetes Deep Dive
PPTX
BRK3713 - Microsoft Azure에서 Windows와 Linux를 동시에 사용하는 하이브리드 Kubernetes 클러스터 구축
PDF
Pivotal 101세미나 발표자료 (PAS,PKS)
PDF
Open infradays 2019_msa_k8s
PPTX
DevOps (AWS, Docker, Ansible, Jenkins)
PDF
ifcpp build guide
PPTX
C++ GUI 라이브러리 소개: Qt & Nana
Travis-ci를 이용한 CI/CD와 도커를 이용한 Jenkins for Android 구성하기
효과적인 데브옵스를 위한 AWS 개발 도구 활용하기 - AWS Summit Seoul 2017
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...
Openshift 활용을 위한 Application의 준비, Cloud Native
코드로 인프라 관리하기 - 자동화 툴 소개
[NDC17] 왓 스튜디오 서비스파트
[2017 AWS Startup Day] 서버리스 마이크로서비스로 일당백 개발조직 만들기
Atlassian cloud 제품을 이용한 DevOps 프로세스 구축: Jira Cloud, Bitbucket Cloud
Atlassian cloud 제품을 이용한 DevOps 프로세스 구축
DevOps - CI/CD 알아보기
Knative로 서버리스 워크로드 구현
[D2 COMMUNITY] Open Container Seoul Meetup - 마이크로 서비스 아키텍쳐와 Docker kubernetes
데브옵스(DevOps) 문화 모범 사례와 구현 도구 살펴보기 – 박선준 :: AWS Builders Online Series
Windows Kubernetes Deep Dive
BRK3713 - Microsoft Azure에서 Windows와 Linux를 동시에 사용하는 하이브리드 Kubernetes 클러스터 구축
Pivotal 101세미나 발표자료 (PAS,PKS)
Open infradays 2019_msa_k8s
DevOps (AWS, Docker, Ansible, Jenkins)
ifcpp build guide
C++ GUI 라이브러리 소개: Qt & Nana
Ad

GitLab과 Kubernetes를 통한 CI/CD 구축

  • 1. GitLab과 Kubernetes를 통한 CI/CD 구축 2018.6 콘텐츠연합플랫폼 김철구
  • 2. Who am I? 콘텐츠연합플랫폼 DevOps Engineer - Cloud System 운영 - Cloud 이전 및 MSA 설계 - CI/CD process 도입 및 운영 Email: cgkim@captv.co.kr
  • 5. CI(Continuous Integration) 지속적인 통합(CI) : software 개발 방식 • 개발팀 구성원들이 각자 일단위로 code를 integration. → 하루에 다수의 integration이 발생. • integration은 자동화된 build와 test로 검증. → integration error는 가능한 한 빠르게 감지. 위 방식의 도입으로 다수의 팀에서 만들어지는 integration 문 제를 획기적으로 줄임으로써 빠르게 software를 개발할 수 있 다. 2006… Martin Fowler
  • 6. CD(Continuous Delivery) • 지속적인 통합을 확장. • CI 프로세스를 통과한 변경사항을 Test/Production 환경에 즉시 배포. • 지속적인 전달(CD). • dev/staging/production 환경에 대한 application 배치 자동화. • 여러 application에 대한 변경 사항, 동시 배치 관리의 Pipeline. • production 업데이트에 대한 승인 프로세스 제 공.
  • 9. pooq 2.x CI/CD process git commit Developer git pull Deploy request Trigger build/deploy Publish binary 1. 개발자 - git branch에 source code commit 후 Github repository에 merge. 2. 배포 요청 → 운영자 - Jenkins build trigger를 수행. 3. Jenkins에서 Build된 binary는 codedeploy plugin을 배포 trigger. 4. AWS CodeDeploy에서 지정된 target EC2 instance들로 배포. Administrator AWS CodeDeploy EC2 instances
  • 10. Docker 기반 CI/CD process 구성안 1. 개발자 - git branch에 source code commit 후 Github repository에 merge. 2. Github webhook으로 Jenkins build 실행 – docker image build 후 private registr로 push. 3. 운영자 – push된 image를 Devops tool(ex.Ansible)로 Docker instance group에 배포. Developer git commit GitHub webhook triggers Jenkins Docker Registry Docker image Buildsource BuildDockerimage CI(Continuous Integration) CD(Continuous Deployment) Administrator Devops Tool Request deploy Create container from latest image docker pull [image:tag]
  • 11. Container 기반 MSA에서 CI/CD 고려사항 • VCS(Version Control System) – Git 기반 repository. • Container image registry – 내부 project들의 이미지가 외부에 노출되지 않도록 private registry 필요. • Container Orchestration – 다수의 Docker instance들을 clustering하여 scheduling, network setup, 고가용성, 확장성을 관리. • CI(Continuous Integration) – Polyglot(multi-language) programming을 지원, 다수의 MicroService CI Pipeline을 동시에 실행. • CD(Continuous Delivery) – Container Orchestration과 통합되어 최신의 Container image를 Roll out/back할 수 있는 기능과 인터페이스 제공.
  • 12. CI/CD architecture 초안 • CI/CD는 Jenkins를 통해 관리. • AWS ECR을 private image registr 로 사용. • Container Orchestration platform 으로 AWS ECS 사용. • Jenkins에서는 AWS CodePipeline plug-in을 통해 deploy trigger. • deploy step에서 issue 발생 시 email로 통지. Developer git commit GitHub webhook triggers Jenkins Administrator Request deploy Create container from latest image docker pull [image:tag] Amazon ECR Amazon ECS AWS CodePipeline triggersdeploy appimages
  • 13. CI/CD architecture 초안 문제 사항 Administrator Amazon ECR Amazon ECS AWS CodePipeline Jenkins • plug-in 관리의 복잡성. • CI/CD Pipeline 작성의 어려움. • 계정관리의 복잡성. AWS Container Service • Service discovery 미지원.(별도 solution 구축 필요.) • Korea region 미지원(당시). • AWS 서비스 의존성 100%. • AWS 구성요소들에 대한 설정 복잡성 증가. Administrator • 모든 요소들에 대한 설정 및 제어. • 배워야 하는 기술들의 증가. • Microservice Project가 수 백개가 증가하면 작업량도 비례하여 증가.
  • 14. Solution은?  Open source  Git 기반 version 관리 서비스  통합된 CI 제공.  Private Container Registry 통합.  Docker 기반으로 build 및 Test, 등록, 배포 자동화.  다수의 GitLab Runner 서버를 통해 동시작업을 병렬로 수행.  YAML 기반의 CI workflow 정의로 code화 template화 가능.  CLI script job executor로 Container Orchestration(Kubernetes)에 배포가능. GitLab
  • 15. GitLab CI/CD process • 개발자 – microservice project에 code를 commit. • CI/CD pipelin은 .gitlab-ci.yml에 YAML code를 통해 정의. • GitLab은 GitLab Runner들을 통해 병렬로 target에 deploy를 수행. • pipeline 실행과정에서 발생된 issue는 slack에 통합되어 통지. Developer git commit Deploy Kubernetes notification
  • 17. GitLab CI/CD Architecture • GitLab CI/CD – GitLab의 일 부분으로 web applicatio과 state를 DB에 저장하는 API로 동작한다. project들과 build들 을 관리하며 사용자 친화적인 UI를 제공한다. • GitLab Runner – build들을 처리하는 applicatio으로 별도 로 배치되어 GitLab CI/CD와 API를 통해 동작된다. 각각의 Runner는 공유되지만 project 에 dedicate될 수 있다.
  • 18. GitLab CI/CD Pipeline 기초 • .gitlat-ci.yml • CI/CD pipeline을 정의하는 file로 YAML로 기술. • git repositor의 root director에 위치. before_script: - apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs - ruby -v - which ruby - gem install bundler --no-ri --no-rdoc - bundle install --jobs $(nproc) "${FLAGS[@]}" rspec: script: - bundle exec rspec rubocop: script: - bundle exec rubocop
  • 19. GitLab CI/CD Pipeline 기초 • Commit으로 CI를 Triggering
  • 20. GitLab CI/CD Pipeline 기초 • Pipeline Tab에서 commit history 별로 배포 상황을 확인.
  • 21. GitLab CI/CD Pipeline 기초 • 상세 log는 StdOut, StdErr으로 출력되어 UI에서 확인
  • 22. .gitlab-ci.yml Job Example Simple Job Example job1: script: ls -l Multiple Script Commands job1: script: - cd myproject - vender/bin/phpunit Multi Stages stages: - test - deploy run_tests: stage: test script: php run-some-tests.php deploy_to_server: stage: deploy script: php mageDeploy2.php ※ .gitlab-ci.yml Guide: https://docs.gitlab.com/ee/ci/yaml/README.html
  • 24. Q&A