• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    해결됨

ArgoCD Image Updater ConfigMap 설정

24.03.14 10:04 작성 조회수 237

2

안녕하세요. ArgoCD Image Updater를 이용하여 Dev환경에서 code trigger 발생시 이미지 자동 빌드/업데이트부터, 이미지 업데이트를 감지하여 자동 배포까지 되도록 구성중에 있습니다.

그런데 image updater를 설치를 다 했고 image updater 파드에서 test 실행시에도 정상으로 나오면서 pod log에서도 2분 주기로 정상동작을 하고 있습니다.

다만, argocd 에서 application에 annotation을 아무리 설정을 해도 자동 배포가 되지 않고 image updater 파드 로그 확인시에도 카운트는 계속 0 으로 나온다는 것이죠. image updater가 argocd application 을 바라보지 못 하는 것인가 싶은데, configmap에서 설정을 수정해야 하는 것인지 어디가 문제인지 어떻게 해결해야 하는지 감이 잘 안옵니다..

제 환경을 먼저 설정드리자면

  1. private registry

  2. registry credentail = secret에 dockerconfigjson로 저장

  3. argocd, argocd-image-updater 는 같은 네임스페이스 (argocd) 에서 설치

  4. 배포할 application의 네임스페이스와 분리 - (네임스페이스: test)

  5. image tag = 버전업, latest 이 아닌 "dev"라는 태그명으로 이미지 업데이트

위와 같고, argocd-image-updater configMap은 아래처럼 작성했습니다.

apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/name: argocd-image-updater-config
    app.kubernetes.io/part-of: argocd-image-updater
  name: argocd-image-updater-config
  namespace: argocd
data:
  applications_api: argocd
  argocd.grpc_web: "true"
  argocd.insecure: "true"
  argocd.plaintext: "false"
  argocd.server_addr: <argocd-server EXTERNAL-IP>
  log.level: debug
  registries.conf: |
    registries:
      - name: bckrkube
        api_url: https://<azure>.azurecr.io
        prefix: <azure>.azurecr.io
        credentials: pullsecret:test/<registry-secret-name>
        ping: yes

그리고 application의 annotation은 아래처럼 했습니다.

argocd-image-updater.argoproj.io/image-list: <alias>=<registry>/<image-name>:dev
argocd-image-updater.argoproj.io/<alias>.allow-tags: dev
argocd-image-updater.argoproj.io/<alias>.pull-secret: secret:test/<secret>
argocd-image-updater.argoproj.io/<alias>.update-strategy: digest

혹시 이 설정중에 문제가 있을까요?

답변 2

·

답변을 작성해보세요.

0

유주님의 프로필

유주

질문자

2024.03.21

아..! 어떤 이유에선지 모르겠지만 argocd의 apiKey를 삭제했다가 재생성하여 연결했더니 에러는 있어도 다행히 연결이 되었습니다..!

에러는 rbac설정쪽이어서 금방 해결이 가능할 것 같네요. 도움주셔서 감사합니다.

고생 많으셨겠네요! 제가 다 속이 시원합니다 😀

0

안녕하세요.

말씀하신대로, ArgoCD에서 어노테이션으로 값을 세팅한 내용이, Updater 로그에 반응이 없으면

ArgoCD와의 연결이 잘못된 것 같고요.

그 설정은 위 configmap에서 아래 내용이죠.

argocd.server_addr: <argocd-server EXTERNAL-IP>

제 강의의 예제를 보시면

같은 namespace에 argocd의 Service 이름은 argo-cd-argocd-server이고

그래서 해당 설정이 아래와 같이 들어가 있습니다.

argocd.server_addr: "https://argo-cd-argocd-server"

이 부분을 잘못하는지 않았을 꺼 같은데..

 

어노테이션 설정도 잘 하셨고요.. 흠..

이건 제가 직접 이것저것 연결 테스트를 해보지 않는 이상 원인 찾기가 쉽지 않겠네요.

 

 

유주님의 프로필

유주

질문자

2024.03.14

답변 감사합니다.

아니면 혹시.. 연결 테스트를 해볼 수 있는 어떠한 조언이라도 부탁드려도 될까요 ㅜㅜ...

아니면 배포 애플리케이션이 argocd와 다른 네임스페이스여서 연결이 안된다거나 그런 문제도 있는걸까요..?

배포 애플리케이션이 다른 네임스페이스에 있는 건 전혀 상관없습니다. 제 실습 예제도 그렇게 다른 네임스페이스에서 배포 되고요.

연결 테스트는 특별한건 아니고, 내가 성공해본 케이스를 그대로 구현한 다음에 내용을 하나씩 바꿔보면서 새로 변경할 환경으로 하나씩 전향하는 거예요.

강의 내용대로 그대로 현재 환경에 배포해본다음에 성공을 시키고, 그 환경에 내 private register를 연결해본 다던지. 변경할 어노테이션을 테스트 해본다던지, 변경요소를 하나씩 바꿔가면서 어느 포인트가 문제인지 파악을 하는 거죠.

그리고 문제되는 포인트를 잡은 다음에, 해당 포인트에 대해서 열심히 구글링을 하면서 하나씩 테스트를 해보고요.

그리고 클라우드마다 방화벽에서 막히는 부분도 생각해볼 수 있겠고요.

레지스트리로 준 시클릿이 타 네임스페이스인데 rbac 정책이 있을 경우 접근이 안될 수도 있습니다. 같은 네임스페이스에서 시크릿을 만들어도 보고요.

Image updater를 디버그 모드로해서 혹시 에러가 나는 부분도 확인해 봐야겠고요.

연결고리들이 많기 때문에 저도 이런 상황에서는 시간을 들여서 이것저것 테스트를 많이 해봅니다.

유주님의 프로필

유주

질문자

2024.03.15

│ time="2024-03-14T23:47:29Z" level=info msg="argocd-image-updater v0.12.0+aee153d starting [loglevel:DEBUG, interval:2m0s, healthport:8080]"
│ time="2024-03-14T23:47:29Z" level=warning msg="commit message template at /app/config/commit.template does not exist, using default"
│ time="2024-03-14T23:47:29Z" level=debug msg="Successfully parsed commit message template"
│ time="2024-03-14T23:47:29Z" level=debug msg="rate limiting is disabled" prefix=<azure>.azurecr.io registry="https://<azure>.azurecr.io"
│ time="2024-03-14T23:47:29Z" level=info msg="Loaded 1 registry configurations from /app/config/registries.conf"
│ time="2024-03-14T23:47:29Z" level=debug msg="Creating in-cluster Kubernetes client"
│ time="2024-03-14T23:47:29Z" level=debug msg="Using ArgoCD API credentials from environment ARGOCD_TOKEN"
│ time="2024-03-14T23:47:29Z" level=info msg="ArgoCD configuration: [apiKind=argocd, server=argocd-server, auth_token=true, insecure=true, grpc_web=true, plaintext=false]"
│ time="2024-03-14T23:47:29Z" level=info msg="Starting health probe server TCP port=8080"
│ time="2024-03-14T23:47:29Z" level=info msg="Starting metrics server on TCP port=8081"
│ time="2024-03-14T23:47:29Z" level=info msg="Warming up image cache"
│ time="2024-03-14T23:47:29Z" level=info msg="Finished cache warm-up, pre-loaded 0 meta data entries from 2 registries"
│ time="2024-03-14T23:47:29Z" level=info msg="Starting image update cycle, considering 0 annotated application(s) for update"
│ time="2024-03-14T23:47:29Z" level=info msg="Processing results: applications=0 images_considered=0 images_skipped=0 images_updated=0 errors=0"

로그레벨은 말씀주신대로 debug 모드로 설정하고, image-updater 파드의 로그는 위와 같이 정상으로 출력되었습니다.

그리고 컨피그맵 설정은 아래처럼 설정했습니다. 기존에 server_addr 에서 https 를 추가하면 에러가 발생하여서 svc name 으로만 했습니다.

data:
  applications_api: argocd
  argocd.grpc_web: "true"
  argocd.insecure: "true"
  argocd.plaintext: "false"
  argocd.server_addr: argocd-server
  log.level: debug

 

우선 저는 private registry 연결이 정상이었고, 시크릿도 배포 애플리케이션의 네임스페이스와 argocd 네임스페이스에 동일하게 생성해보았고 rbac은 설정 만지진 않았습니다. (AKS 기본 정책이 들어가있을 수는 있지만 네임스페이스간 통신을 규제하는게 디폴트는 아닌 것으로 알고만 있습니다 ㅜ.ㅜ;;)

유주님의 프로필

유주

질문자

2024.03.15

argocd.server_addr: "https://argocd-server"

참고로 저는 선생님과 같이 https 를 붙여서 설정하면, 엔드포인트 에러로 보이는게 발생합니다.

그래서 https를 제외하고 svc name 으로만 연결했습니다.

Unknown desc = Post \"https://https//argocd-server/application.ApplicationService/List\": dial tcp: lookup https on 10.0.0.10:53: no such host

에러 로그도 무난한 것 보니, 연결에는 문제가 없다고 가정하고.

어노테이션 설정들을 변경해 보는 게 어떨까요?

틀린 내용은 없어 보이나, 이미지를 lastest로 해본다던지, strategy도 변경 해보면 테스트 해보는 게 좋을 것 같아요.


근데 이것도 잘못 넣게 되면 아래와 같이 ImageUpdater에서 에러 로그가 찍히긴 해야 하네요.

인식을 못하고 있긴 한 것 같은데, argocd도 이번에 새로 설치한 건가요? argocd의 configmap 중에 rbac이름이 있는 내용을 보면, 혹시 연결 제한 설정이 걸려 있는 건 아닌지?

time="2024-03-15T03:37:23Z" level=info msg="argocd-image-updater v0.12.2+1aa317c starting [loglevel:INFO, interval:2m0s, healthport:8080]"
time="2024-03-15T03:37:23Z" level=warning msg="commit message template at /app/config/commit.template does not exist, using default"
time="2024-03-15T03:37:23Z" level=info msg="Loaded 1 registry configurations from /app/config/registries.conf"
time="2024-03-15T03:37:23Z" level=info msg="ArgoCD configuration: [apiKind=kubernetes, server=https://argo-cd-argocd-server, auth_token=false, insecure=false, grpc_web=true, plaintext=false]"
time="2024-03-15T03:37:23Z" level=info msg="Starting health probe server TCP port=8080"
time="2024-03-15T03:37:23Z" level=info msg="Starting metrics server on TCP port=8081"
time="2024-03-15T03:37:23Z" level=info msg="Warming up image cache"
time="2024-03-15T03:37:24Z" level=warning msg="Invalid match option syntax 'dev', ignoring" image_alias=1pro-api-tester image_digest= image_name=1pro/api-tester image_tag=dev registry_url=
time="2024-03-15T03:37:26Z" level=info msg="Finished cache warm-up, pre-loaded 0 meta data entries from 2 registries"
time="2024-03-15T03:37:26Z" level=info msg="Starting image update cycle, considering 1 annotated application(s) for update"
time="2024-03-15T03:37:26Z" level=warning msg="Invalid match option syntax 'dev', ignoring" image_alias=1pro-api-tester image_digest= image_name=1pro/api-tester image_tag=dev registry_url=
time="2024-03-15T03:37:28Z" level=info msg="Processing results: applications=1 images_considered=1 images_skipped=0 images_updated=0 errors=0"
유주님의 프로필

유주

질문자

2024.03.21

답변주신 내용을 늦게 확인했습니다... 이미지 lastest 설정과, strategy도 변경해보아도 동일합니다.

rbac 설정은 아래와 같이 했고, argocd 계정도 생성해두었습니다. 이러면 연결 제한도 허용이 되는 것으로 아는데.. 설정이 맞을까요?

argocd-rbac-cm

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-rbac-cm
  namespace: argocd
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"ConfigMap","metadata":{"annotations":{},"labels":{"app.kubernetes.io/name":"argocd-rbac-cm","app.kubernetes.io/part-of":"argocd"},"name":"argocd-rbac-cm","namespace":"argocd"}}
  labels:
    app.kubernetes.io/name: argocd-rbac-cm
    app.kubernetes.io/part-of: argocd
data:
  policy.cvs: |
    p, role:image-updater, applications, get, */*, allow
    p, role:image-updater, applications, update, */*, allow
    g, image-updater, role:image-updater
  policy.default: role.readonly

계정

argocd account generate-token --account image-updater --id image-updater
$ argocd account list
NAME           ENABLED  CAPABILITIES
admin          true     login
image-updater  true     apiKey