skip to content
Astro Cactus

Multi-Cluster Management with ArgoCD

/ 2 min read

Series Navigation

Multi-Cluster Management with ArgoCD

In this third part of our ArgoCD series, we’ll explore how to effectively manage multiple Kubernetes clusters using ArgoCD.

Cluster Registration

Adding Clusters

Terminal window
# Get cluster credentials
kubectl config get-context
# Add cluster to ArgoCD
argocd cluster add my-cluster-context

Via YAML

apiVersion: v1
kind: Secret
metadata:
name: mycluster-secret
namespace: argocd
labels:
argocd.argoproj.io/secret-type: cluster
type: Opaque
stringData:
name: mycluster
server: https://kubernetes.default.svc
config: |
{
"bearerToken": "<token>",
"tlsClientConfig": {
"insecure": false,
"caData": "<ca-data>"
}
}

Multi-Cluster Strategies

Hub and Spoke Model

  • Central ArgoCD instance (Hub)
  • Multiple target clusters (Spokes)
  • Unified management interface

Federation Model

  • Multiple ArgoCD instances
  • Cluster-specific configurations
  • Delegated administration

Secrets Management

Using External Secrets

apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: my-secret
spec:
refreshInterval: 1h
secretStoreRef:
name: vault-backend
kind: ClusterSecretStore
target:
name: my-secret
data:
- secretKey: password
remoteRef:
key: secret/data/myapp
property: password

Sealed Secrets

apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
name: mysecret
spec:
encryptedData:
password: AgBy8hCi...

Advanced Deployment Strategies

Progressive Delivery

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp
spec:
source:
plugin:
name: progressive-delivery
repoURL: https://github.com/org/myapp.git
destination:
server: https://kubernetes.default.svc

Cluster Groups

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: myapp-set
spec:
generators:
- clusters:
selector:
matchLabels:
environment: production
template:
spec:
source:
repoURL: https://github.com/org/myapp.git
destination:
server: '{{server}}'

Configuration Management

Using Kustomize

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp
spec:
source:
path: overlays/production
kustomize:
images:
- myapp=myregistry/myapp:1.0.0

Using Helm

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp
spec:
source:
chart: myapp
helm:
values: |
image:
tag: 1.0.0
replicas: 3

Monitoring and Observability

Prometheus Integration

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: argocd-metrics
spec:
selector:
matchLabels:
app.kubernetes.io/name: argocd-metrics
endpoints:
- port: metrics

Grafana Dashboards

  • Application sync status
  • Resource health
  • Cluster metrics
  • Error rates

Best Practices

  1. Cluster Organization

    • Label clusters by environment/purpose
    • Use consistent naming conventions
    • Document cluster access patterns
  2. Security

    • Implement cluster RBAC
    • Use network policies
    • Rotate cluster credentials
  3. Resource Management

    • Set cluster resource quotas
    • Monitor cluster capacity
    • Implement cost allocation

Troubleshooting

Common Issues

  1. Cluster connectivity
  2. Authentication failures
  3. Resource conflicts
  4. Network policies

Debug Commands

Terminal window
# Check cluster status
argocd cluster list
# Verify connectivity
argocd admin cluster-info
# Check logs
kubectl logs -n argocd -l app.kubernetes.io/name=argocd-server

Conclusion

Multi-cluster management with ArgoCD requires:

  • Proper cluster registration and authentication
  • Effective secrets management
  • Advanced deployment strategies
  • Robust monitoring and observability

In the next part, we’ll cover:

  • Custom resource definitions
  • Webhook integrations
  • Advanced automation patterns
  • Disaster recovery strategies