Jenkins-ArgoCD 연동

공식문서 : https://argo-cd.readthedocs.io/en/stable/user-guide/commands/argocd_proj_role_create-token/

참고문서 : https://yetiops.net/posts/argocd-jenkins-pipeline/

  1. argocd Role 생성 - jenkins-deploy-role (임의지정가능)
  2. argocd 서버 접속 - 쿠버네티스

ArgoCD 쿠버네티스 조회

haes995@cloudshell:~$ kubectl get po,svc -n argo

NAME                                                         READY   STATUS    RESTARTS   AGE
pod/argo-argocd-application-controller-0                     1/1     Running   0          27h
pod/argo-argocd-applicationset-controller-5ccbc946d8-q8x8s   1/1     Running   0          27h
pod/argo-argocd-dex-server-7f5d67f758-kw6c4                  1/1     Running   0          27h
pod/argo-argocd-notifications-controller-854c576995-lgrr8    1/1     Running   0          27h
pod/argo-argocd-redis-d7d5d878c-26xl4                        1/1     Running   0          27h
pod/argo-argocd-repo-server-7fd4b9bfdc-plgbh                 1/1     Running   0          27h
pod/argo-argocd-server-6bcc6b597d-xxkqt                      1/1     Running   0          27h

NAME                                            TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)                      AGE
service/argo-argocd-application-controller      ClusterIP      10.12.1.74     <none>           8082/TCP                     27h
service/argo-argocd-applicationset-controller   ClusterIP      10.12.0.5      <none>           7000/TCP                     27h
service/argo-argocd-dex-server                  ClusterIP      10.12.15.114   <none>           5556/TCP,5557/TCP            27h
service/argo-argocd-redis                       ClusterIP      10.12.12.13    <none>           6379/TCP                     27h
service/argo-argocd-repo-server                 ClusterIP      10.12.8.253    <none>           8081/TCP                     27h
service/argo-argocd-server                      LoadBalancer   10.12.15.93    34.134.251.125   80:32361/TCP,443:30179/TCP   27h

ArgoCD 접속

haes995@cloudshell:~$ kubectl exec -it argo-argocd-server-6bcc6b597d-xxkqt /bin/bash -n argo

ArgoCD 로그인

argocd@argo-argocd-server-6bcc6b597d-xxkqt:~$ argocd login 34.134.251.125

Username :

Password :

'—:login' logged in successfully

role 추가

$ argocd proj role create-token default jenkins-deploy-role

생성 예시

Create token succeeded for proj:default:jenkins-deploy-role.
  ID: 5a0dadfa-e17d-43fd-abf6-4012400feafa
  Issued At: 2022-10-21T06:05:42Z
  Expires At: Never

Project의 Role에서 JWT token이 생기고

이를 이용하여 Jenkines의 Manage Credentials에 입력한다.

  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유