Skip to content
My Image

Deploying Argo CD on a Self-Hosted Kubernetes Cluster

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. It allows you to manage Kubernetes resources directly from Git repositories. This guide will walk you through deploying Argo CD on a self-hosted Kubernetes cluster.


1. Prerequisites

Before you begin, ensure you have:

  • A self-hosted Kubernetes cluster (can be kubeadm, k3s, microk8s, or kind).
  • kubectl installed and configured to access your cluster.
  • Helm installed (optional if using Helm for Argo CD installation).
  • Internet access to pull Argo CD images.

2. Create a Namespace for Argo CD

Argo CD should run in its dedicated namespace:

bash
kubectl create namespace argocd

3. Install Argo CD

Option 1: Using kubectl

Apply the official Argo CD manifests:

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

This will deploy:

  • argocd-server
  • argocd-repo-server
  • argocd-application-controller
  • argocd-dex-server

Option 2: Using Helm

bash
helm repo add argo https://argoproj.github.io/argo-helm
helm repo update

helm install argocd argo/argo-cd -n argocd --create-namespace

Helm allows easier upgrades and configuration customization.


4. Expose the Argo CD API Server

By default, Argo CD API server is internal. To access it, you can use Port Forwarding for testing or a LoadBalancer/Ingress for production.

Port Forwarding

bash
kubectl port-forward svc/argocd-server -n argocd 8080:443

Open your browser and access: https://localhost:8080

Ingress Example (Nginx)

yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: argocd-ingress
  namespace: argocd
  annotations:
 nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
  rules:
 - host: argocd.yourdomain.com
   http:
 paths:
   - path: /
 pathType: Prefix
 backend:
   service:
 name: argocd-server
 port:
   number: 443
  tls:
 - hosts:
 - argocd.yourdomain.com
   secretName: argocd-tls

5. Access Argo CD UI

Retrieve the initial admin password:

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

Login to the Argo CD UI:

  • Username: admin
  • Password: <retrieved-password>

6. Deploy Your First Application

  1. Create a Git repository containing Kubernetes manifests or Helm charts.

  2. In Argo CD UI, click New App:

    • Application Name: e.g., my-app
    • Project: default
    • Repository URL: your Git repo
    • Path: path to manifests
    • Cluster: https://kubernetes.default.svc
    • Namespace: namespace to deploy
  3. Click Create and then Sync to deploy.


7. Optional Configurations

  • Enable SSO / OAuth using Dex or GitHub.
  • Automatic Sync to keep your cluster in sync with Git.
  • RBAC Policies for user access management.

8. Verify Deployment

Check the status of your Argo CD pods:

bash
kubectl get pods -n argocd

Ensure all pods are in Running or Completed state.

Check your deployed application:

bash
kubectl get all -n <application-namespace>

9. Customize Argo CD Configuration and Ingress (Fix Redirects and Domain)

After initial setup, you might need to fix redirect URLs or update your Argo domain (for example, argocd.cloudmateria.com instead of argocd.example.com).

Step 1 — Update Argo CD Base URL

Edit the main Argo CD configuration map:

bash
 kubectl -n argocd edit configmap argocd-cm

Add or update the following under data::

yml
 data: url: https://argocd.example.com  # update this if you create custom domain

Then restart the Argo CD server pods to apply changes:

bash
 kubectl rollout restart deployment argocd-server -n argocd

This ensures the correct redirect domain appears when logging out or using OAuth.


Step 2 — Update the Ingress Configuration

If your Argo CD UI is still pointing to the wrong hostname or you want to change how it’s exposed:

bash
 kubectl -n argocd edit ingress argocd-server

Adjust the host and annotations as needed. For example:

yml
spec:
  ingressClassName: traefik
  rules:
    - host: argocd.example.com # update this if you create custom domain
      http:
        paths:
          - backend:
              service:
                name: argocd-server
                port:
                  number: 80
            path: /
            pathType: Prefix

Then apply:

bash
 kubectl rollout restart deployment argocd-server -n argocd

Verify the change:

bash
 kubectl get ingress -n argocd

Now visiting https://argocd.cloudmateria.com should work properly and redirect correctly after logout.

10. Summary

You now have Argo CD running on your self-hosted Kubernetes cluster, fully customized with your own domain.
Argo CD enables:

  • Declarative management of Kubernetes resources.
  • GitOps-driven continuous delivery.
  • Rollback and sync capabilities for rapid recovery.
  • Configuration through simple Git commits rather than manual commands.

This setup provides a centralized and automated way to manage your deployments across multiple clusters — your Git repository becomes the single source of truth for the desired state of your applications.