devops/argocd

argocd 배포하기

gepp 2024. 1. 25. 17:56

 

argocd를 helm 을 이용해 설치하고 다음 값을 설정해서 설치하였다.

 

USER-SUPPLIED VALUES:
rbacConfig:
  groups:
  - name: admin
    rules:
    - apiGroups:
      - '*'
      resources:
      - '*'
      verbs:
      - '*'
  users:
  - groups:
    - admin
    name: admin
server:
  extraArgs:
  - --insecure
  ingress:
    annotations:
      kubernetes.io/ingress.class: nginx
      nginx.ingres.kubernetes.io/affinity: cookie
      nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
      nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
      nginx.ingress.kubernetes.io/session-cookie-name: route
      cert-manager.io/cluster-issuer: letsencrypt-prod
      acme.cert-manager.io/http01-edit-in-place: "true"
      meta.helm.sh/release-name: argocd
      meta.helm.sh/release-namespace: argocd
      
    enabled: true
    hosts:
    - argocd.yourdomain.com
    ingressClassName: nginx
  service:
    type: NodePort
        # -- Ingress TLS configuration
    tls: []
        # - secretName: argocd-applicationset-tls
        #   hosts:
        #     - argocd-applicationset.example.com

 

인증서를 쓰는 도메인을 사용할 경우 tls에 기술한다.

helm 설치 후 해당 네임스페이스에 기술한 시크릿이 생성되었는지 확인한다.

tls 설정 부분을 위한 annotation이 부족한 경우 정상적으로 시크릿이 생성되지 않고 사이트에 불완전한 커넥션 표시가 뜰 수 있다.

위 동작을 위해 cert-manager가 쿠버네티스 클러스터에 미리 설치되어 있어야 한다.

 

또한 인그레스를 활성화하는 값을 사용했으므로 해당 네임스페이스에 정의한 ingress가 생성되었는지 확인한다.

 

 

어플리케이션 배포에 앞서 test Project를 생성하고 테스트를 위해 권한이 있는 role을 부여했다.

Clusters엔 현재 argocd 를 올려놓은 Cluster 가 등록되어있는 상태다.

 

이후 Applications 에서 EDIT AS YAML을 선택하여 아래와 같이 기본적인 테스트를 위한 설정을 입력했다.

 

project: test
source:
  repoURL: 'https://github.com/argoproj/argocd-example-apps'
  path: guestbook
  targetRevision: HEAD
destination:
  server: 'https://kubernetes.default.svc'
  namespace: default

 

어플리케이션이 처음 등록에 성공하면 Out of sync 상태로 표시되어있고,

해당 어플리케이션을 sync 해주면 세부사항이 바뀌면서 실제로 해당 네임스페이스에 리소스가 배포된 것을 확인할 수 있다.

 

 

등록했던 어플리케이션을 Delete 선택하여 삭제하면 다음과 같이 배포되었던 리소스도 삭제되었다.