Kubernetes 환경에서 ArgoCD 설치 및 GitOps 구축 가이드

ArgoCD 설치 # argocd namespace 생성 kubectl create namespace argocd # argocd 설치 kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml ArgoCD Server expose 설정 NodePort 로 Service 를 expose 하여 접속 가능하도록 설정 # 방법1: argocd-server service expose kubectl expose svc argocd-server -n argocd --type=NodePort --name=argocd-server # 방법2: argocd-server edit로 yaml 파일을 열어 NodePort 설정 kubectl edit svc argocd-server -n argocd argocd-server service 의 NodePort 확인 kubectl get svc argocd-server -n argocd argocd-server service 의 NodePort 로 접속하여 확인 ArgoCD 로그인 # admin 비밀번호 확인 kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo ArgoCD Application 생성 ArgoCD UI 접속 admin 계정으로 로그인 New App 버튼 클릭 Application Name 입력 Project 선택 SYNC POLICY 선택 Repository URL 입력 Revision 입력 Path 입력 deployment.yaml, service.yaml 파일이 있는 경로 root directory 에 있을 경우 . 입력 Cluster URL 입력 (기본값: https://kubernetes.default.svc) Namespace 입력 Create 버튼 클릭 ArgoCD 배포 확인 생성된 Application 에서 Sync 버튼 클릭 Sync Status 확인 Sync Status 가 Synced 로 변경되면 배포 완료

June 7, 2023 · 1 min