32 ‐ ArgoCD Authentication With Github - CloudScope/DevOpsWithCloudScope GitHub Wiki
Overview
ArgoCD supports Single Sign-On (SSO) authentication via OAuth providers, including GitHub. This allows users to log in using their GitHub accounts and leverage GitHub organizations/teams for role-based access control (RBAC) in ArgoCD.
Prerequisites
- A running ArgoCD instance.
- Admin access to the GitHub organization.
- Admin access to the ArgoCD instance.
argocd
CLI installed (optional but recommended).
Step 1: Create an OAuth App in GitHub
- Go to GitHub Developer Settings: [GitHub OAuth Apps](https://github.com/settings/developers)
- Click New OAuth App.
- Fill in the required details:
- Application Name:
ArgoCD SSO
- Homepage URL:
https://argocd.example.com
- Authorization Callback URL:
https://argocd.example.com/auth/callback
- Application Name:
- Click Register Application.
- Copy the Client ID and Client Secret.
Step 2: Configure ArgoCD to Use GitHub OAuth
- Edit the
argocd-cm
ConfigMap:kubectl -n argocd edit configmap argocd-cm
- Add the following OAuth configuration:
apiVersion: v1 kind: ConfigMap metadata: name: argocd-cm data: url: https://argocd.example.com oidc.config: | name: GitHub issuer: https://github.com/login/oauth clientID: <your-client-id> clientSecret: <your-client-secret> redirectURI: https://argocd.example.com/auth/callback requestedScopes: ["user:email", "read:org"]
- Save and exit the editor.
- Restart the ArgoCD server:
kubectl -n argocd rollout restart deployment argocd-server
Step 3: Configure RBAC in ArgoCD
- Edit the
argocd-rbac-cm
ConfigMap:kubectl -n argocd edit configmap argocd-rbac-cm
- Define roles based on GitHub organizations or teams:
apiVersion: v1 kind: ConfigMap metadata: name: argocd-rbac-cm data: policy.default: "role:readonly" policy.csv: | p, role:admin, applications, *, */*, allow g, github:my-org:admins, role:admin g, github:my-org:devs, role:readonly
- Replace
my-org
with your GitHub organization name. - Adjust roles (
admin
,readonly
, etc.) as needed.
- Replace
- Save and exit the editor.
- Restart the ArgoCD server again:
kubectl -n argocd rollout restart deployment argocd-server
Step 4: Verify Authentication
- Go to your ArgoCD UI (
https://argocd.example.com
). - Click Log in via GitHub.
- Authorize the application when prompted.
- You should now be logged in based on your GitHub organization/team permissions.
Troubleshooting
- Invalid Client ID/Secret: Ensure the correct values are configured in
argocd-cm
. - User unauthorized: Check
argocd-rbac-cm
for correct role mappings. - Callback URL mismatch: Ensure GitHub OAuth settings match the
redirectURI
.
Conclusion
Configuring GitHub authentication with ArgoCD enhances security and simplifies user management by leveraging GitHub teams and organizations. This setup allows for seamless integration of authentication and RBAC, improving access control for your deployments.