IaC/CI CD Tool

ArgoCD란?

Somaz 2023. 5. 17. 20:50
728x90
반응형

Overview

오늘은 GitOps 기반 배포 도구인 ArgoCD에 대해 알아보고, 직접 설치해보는 과정을 정리해본다.

ArgoCD는 Kubernetes 환경에서 선언적인 방식으로 애플리케이션을 배포하고 관리할 수 있는 도구로, Git 저장소에 정의된 상태를 기준으로 클러스터를 자동 동기화한다.

 


즉, Git을 단일 진실 소스로 삼아 클러스터를 운영하게 되는 GitOps 패턴을 실현하는 데 핵심적인 역할을 한다.

 

본 글에서는 ArgoCD의 개념 소개부터 설치, MetalLB 및 Ingress-NGINX를 활용한 외부 접근 구성, 그리고 초기 설정 및 로그인까지 실습 기반으로 상세히 정리하였다.


또한 Route53 도메인 연동, TLS 인증서 설정, Helm 없이 kubectl apply 만으로도 구성 가능한 방법을 안내하여 실제 환경에서 빠르게 배포할 수 있도록 도와준다.

 

 

 

https://picluster.ricsanfre.com/docs/argocd/

 

 

 

ArgoCD

2023.05.16 - [IaC/CI CD Tool] - ArgoCD란?

2023.08.09 - [IaC/CI CD Tool] - ArgoCD 설치 AWS & GCP

2023.10.02 - [IaC/CI CD Tool] - ArgoCD ApplicationSet이란? (작성 방법)

2023.10.08 - [Container Orchestration/Kubernetes] - 2. Kustomize + ArgoCD ApplicationSet

2024.02.02 - [IaC/CI CD Tool] - Argo Workflow란?

2024.04.09 - [IaC/CI CD Tool] - ArgoCD SSO 구성 가이드(GCP Oauth)

2025.02.19 - [IaC/CI CD Tool] - ArgoCD SSO 구성 가이드(Gitlab)

 

 

 

 

 


 

 

 

ArgoCD란?

 

Argo CD 는 Kubernetes를 위한 선언적 GitOps 지속적 배포 도구이다.

 

그렇다면 왜 ArgoCD를 사용해야 할까?

 

애플리케이션 정의, 구성 및 환경은 선언적이고 버전이 제어되어야 한다. 

애플리케이션 배포 및 수명 주기 관리는 자동화되고 감사 가능하며 이해하기 쉬워야 한다.

 

 

 

GitOps란?

GitOps는 2017년에 위브웍스(Weaveworks Inc.)에서 처음 사용한 용어로 프로젝트에 DevOps의 실천 방법 중 하나이다.

클라우드 네이티브 애플리케이션을 대상으로 한 지속적 배포(Continuous Deployment)에 초점을 두고 있다.

단어로 알 수 있듯이 애플리케이션의 배포와 운영에 관련된 모든 요소들을 코드화하여 Git에서 관리(Operation) 한다는 것을 뜻한다.

출처: Weaveworks

 

 

 

 

 


 

 

 

 

 

ArgoCD 설치

ArgoCD는 Helm, Kubectl, Kustomize와 같이 다양한 방법으로 설치가 가능하다.

 

 

ArgoCD stable 버전을 설치하는 방법은 간단하다. kubectl로 설치하도록 하겠다.

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

 

 

 

ArgoCD HA 버전 구축방법

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/ha/install.yaml

 

 

 

ArgoCD CLI 설치 방법은 다음과 같다.

curl -sL -o argocd https://github.com/argoproj/argo-cd/releases/download/v2.7.1/argocd-linux-amd64

chmod +x argocd
sudo mv argocd /usr/local/bin/

 

 

 

 

ArgoCD 설치를 완료한 후 NodePort 또는 로드벨런서를 사용해 서비스를 외부로 오픈시켜준다.

 

MetalLB와 Ingress-nginx를 사용해서 ArgoCD 서비스를 외부로 오픈시켜준다.

2023.05.03 - [Container Orchestration/Kubernetes] - MetalLB란?

k get cm -n metallb-system -o yaml
apiVersion: v1
items:
- apiVersion: v1
  data:
    config: |
      address-pools:
      - name: somaz-ip-range
        protocol: layer2
        addresses:
        - 10.10.100.26 - 10.10.100.26
$ k get po,svc -n ingress-nginx
NAME                                            READY   STATUS      RESTARTS       AGE
pod/ingress-nginx-admission-patch-s6zwc         0/1     Completed   2              378d
pod/ingress-nginx-controller-75f58fbf6b-qph5z   1/1     Running     5 (110d ago)   378d

NAME                                         TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)                      AGE
service/ingress-nginx-controller             LoadBalancer   10.233.10.100   10.10.100.26   80:31500/TCP,443:31158/TCP   378d
service/ingress-nginx-controller-admission   ClusterIP      10.233.39.214   <none>         443/TCP                      378d

 

 

 

 

AWS Route53에 도메인을 CNAME으로 등록하였고 라우팅 대상은 MetalLB의 DNS로 지정하였다.

 

 

 

 

다음과 같이 Ingress를 작성해준다.

ArgoCD 공식 사이트에 내용은 설명되어 있다.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ilb-argocd
  namespace: argocd
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  rules:
    - host: argocd.somaz.link
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: argocd-server
                port:
                  name: https
  tls:
  - hosts:
    - argocd.somaz.link
    secretName: argocd-tls-gcp

 

 

 

설치된 리소스를 확인해준다.

$ k get po,svc,ingress,sts -n argocd

NAME                                                    READY   STATUS    RESTARTS   AGE
pod/argocd-application-controller-0                     1/1     Running   0          56s
pod/argocd-applicationset-controller-6c88cfbf55-dstbz   1/1     Running   0          57s
pod/argocd-dex-server-7d94775cbf-q98sd                  1/1     Running   0          57s
pod/argocd-notifications-controller-56cd68f646-fpcj7    1/1     Running   0          57s
pod/argocd-redis-74f98b85f-7ztmz                        1/1     Running   0          56s
pod/argocd-repo-server-fdbf7cb4-5dfnv                   1/1     Running   0          56s
pod/argocd-server-675cbc776c-d5lfg                      1/1     Running   0          56s

NAME                                              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/argocd-applicationset-controller          ClusterIP   10.233.38.250   <none>        7000/TCP,8080/TCP            57s
service/argocd-dex-server                         ClusterIP   10.233.9.21     <none>        5556/TCP,5557/TCP,5558/TCP   57s
service/argocd-metrics                            ClusterIP   10.233.28.14    <none>        8082/TCP                     57s
service/argocd-notifications-controller-metrics   ClusterIP   10.233.51.0     <none>        9001/TCP                     57s
service/argocd-redis                              ClusterIP   10.233.22.211   <none>        6379/TCP                     57s
service/argocd-repo-server                        ClusterIP   10.233.18.44    <none>        8081/TCP,8084/TCP            57s
service/argocd-server                             ClusterIP   10.233.25.36    <none>        80/TCP,443/TCP               57s
service/argocd-server-metrics                     ClusterIP   10.233.15.122   <none>        8083/TCP                     57s

NAME                                   CLASS    HOSTS                 ADDRESS        PORTS   AGE
ingress.networking.k8s.io/ilb-arogcd   <none>   argocd.somaz.link   10.10.100.22   80      49s

NAME                                             READY   AGE
statefulset.apps/argocd-application-controller   1/1     56s

 

 

 

 

초기 패스워드를 확인해준다.

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

 

로그인 완료!

 

 

 

 

 


 

 

 

마무리

ArgoCD는 Git 기반의 선언형 배포 전략을 Kubernetes 환경에 효과적으로 적용할 수 있도록 해주는 매우 강력한 도구이다.

 

이번 실습을 통해 ArgoCD의 기본적인 설치와 초기 구성, Ingress와 MetalLB를 활용한 외부 접근 설정까지 한 번에 경험할 수 있었으며,
특히 Helm 없이도 간단하게 설치 가능한 점과 GitOps 방식의 자동화 흐름을 구현할 수 있다는 점에서 운영 환경에서도 충분히 활용 가능하다는 인사이트를 얻을 수 있었다.

 

앞으로는 ArgoCD의 고급 기능인 SSO 연동, ApplicationSet, 자동 동기화 정책, RBAC 제어 등의 내용도 차근차근 다뤄볼 예정이다.

 


GitOps를 도입하려는 팀이라면 ArgoCD는 분명 첫 번째로 고려해볼 만한 도구이며, 설치만으로도 인프라 자동화의 첫 단추를 꿸 수 있다.

 

 

 

 

 

 

 

 

 


Reference

https://argo-cd.readthedocs.io/en/stable/

 

https://picluster.ricsanfre.com/docs/argocd/

 

https://www.devkuma.com/docs/git-ops/

 

https://github.com/argoproj

728x90
반응형

'IaC > CI CD Tool' 카테고리의 다른 글

2. Github Action (With Syntax)  (0) 2023.05.22
1. Github Action이란?  (0) 2023.05.19
3. GitLab이란? / GitLab CI/CD  (0) 2023.04.24
2. GitLab이란? / GitLab Runner 개념 및 설치  (5) 2023.04.23
1. GitLab이란? / 개념 및 설치  (0) 2023.04.20