[CI/CD] ArgoCD 를 이용한 CD 적용해보기 #1

김지환·2023년 7월 2일
0

TL;DR

효율적인 개발 프로세스를 갖추기 위해서는 CI/CD가 정말 중요한거 같다. 제대로된 프로세스가 갖춰져 있지 않으면 새로 합류한 사람들이 적응하기 여간 쉬운게 아니다. 심지어 인수인계(혹은 문서화 일 수도)를 제대로 받지 못했을 경우에는 더 최악의 상황이라 할 수 있다.

그중 CD ( Continuous Delivery ) 를 통한 서비스의 버전관리 및 자동배포는 실질적으로 엔드유저에게 직접적인 영향을 끼치는 부분으로 신중하게 고려할 필요가 있다.

EKS 환경에서 서비스를 운영하고 있다면 유명하게 사용되고 있는 CD Tool로 ArgoCD를 이용해 보는것이 좋은 것 같다. 잘 갖춰진 Docs가 있고, 이미 많은 유저들이 사용을 해보고 만들어진 예제도 많아서 실사용에 적용하기에 어려움이 없는게 큰 장점인 것 같다. 또한 ArgoCD 에서 제공해주는 UI를 통해서 한눈에 서비스들을 파악할 수 있어서 관리에 있어서 큰 도움을 준다.

Prerequisites

  • local에서 K8s환경을 구성하여 사용할 수 있도록 minikube 를 이용했다.
  • k8s 명령어를 사용하기 위한 kubectl 설치.
  • ArgoCD를 적용할 Repository 생성!
    * 이번 포스팅에서는 helm local repository를 이용.

Install ArgoCD using Helm

helm 을 통해서 ArgoCD를 minikube에 배포해 보도록 하자.

우선 helm repository를 등록을 한다.

helm repo add argo https://argoproj.github.io/argo-helm

그 후 helm install을 통해서 argocd를 설치

helm install argocd argo/argo-cd
NAME: argocd
LAST DEPLOYED: Tue Jun 27 20:38:23 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
In order to access the server UI you have the following options:

1. kubectl port-forward service/argocd-server -n default 8080:443

    and then open the browser on http://localhost:8080 and accept the certificate

2. enable ingress in the values file `server.ingress.enabled` and either
      - Add the annotation for ssl passthrough: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/#option-1-ssl-passthrough
      - Set the `configs.params."server.insecure"` in the values file and terminate SSL at your ingress: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/#option-2-multiple-ingress-objects-and-hosts


After reaching the UI the first time you can login with username: admin and the random password generated during the installation. You can find the password by running:

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

(You should delete the initial secret afterwards as suggested by the Getting Started Guide: https://argo-cd.readthedocs.io/en/stable/getting_started/#4-login-using-the-cli)

위와 같은 Description이 나오게 된다. local k8s에서 테스트하고 있다면 위에 나오는 설명을 통해서 port-forwarding 을 통해서 웹브라우저에서 UI를 확인해 볼 수 있다. 클라우드 환경에서 작업을 한다면 추가적으로 로드밸런서를 설치해서 접근할 수 있게 해주어야 한다.

Argo UI 접속 및 살펴보기

위에 나왔던 명령어를 통해서 admin 계정의 패스워드를 얻을 수 있다.

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

그 후 port forwarding 을 통해서 브라우저를 통해 접속한다.

다음은 Application 을 적용해서 사용해보는 것을 해보자~

profile
Developer

0개의 댓글