IaC/CI CD Tool

ArgoCD SSO 구성 가이드(Gitlab)

Somaz 2025. 3. 31. 12:04
728x90
반응형

Overview

지난 포스팅에서는 GCP OAuth를 기반으로 ArgoCD의 SSO(Single Sign-On)를 구성해보았다면,
이번 글에서는 GitLab OAuth를 통해 ArgoCD SSO를 구성하는 방법을 정리해본다.

 

ArgoCD는 Dex라는 인증 프록시를 통해 다양한 OAuth2 제공자(Google, GitHub, GitLab 등)와 연동이 가능하다.
기업이나 개인이 GitLab을 자체 호스팅하거나 GitLab.com을 사용하는 경우,
GitLab 계정을 기반으로 ArgoCD에 로그인/인증/권한 제어까지 통합 관리할 수 있어 SSO 설정은 매우 유용하다.

 

 

이번 실습에서는 다음을 다룬다.

  • GitLab OAuth 애플리케이션 생성
  • GitLab에서 SSO를 위한 OAuth 설정
  • ArgoCD의 dex.config, RBAC, secrets 구성 방법
  • Helm을 이용한 ArgoCD 재배포 및 Dex 서버 재시작
  • 실제 로그인 시 OAuth 인증 흐름 확인

 

Google OAuth 설정과 비교해 GitLab은 그룹 기반 권한 제어(RBAC)가 조금 더 직관적이므로
GitLab CI/CD와 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이란? (작성 방법)

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

2025.03.04 - [IaC/CI CD Tool] - ArgoCD Slack Notification 설정 방법

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

 

 

 

 


 

 

 

1. Gitlab App 생성

  • GitLab에서 Applications 메뉴로 이동 (Admin Area > Applications)
  • 새 애플리케이션 생성:
  • Name: Argo CD
  • Redirect URI: https://<argocd urI>/api/dex/callback
  • Scopes 선택:
    • read_user
    • openid
    • profile
    • email

 

  • Concentration
    Appliaction ID와 Secret 값이 중요하다.
    • Application ID (Client ID)
    • Secret (Client Secret)

 

 

2. GitLab 설치

 

 

 

3. GitLab SSO 설정

 

`values/mgmt.yaml`

global:
  # -- Default domain used by all components
  ## Used for ingresses, certificates, SSO, notifications, etc.
  domain: argocd.somaz.link

configs:
  cm:
    timeout.reconciliation: 60s
    # Add account settings
    dex.config: |
      connectors:
        - type: gitlab
          id: gitlab
          name: GitLab
          config:
            baseURL: <gitlab url> # e.g http://gitlab.somaz.link 
            clientID: <application id>
            clientSecret: <secret>
            redirectURI: https://<argocd url>/api/dex/callback
            groups:
              - server
  params:
    create: true
    server.insecure: true
  # SSH known hosts for Git repositories
  ## Ref: https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#ssh-known-host-public-keys
  ssh:
    # -- Additional known hosts for private repositories
    extraHosts: |
      gitlab.concrit.us ssh-rsa AAAAB3N...
      gitlab.concrit.us ecdsa-sha2-nistp256...
      gitlab.concrit.us ssh-ed25519 AAAA..
  # Add RBAC settings
  rbac:
    create: true
    policy.csv: |
      p, role:org-admin, applications, *, */*, allow
      p, role:org-admin, clusters, get, *, allow
      p, role:org-admin, repositories, *, *, allow
      p, role:org-admin, projects, get, *, allow
      p, role:org-admin, logs, get, *, allow
      p, role:org-admin, exec, create, */*, allow
      
      # GitLab 그룹 멤버에게 admin 권한 부여
      g, <group>, role:org-admin # gitlab group
  
  secrets:
    # GitLab SSO Configuration
    dex.gitlab.clientId: "<application id>"
    dex.gitlab.clientSecret: "<secret>"
  • SSO 설정 시 중요한 값들
    • dex.config : 인증 설정
    • rbac : 권한 설정

 

 

Helm Upgrade 후에 Dex Server가 재시작 되지 않았다면 한번더 restart 해준다.

# helm upgrade
helm upgrade argocd . -n argocd -f ./values/mgmt.yaml

# Dex sever Restart
k rollout restart -n argocd deployment argocd-dex-server

 

 

처음 로그인 시에는 동의페이지가 뜬다.

 

 

Login 후 User Info를 확인해보면 아래와 같이 나올 것이다. 

 

 

마무리

🔔 GitLab ArgoCD SSO 설정 요약
  • GitLab Application에서 clientId(=Application ID)clientSecret(=Secret)을 발급받아야 한다.
  • ArgoCD values.yaml에 Dex connector와 RBAC 설정이 필요하다.
  • groups와 role 매핑을 통해 권한을 관리할 수 있다.

 

 


Reference

  1. ArgoCD Dex GitLab Connector 공식 가이드
    https://dexidp.io/docs/connectors/gitlab/
  2. ArgoCD SSO 구성 공식 문서 (Dex 기반)
    https://argo-cd.readthedocs.io/en/stable/operator-manual/user-management/sso/
  3. GitLab OAuth2 Applications 공식 가이드
    https://docs.gitlab.com/ee/integration/oauth_provider.html
  4. ArgoCD RBAC 정책 가이드
    https://argo-cd.readthedocs.io/en/stable/operator-manual/rbac/
728x90
반응형