DevOps

argocd

우제혁 2023. 12. 18. 17:03

ArgoCD?

  • GitOps를 구현하기 위한 도구 중 하나
  • Kubernetes 애플리케이션의 자동 배포를 위한 오픈소스 도구이다.
  • Kubernetes 클러스터에 배포된 애플리케이션의 CI/CD 파이프라인에서 CD부분을 담당하며
  • Git 저장소에서 변경 사항을 감지하여 자동으로 Kubernetes 클러스터에 애플리케이션을 배포할 수 있다.

더 쉬운 이해

해당 EKS에 배포를 위한 menifest 파일이 담겨있는 yaml 파일이 있으며

해당 코드의 소스코드(버전 정보) 가 바뀌면 자동으로 eks에 배포를 진행하는 서비스이다.

설치

ArgoCD를 eks cluster 에 설치

kubectl create namespace argocd
kubectl apply -n argocd -f [https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml](https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml)

ArgoCD 서버는 기본적으로 퍼블릭 하게 노출되지 않아 기본 설정을 변경하여 ELB 를 통해 접속 가능

kubectl patch svc argocd-server -n argocd --type='json' -p='[{"op": "replace", "path": "/spec/type", "value": "LoadBalancer"}]'
kubectl -n argocd get all

argocd passwd 확인

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}"

접속 도메인 확인

kubectl get svc argocd-server -n argocd -o json

argocd 로그인

argocd setting

setting을 통해 다음과같이 연결. (public 이면 id pw 안해도된다)

ArgoCD Application 생성

eksworkshop-cd-pipeline

https://kubernetes.default.svc

생성 모습

해당 UI로 리소스를 확인할 수 있다.

mysql application도 확인이 가능