Remote & on-site IT support across Australia & New Zealand · 24/7 emergency line

Install Argo-CD on Ubuntu

Install with kubectl
# Create the argocd namespace

kubectl create namespace argocd

# Apply the installation manifests
kubectl apply --server-side --force-conflicts -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

Wait for all pods to become ready

# Check pod status
kubectl get pods -n argocd -w

# Wait for readiness (timeout after 5 minutes)
kubectl wait --for=condition=Ready pods --all -n argocd --timeout=300s
Configure SSL
# Create ./argocd_server_ssl.yaml
spec:
  template:
    spec:
      containers:
      - name: argocd-server
        args:
        - /usr/local/bin/argocd-server
        - --staticassets
        - /shared/app
        - --insecure

# Apply patch
kubectl patch deployment -n argocd argocd-server --patch-file ./argocd_server_ssl.yaml
Accessing the ArgoCD UI

kubectl port-forward svc/argocd-server -n argocd --address 0.0.0.0 8080:443
LoadBalancer Service
# Patch the service to use LoadBalancer
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

# Get the external IP and port number
kubectl get svc argocd-server -n argocd
Ingress

Create an Ingress resource for external access:

# argocd-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: argocd-server-ingress
  namespace: argocd
  annotations:
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  ingressClassName: nginx
  rules:
    - host: argocd.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: argocd-server
                port:
                  number: 443
  tls:
    - hosts:
        - argocd.example.com
      secretName: argocd-tls
# Apply patch
kubectl apply -f argocd-ingress.yaml
Getting the Admin Password
# Get the password
kubectl -n argocd get secret argocd-initial-admin-secret 
  -o jsonpath="{.data.password}" | base64 -d

# Login with username: admin and the password from above

Change the password after first login:

# Using the CLI
argocd login localhost:8080 --insecure
argocd account update-password
Installing the ArgoCD CLI

The CLI is useful for automation and scripting.

# Linux
VERSION=$(curl -L -s https://raw.githubusercontent.com/argoproj/argo-cd/stable/VERSION)
curl -sSL -o argocd https://github.com/argoproj/argo-cd/releases/download/v${VERSION}/argocd-linux-amd64
chmod +x argocd
sudo mv argocd /usr/local/bin/

# Check argocd
argocd version --client

# List registered clusters
argocd cluster list
Connect Git to ArgoCD
Create Project Access Tokens in Gitlab

Project > Settings > Access Tokens > Add New Token > Role: Reporter | Scopes: read_repository

Add hostAlias for GitLab DNS
# Edit the deployment
kubectl edit deployment argocd-repo-server -n argocd

# Add hostAlias under spec.template.spec
spec:
  template:
    spec:
      hostAliases:
      - ip: "192.168.x.x"
        hostnames:
        - "gitlab.example.com"

# Verify connectivity
kubectl exec -it deployment/argocd-repo-server -n argocd -- nslookup gitlab.example.com
Add the GitLab Repository
argocd repo add https://gitlab.example.com/<group>/<repository>.git 
--username <GITLAB_USERNAME> 
--password <GITLAB_TOKEN>

# Verify repository added
argocd repo list
Apply root app (once)

# if not already applied
kubectl apply -f argocd/bootstrap/root-app-dev.yaml
kubectl apply -f argocd/bootstrap/root-app-prod.yaml
References

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top