인프런 워밍업 클럽 4기 DevOps - 4주차

sanghyun·2025년 6월 24일
0
post-thumbnail

모든 강의 이미지 출처는 [인프런] 쿠버네티스 어나더 클래스(지상편) - Spring 1,2 입니다.

Section 19. ArgoCD 빠르게 배포하기


[미션] Jenkins 빌드 후 Image Tag 변경 내용을 Github로 Push, 그리고 ArgoCD로 자동 배포

▶ App 생성

Application Name : api-tester-2232-build-push-git

Repository URL : https://github.com/<Github-Username>/kubernetes-anotherclass-sprint2.git
Revision : main
Path : 2232-build-push-git/deploy/helm/api-tester

▶ App 생성 후 자동 배포 설정 (Enable Auto-Sync)

▶ Jenkins에 Github Token 등록

  • Github > Settings > Developer Settings > Personal access token 에서 Repo 항목 체크 후 토큰 발급
  • 발급한 토큰 값을 클립보드에 복사 (재발급이 불가하다!)
  • Jenkins > Dashboard > Jenkins 관리 > Credentials > Global Credentials 에 신규 추가
Kind : Username with password
Scope : Global
Username : <Github-Username>
Password : <Github에서 발급 받은 토큰>
ID : github_token
Description : Github 업데이트 토큰

위 작업을 해주지 않으면 Jenkins에서 해당 Github Repo에 대한 권한이 없어 빌드 시 아래와 같은 403 에러 로그를 확인할 수 있다.

▶ Jeknins에서 Source/Container 빌드 후 Docker로 업로드

  • 신규 List View 생성 후, 신규 item > Pipeline 선택
Definition : Pipeline script from SCM
Definition > SCM : Git
Definition > SCM > Repositories > Repository URL : https://github.com/<Github_Username>/kubernetes-anotherclass-sprint2.git
Definition > SCM > Branches to build > Branch Specifier : */main
Definition > SCM > Branches to build > Additional Behaviours > Sparse Checkout paths > Path : 2232-build-push-git
Definition > Script Path : 2232-build-push-git/Jenkinsfile
  • 파라미터와 함께 빌드 > 본인의 DockerHub와 Github Username 입력 후 [빌드]

  • Github에서도 이미지 태그도 신규 빌드된 버전으로 자동 업데이트 되고, Auto Sync 기능으로 인해 ArgoCD에서 신규 태그 버전으로 Application 배포가 수행되는 것을 확인할 수 있다.

profile
안하는 건 있어도, 못하는 건 없다

0개의 댓글