Integrating GitLab Single Sign-On (SSO) with ArgoCD

In this article we will learn How to Integrate GitLab Single Sign-On (SSO) with ArgoCD. Single Sign-On (SSO) simplifies authentication by allowing users to access multiple platforms with a single set of credentials. Integrating GitLab SSO with Argo CD not only streamlines the login process but also enhances security and user management for your DevOps workflows. By using GitLab as the identity provider, you can ensure centralized access control and seamless authentication for your Argo CD users.

Prerequisites

  • AWS Account with Ubuntu 24.04 LTS EC2 Instance.
  • Minikube and kubectl Installed.
  • Basic knowledge of Kubernetes and GitLab.

Step #1:Set Up DNS for the Custom Domain

We already have a domain in GoDaddy so first got to GoDaddy.

Go to your account, here “DevOps” and select My Products.

Configuring GitHub Single Sign-On (SSO) with ArgoCD 1

You can see our domain devopshint.xyz below, go to DNS to add the records in it.

Configuring GitHub Single Sign-On (SSO) with ArgoCD 2

In your domain provider’s dashboard, create a DNS A record. Click on Add New Record.

Configuring GitHub Single Sign-On (SSO) with ArgoCD 3
  • Type: A
  • Name: @
  • Value: Your EC2 instance’s public IP address. You must have Elastic IP associated with your EC2 instance.
  • TTL: 1 Hour

Save it.

Configuring GitHub Single Sign-On (SSO) with ArgoCD 4

You can see our DNS record is added successfully.

Configuring GitHub Single Sign-On (SSO) with ArgoCD 5

Install NGINX & Certbot:

SSH into your EC2 instance and run:

sudo apt update
sudo apt install nginx certbot python3-certbot-nginx -y

Configure NGINX Reverse Proxy:

Create a new config file:

sudo nano /etc/nginx/sites-available/argocd

Paste this content:

server {
listen 80;
server_name <name of your server>;

location / {
proxy_pass https://localhost:8080;
proxy_ssl_verify off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Integrating GitLab Single Sign-On (SSO) with ArgoCD 1

Enable the config:

sudo ln -s /etc/nginx/sites-available/argocd /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Issue SSL Certificate with Certbot:

Now, run:

sudo certbot --nginx -d <your server name>

Follow the prompts:

  • Enter email
  • Accept TOS
  • Certbot will update your NGINX config to support HTTPS
Integrating GitLab Single Sign-On (SSO) with ArgoCD 2

Step #2:Configure GitLab as an Identity Provider

First Log in into the GitLab. On the left sidebar, click on your icon/avatar and select Edit profile.

Integrating GitLab Single Sign-On (SSO) with ArgoCD 3

On the left sidebar, from the User settings select Applications.

Integrating GitLab Single Sign-On (SSO) with ArgoCD 4

Select the Add new application and fill the required fields.

Integrating GitLab Single Sign-On (SSO) with ArgoCD 5

Enter a Name like ArgoCD and Redirect URI enter the callback URL for Argo CD. Here we have used https://<your-domain-name>/api/dex/callback. Tick off the Confidential checkbox.

Integrating GitLab Single Sign-On (SSO) with ArgoCD 6

Select the following scopes. Click on Save Application.

Integrating GitLab Single Sign-On (SSO) with ArgoCD 7

Note down the Application ID (client ID) and Secret (client secret).

Integrating GitLab Single Sign-On (SSO) with ArgoCD 8

Step #3:Configure ArgoCD for SSO

Create a new namespace called argocd in your Kubernetes cluster.

kubectl create namespace argocd
Integrating GitLab Single Sign-On (SSO) with ArgoCD 9

Install ArgoCD in the argocd namespace by applying the YAML file from the provided URL.

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Integrating GitLab Single Sign-On (SSO) with ArgoCD 10

List all the resources in the argocd namespace. It provides an overview of the ArgoCD setup includes Pods, Services, Deployments, ReplicaSets, and more.

kubectl -n argocd get all
Integrating GitLab Single Sign-On (SSO) with ArgoCD 11

Edit the service configuration of argocd-server.

kubectl -n argocd edit service argocd-server
Integrating GitLab Single Sign-On (SSO) with ArgoCD 12

modify it shown below. Change the type field from ClusterIP to NodePort. ClusterIP exposes the service only within the cluster. NodePort makes the service accessible externally via a specific port on the nodes.

type: NodePort
Integrating GitLab Single Sign-On (SSO) with ArgoCD 13

Run the kubectl -n argocd get all again to see if service type changed or not.

kubectl -n argocd get all
Integrating GitLab Single Sign-On (SSO) with ArgoCD 14

Update the Argo CD ConfigMap.

kubectl -n argocd edit configmap argocd-cm
Integrating GitLab Single Sign-On (SSO) with ArgoCD 15

Modify it as shown below.

Modify clientID, clientSecret, redirectURL and url

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
  dex.config: |
    connectors:
    - type: gitlab
      id: gitlab
      name: GitLab
      config:
        baseURL: https://gitlab.com
        clientID: 6430de944e21cabd8b2c1e8513e2903e0d087e98b911fb59d7ff497b76b0b693
        clientSecret: gloas-ebf1376437824ccdf9e97fda5679d206e15869eef2af6f9e92b4bea4e2d6a7d8
        redirectURI: https://gitlab.devopshint.xyz/api/dex/callback
        users.anonymous.enabled: "false"
  url: https://gitlab.devopshint.xyz
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"ConfigMap","metadata":{"annotations":{},"labels":{"app.kubernetes.io/name":"argocd-cm","app.kubernetes.io/part-of":"argocd"},"name":"argocd-cm","namespace":"argocd"}}
  creationTimestamp: "2025-03-27T09:47:29Z"
  labels:
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd
  name: argocd-cm
  namespace: argocd
  resourceVersion: "2059"
  uid: bcb21753-8e99-417b-a9e2-711967c6846a
Integrating GitLab Single Sign-On (SSO) with ArgoCD 16

Restart the Argo CD server to apply the changes

kubectl -n argocd rollout restart deployment argocd-server
Integrating GitLab Single Sign-On (SSO) with ArgoCD 17

Run the kubectl port-forward command.

kubectl port-forward svc/argocd-server -n argocd 8080:443
Integrating GitLab Single Sign-On (SSO) with ArgoCD 18

Now open your web browser and run https://<your-domain-name> to go to the home page of ArgoCD.

You’ll see the “LOG IN VIA GITLAB” button on the login page.

Integrating GitLab Single Sign-On (SSO) with ArgoCD 19

Now click the LOG IN VIA GITLAB button. It will request access to your GitLab account. Click on Authorize ArgoCD.

Integrating GitLab Single Sign-On (SSO) with ArgoCD 20

After this you’ll be redirected to the Argo CD dashboard.

Integrating GitLab Single Sign-On (SSO) with ArgoCD 21

You can view the SSL Certificate by clicking on lock icon beside the https and then connection is secure and then certificate icon:

Integrating GitLab Single Sign-On (SSO) with ArgoCD 22

Conclusion:

Integrating GitLab SSO with Argo CD simplifies user authentication, improves security, and centralizes access management for your DevOps pipeline. With a streamlined login experience, teams can focus on deploying and managing applications rather than juggling credentials. By following this guide, you’ve ensured that your Argo CD setup is aligned with modern security practices while enhancing productivity for your team.

Related Articles:

Configure Single Sign-On (SSO) for ArgoCD using OKTA

Reference:

GitLab Docs Page

Harish Reddy

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap