Setting up ArgoCD - GitOps Continuous Deployment Tool

Featured image

image reference link



Overview

Learn about ArgoCD, a declarative GitOps continuous deployment tool for Kubernetes.


What is ArgoCD?

ArgoCD is a declarative GitOps CD tool for Kubernetes that:

🔍 Why ArgoCD?

What is GitOps?

GitOps is a term first used by Weaveworks Inc. in 2017 and is one of DevOps’ practices in projects.

It focuses on continuous deployment targeting cloud-native applications.

As the word indicates, it means that all elements related to the distribution and operation of the application are coded and managed in Git.

HTTPS

ArgoCD Components Architecture

ArgoCD Components Architecture



Installation

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

# Install Argocd Helm Chart https://argo-cd.readthedocs.io/en/latest/user-guide/helm/
# Reference: https://github.com/somaz94/helm-chart-template/tree/main/k8s-service/argocd/argo-cd
helm install argocd argo-cd --namespace argocd --create-namespace --version <version>

# Install ArgoCD CLI
curl -sL -o argocd https://github.com/argoproj/argo-cd/releases/download/v2.7.1/argocd-linux-amd64
chmod +x argocd
sudo mv argocd /usr/local/bin/


Ingress Configuration

# Reference: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ilb-argocd
  namespace: argocd
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  rules:
    - host: argocd.somaz.link
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: argocd-server
                port:
                  name: https


Initial Setup

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

# Verify installation
kubectl get po,svc,ingress,sts -n argocd

Login

HTTPS


Best Practices


1. Security: - Change default admin password
- Use SSL/TLS
- Implement RBAC

2. High Availability: - Use HA installation for production
- Configure proper backup
- Monitor resources

3. GitOps Workflow: - Use declarative configurations
- Version control everything
- Automate deployments



Reference