This guide walks through adding a new application to the Kubernetes cluster using the ArgoCD app-of-apps pattern.
k8s-cluster-config and terraform-k8s-infra reposkubectl access to the clustermkdir -p k8s-cluster-config/core-components/<app-name>/resources
application.yamlCreate the ArgoCD Application resource:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: <app-name>
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "<wave-number>"
finalizers:
- argocd.argoproj.io/resources-finalizer
spec:
project: default
destination:
server: https://kubernetes.default.svc
namespace: <app-namespace>
sources:
# Helm chart from upstream repo
- repoURL: https://charts.example.com
chart: <chart-name>
targetRevision: "<chart-version>"
helm:
valueFiles:
- $values/core-components/<app-name>/values.yaml
# Git repo for values file
- repoURL: '[email protected]:AnhTran1610/k8s-cluster-config.git'
targetRevision: HEAD
ref: values
# Optional: extra resources (VSO secrets, etc.)
- repoURL: '[email protected]:AnhTran1610/k8s-cluster-config.git'
targetRevision: HEAD
path: core-components/<app-name>/resources
syncPolicy:
automated: { prune: true, selfHeal: true }
syncOptions:
- CreateNamespace=true
- ServerSideApply=true
Choose a sync wave based on dependencies:
values.yamlCreate Helm values for the chart. If using NFS Synology storage:
# Required for NFS Synology
podSecurityContext:
runAsUser: 1024
runAsGroup: 1024
# Disable chown (fails with root_squash)
initChownData:
enabled: false
# Use NFS storage class
persistence:
storageClassName: nfs-synology
accessMode: ReadWriteMany
# Generous startup probes for NFS
startupProbe:
failureThreshold: 60
periodSeconds: 10
If the app needs secrets, follow the Add Vault Secret guide.
If the app needs external access, configure it in the Helm values:
ingress:
enabled: true
className: traefik
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-dns01"
hosts:
- host: <app-name>.homelab.vyanh.uk
paths:
- path: /
pathType: Prefix
tls:
- secretName: <app-name>-tls
hosts:
- <app-name>.homelab.vyanh.uk
cd k8s-cluster-config
git add core-components/<app-name>/
git commit -m "feat: add <app-name> to cluster"
git push
ArgoCD will automatically detect the new application.yaml and deploy the app according to its sync wave.
# Check ArgoCD
kubectl get applications -n argocd | grep <app-name>
# Check pods
kubectl get pods -n <app-namespace>
# Check ingress
kubectl get ingress -n <app-namespace>
application.yaml with correct sync wavevalues.yaml with appropriate configuration