Certainly! Here’s a step-by-step guide to set up ArgoCD to deploy multiple microservices (e.g., nginx, postgres) using a single umbrella Helm chart, with each microservice in its own namespace, following best practices.
1. Project Structure
umbrella-chart/
├── Chart.yaml
├── values.yaml
├── charts/
│ ├── nginx/
│ │ └── ... (nginx Helm chart)
│ └── postgres/
│ └── ... (postgres Helm chart)
├── templates/
│ └── namespaces.yaml
2. Create Namespaces via Helm
templates/namespaces.yaml
{{- range $svc, $ns := .Values.namespaces }}
apiVersion: v1
kind: Namespace
metadata:
name: {{ $ns }}
---
{{- end }}
3. Umbrella Chart.yaml
Chart.yaml
apiVersion: v2
name: umbrella-chart
description: Umbrella chart for multiple microservices
version: 0.1.0
dependencies:
- name: nginx
version: "x.x.x"
repository: "https://charts.bitnami.com/bitnami"
- name: postgresql
alias: postgres
version: "x.x.x"
repository: "https://charts.bitnami.com/bitnami"
4. Umbrella values.yaml
values.yaml
namespaces:
nginx: nginx-ns
postgres: postgres-ns
nginx:
fullnameOverride: nginx
# Add nginx-specific values here
namespaceOverride: nginx-ns
postgres:
fullnameOverride: postgres
# Add postgres-specific values here
namespaceOverride: postgres-ns
5. Override Subchart Namespaces
Most Helm charts do not natively support deploying into a different namespace than the release.
Best practice: Use Helm hooks or Helm post-renderers for advanced use, or patch the subcharts to support a namespaceOverride value.
Example patch for subcharts (if you control them):
# In nginx/templates/deployment.yaml
metadata:
name: {{ include "nginx.fullname" . }}
namespace: {{ .Values.namespaceOverride | default .Release.Namespace }}
Do the same for all resources in the subcharts.
6. ArgoCD Application YAML
app.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: umbrella-app
namespace: argocd
spec:
project: default
source:
repoURL: 'https://your-git-repo/umbrella-chart.git'
targetRevision: HEAD
path: .
helm:
valueFiles:
- values.yaml
destination:
server: 'https://kubernetes.default.svc'
namespace: default # Helm will create/target sub-namespaces
syncPolicy:
automated:
prune: true
selfHeal: true
7. Deploy via ArgoCD GUI
- Push your umbrella chart to a Git repo.
- In ArgoCD GUI, create a new Application using the above
app.yaml or fill in the fields.
- Sync the application.
8. Best Practices
- Namespace isolation: Each microservice gets its own namespace.
- Single source of truth: All config in Git.
- Helm umbrella chart: Manages dependencies and values.
- ArgoCD single deployment: One Application to rule them all.
- Parameterize namespaces: Use
namespaceOverride in subcharts.
- RBAC: Set up RBAC per namespace as needed.
9. Summary
- Umbrella chart manages all microservices.
- Each microservice is a Helm subchart, deployed into its own namespace.
- Namespaces are created by the umbrella chart.
- ArgoCD deploys everything in one go.
Let me know if you need a sample repo or more details on any step!