IaC/CI CD Tool

ArgoCD란?

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

Overview

오늘은 ArgoCD에 대해 공부해보려고 한다.

 

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

 


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란?

 

MetalLB란?

Overview 오늘은 Bare-Metal에서 많이 사용하는 LoadBalancer인 MetalLB에 대해서 공부해보려고 한다. MetalLB란? Kubernetes 사용 시 AWS, GCP, Azure 와 같은 클라우드 플랫폼에서는 자체적으로 로드 벨런서(Load Balan

somaz.tistory.com

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

 

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

$ 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

 

로그인 완료!

 


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 개념 및 설치  (0) 2023.04.23
1. GitLab이란? / 개념 및 설치  (0) 2023.04.20