Install and configure ArgoCD for GitOps continuous deployment with RBAC and SSL

Intermediate 45 min Apr 01, 2026 40 views
Ubuntu 24.04 Ubuntu 22.04 Debian 12 AlmaLinux 9 Rocky Linux 9 Fedora 41

Set up ArgoCD on Kubernetes with SSL certificates, RBAC user management, and high availability for production GitOps continuous deployment workflows.

Prerequisites

  • Kubernetes cluster with admin access
  • kubectl installed and configured
  • At least 8GB RAM available
  • 3+ worker nodes for HA setup

What this solves

ArgoCD provides GitOps continuous deployment for Kubernetes applications, automatically syncing your cluster state with Git repositories. This tutorial covers production-ready ArgoCD installation with SSL/TLS encryption, role-based access control (RBAC), high availability configuration, and monitoring setup.

Prerequisites

You need a running Kubernetes cluster with kubectl access and cluster-admin permissions. If you don't have a cluster yet, follow our Kubernetes installation guide.

Note: This tutorial assumes you have at least 3 worker nodes for high availability setup and 8GB RAM available across your cluster.

Step-by-step installation

Install kubectl and verify cluster access

Ensure kubectl is installed and you can access your Kubernetes cluster with admin privileges.

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client

Verify cluster connectivity:

kubectl cluster-info
kubectl get nodes

Create ArgoCD namespace

Create a dedicated namespace for ArgoCD components to isolate them from other applications.

kubectl create namespace argocd

Install ArgoCD with high availability

Install ArgoCD using the official high availability manifest which includes multiple replicas for production use.

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/ha/install.yaml

Wait for all ArgoCD components to be ready:

kubectl wait --for=condition=available --timeout=600s deployment/argocd-applicationset-controller -n argocd
kubectl wait --for=condition=available --timeout=600s deployment/argocd-dex-server -n argocd
kubectl wait --for=condition=available --timeout=600s deployment/argocd-notifications-controller -n argocd
kubectl wait --for=condition=available --timeout=600s deployment/argocd-redis-ha-haproxy -n argocd
kubectl wait --for=condition=available --timeout=600s deployment/argocd-repo-server -n argocd
kubectl wait --for=condition=available --timeout=600s deployment/argocd-server -n argocd

Generate SSL certificates

Create SSL certificates for secure HTTPS access. We'll use a self-signed certificate for this tutorial, but use proper certificates from a CA in production.

openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
  -keyout argocd.key \
  -out argocd.crt \
  -subj "/C=US/ST=State/L=City/O=Organization/OU=IT/CN=argocd.example.com"

kubectl create secret tls argocd-server-tls \
  --cert=argocd.crt \
  --key=argocd.key \
  -n argocd

Configure ArgoCD server with SSL

Modify the ArgoCD server deployment to use SSL certificates and disable internal TLS since we're terminating SSL at the server level.

spec:
  template:
    spec:
      containers:
      - name: argocd-server
        command:
        - argocd-server
        - --staticassets
        - /shared/app
        - --repo-server
        - argocd-repo-server:8081
        - --dex-server
        - http://argocd-dex-server:5556
        - --logformat
        - text
        - --loglevel
        - info
        - --redis
        - argocd-redis-ha-haproxy:6379
        - --insecure=false
        - --rootpath
        - /
        volumeMounts:
        - name: tls-certs
          mountPath: /app/config/tls
          readOnly: true
      volumes:
      - name: tls-certs
        secret:
          secretName: argocd-server-tls
kubectl patch deployment argocd-server -n argocd --patch-file /tmp/argocd-server-patch.yaml

Create LoadBalancer service

Expose ArgoCD server through a LoadBalancer service for external access with SSL termination.

apiVersion: v1
kind: Service
metadata:
  name: argocd-server-loadbalancer
  namespace: argocd
  labels:
    app.kubernetes.io/component: server
    app.kubernetes.io/name: argocd-server
    app.kubernetes.io/part-of: argocd
spec:
  type: LoadBalancer
  ports:
  - name: https
    port: 443
    protocol: TCP
    targetPort: 8080
  - name: grpc
    port: 443
    protocol: TCP
    targetPort: 8080
  selector:
    app.kubernetes.io/name: argocd-server
kubectl apply -f /tmp/argocd-server-service.yaml

Retrieve initial admin password

Get the auto-generated admin password for initial login. This password is stored in a Kubernetes secret.

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo

Store this password securely as you'll need it for the initial login.

Install ArgoCD CLI

Install the ArgoCD command-line interface for managing applications and configurations.

curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 755 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64
curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 755 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64

Configure RBAC policies

Create RBAC configuration to define user roles and permissions. This ConfigMap defines who can access what in ArgoCD.

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-rbac-cm
  namespace: argocd
  labels:
    app.kubernetes.io/name: argocd-rbac-cm
    app.kubernetes.io/part-of: argocd
data:
  policy.default: role:readonly
  policy.csv: |
    # Admin role - full access
    p, role:admin, applications, , /*, allow
    p, role:admin, clusters, , , allow
    p, role:admin, repositories, , , allow
    p, role:admin, certificates, , , allow
    p, role:admin, accounts, , , allow
    p, role:admin, gpgkeys, , , allow
    
    # Developer role - can manage applications
    p, role:developer, applications, get, /, allow
    p, role:developer, applications, create, /, allow
    p, role:developer, applications, update, /, allow
    p, role:developer, applications, delete, /, allow
    p, role:developer, applications, sync, /, allow
    p, role:developer, repositories, get, *, allow
    p, role:developer, clusters, get, *, allow
    
    # Viewer role - read-only access
    p, role:viewer, applications, get, /, allow
    p, role:viewer, repositories, get, *, allow
    p, role:viewer, clusters, get, *, allow
    
    # Assign roles to users
    g, developers, role:developer
    g, viewers, role:viewer
  scopes: '[groups]'
kubectl apply -f /tmp/argocd-rbac-cm.yaml

Create additional user accounts

Create local user accounts with different permission levels for team access management.

# Get the LoadBalancer IP
ARGOCD_SERVER=$(kubectl get svc argocd-server-loadbalancer -n argocd -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

Login as admin

ADMIN_PASSWORD=$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d) argocd login $ARGOCD_SERVER --username admin --password $ADMIN_PASSWORD --insecure

Create developer user

argocd account create developer --name "Developer User" argocd account create viewer --name "Viewer User"

Set passwords for new accounts

argocd account update-password --account developer --new-password "DevSecure123!" argocd account update-password --account viewer --new-password "ViewSecure123!"

Configure Git repository integration

Add a Git repository to ArgoCD for application deployments. This example uses a public repository, but you can configure private repositories with SSH keys or tokens.

# Add a sample Git repository
argocd repo add https://github.com/argoproj/argocd-example-apps.git

List repositories to verify

argocd repo list

For private repositories, use SSH key authentication:

# Generate SSH key for Git access
ssh-keygen -t rsa -b 4096 -f ~/.ssh/argocd_rsa -N ""

Add repository with SSH key

argocd repo add git@github.com:your-org/your-private-repo.git \ --ssh-private-key-path ~/.ssh/argocd_rsa

Deploy sample application

Create and deploy a sample application to verify ArgoCD functionality and GitOps synchronization.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  source:
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
    path: guestbook
  destination:
    server: https://kubernetes.default.svc
    namespace: default
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
    - CreateNamespace=true
kubectl apply -f /tmp/sample-app.yaml

Configure monitoring and health checks

Set up resource monitoring and health checks to ensure ArgoCD components are functioning properly.

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cmd-params-cm
  namespace: argocd
  labels:
    app.kubernetes.io/name: argocd-cmd-params-cm
    app.kubernetes.io/part-of: argocd
data:
  # Enable metrics
  server.enable.proxy.extension: "true"
  server.metrics: "true"
  repo.server.metrics: "true"
  controller.metrics: "true"
  
  # Resource limits and requests
  controller.resource.customizations: |
    networking.k8s.io/Ingress:
      health.lua: |
        hs = {}
        hs.status = "Healthy"
        return hs
kubectl apply -f /tmp/argocd-monitoring.yaml

Set up backup configuration

Configure automated backups of ArgoCD configuration and application definitions for disaster recovery.

#!/bin/bash
BACKUP_DIR="/var/backups/argocd"
DATE=$(date +%Y%m%d_%H%M%S)

Create backup directory

mkdir -p $BACKUP_DIR

Backup ArgoCD applications

kubectl get applications -n argocd -o yaml > $BACKUP_DIR/applications_$DATE.yaml

Backup ArgoCD projects

kubectl get appprojects -n argocd -o yaml > $BACKUP_DIR/projects_$DATE.yaml

Backup ArgoCD repositories

kubectl get secrets -n argocd -l argocd.argoproj.io/secret-type=repository -o yaml > $BACKUP_DIR/repositories_$DATE.yaml

Backup RBAC configuration

kubectl get configmap argocd-rbac-cm -n argocd -o yaml > $BACKUP_DIR/rbac_$DATE.yaml

Keep only last 30 days of backups

find $BACKUP_DIR -name "*.yaml" -mtime +30 -delete echo "ArgoCD backup completed: $DATE"
sudo mkdir -p /var/backups/argocd
sudo cp /tmp/backup-script.sh /usr/local/bin/argocd-backup.sh
sudo chmod 755 /usr/local/bin/argocd-backup.sh

Create daily cron job for backups

echo "0 2 * /usr/local/bin/argocd-backup.sh" | sudo crontab -

Verify your setup

Check that all ArgoCD components are running correctly and the service is accessible.

# Check pod status
kubectl get pods -n argocd

Check service status

kubectl get svc -n argocd

Verify LoadBalancer external IP

kubectl get svc argocd-server-loadbalancer -n argocd

Test ArgoCD CLI connectivity

argocd version

List applications

argocd app list

Check application sync status

argocd app get guestbook

Access the ArgoCD web interface at https://YOUR_LOADBALANCER_IP and login with admin credentials. You should see the guestbook application deployed and synchronized.

Note: If using a self-signed certificate, your browser will show a security warning. Click "Advanced" and "Proceed" to continue, or configure proper SSL certificates from a trusted CA for production use.

Common issues

SymptomCauseFix
Pods stuck in Pending stateInsufficient cluster resourceskubectl describe pod POD_NAME -n argocd to check resource requirements
SSL certificate errorsInvalid certificate configurationRecreate certificate with correct Common Name matching your domain
Login fails with admin passwordPassword retrieval issuekubectl -n argocd delete secret argocd-initial-admin-secret to regenerate
Applications not syncingGit repository access issuesCheck repository credentials with argocd repo list
RBAC permission deniedIncorrect role assignmentsReview ConfigMap argocd-rbac-cm and restart argocd-server pods
LoadBalancer IP pendingNo LoadBalancer controllerInstall MetalLB or use NodePort service type instead

Next steps

Automated install script

Run this to automate the entire setup

#argocd #gitops #kubernetes-cicd #argocd-ssl #gitops-deployment

Need help?

Don't want to manage this yourself?

We handle infrastructure for businesses that depend on uptime. From initial setup to ongoing operations.

Talk to an engineer