ArgoCD Deployment
This document explains how we manage deployments using ArgoCD and provides guidance for creating new deployments.
Overview
ArgoCD is used for GitOps-based continuous deployment. Application definitions are stored in a Git repository and ArgoCD reconciles the desired state with the cluster.
ArgoCD Application Structure
OCI Helm Chart Deployment
For applications with Helm charts published to Docker Hub:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: registration-portal-dev
namespace: argocd
spec:
project: default
destination:
name: idl-xnl-jhb1-rc01 # Cluster name
namespace: event-dev
source:
repoURL: registry-1.docker.io
chart: christhonie/registration-portal
targetRevision: 1.2.4-SNAPSHOT-RELEASE # Chart version
helm:
releaseName: dev-registration-portal
valuesObject:
# Helm values go here
config:
profiles: "dev,kubernetes,api-docs"
image:
tag: "1.2.4-SNAPSHOT" # Docker image tag
syncPolicy:
automated:
prune: true
selfHeal: true
allowEmpty: false
syncOptions:
- CreateNamespace=true
revisionHistoryLimit: 3
Git Source Deployment
For raw Kubernetes manifests (like GreenMail):
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: greenmail-dev
namespace: argocd
spec:
project: default
destination:
name: idl-xnl-jhb1-rc01
namespace: event-dev
source:
repoURL: [email protected]:christhonie/idl-xnl-jhb-rc01.git
targetRevision: HEAD
path: event-membership/greenmail-dev
syncPolicy:
automated:
prune: true
selfHeal: true
Version Conventions
| Component | Format | Example |
|---|---|---|
Helm Chart Version |
|
|
Docker Image Tag |
|
|
Database Name |
|
|
Common Values Configuration
Application Profiles
config:
profiles: "dev,kubernetes,api-docs"
Common profiles:
-
dev- Development settings, verbose logging -
kubernetes- Enables Spring Cloud Kubernetes -
api-docs- Enables Swagger/OpenAPI documentation -
otlp- Enables OpenTelemetry instrumentation
Database Configuration
config:
db:
# URL format WITHOUT driver prefix (jdbc: or r2dbc:)
url: mysql://idealogic-prod.mysql.svc.cluster.local:6446/registration_ui_dev?useUnicode=true&characterEncoding=utf8
username: dev
existingsecret: event-admin-service # Password from shared secret
Email Configuration (GreenMail)
config:
mail:
host: greenmail.event-dev.svc.cluster.local
port: 25
from: [email protected]
username: ""
password: ""
protocol: smtp
tls: false
properties.mail.smtp:
auth: false
starttls.enable: false
OpenTelemetry Configuration
config:
otel:
enabled: true
url: "http://opentelemetry-collector.observability.svc.cluster.local:4317"
Image Configuration
image:
pullPolicy: Always # Use Always for SNAPSHOT versions
tag: "1.2.4-SNAPSHOT"
imagePullSecrets:
- name: christhonie-docker # Docker Hub credentials
Ingress Configuration
ingress:
enabled: true
className: "nginx"
annotations:
"cert-manager.io/cluster-issuer": "letsencrypt-prod"
"external-dns.alpha.kubernetes.io/cloudflare-proxied": "false"
hostname: registration-portal-dev.idealogic.co.za
pathType: Prefix
tls: true
Scaling Configuration
replicaCount: 1 # Set to 0 to disable deployment
Setting replicaCount: 0 is useful when:
-
Debugging deployment issues
-
Waiting for dependencies to be ready
-
Temporarily disabling an environment
Creating a New Deployment
Step 1: Create ArgoCD Application File
Create a new YAML file in argocd/ directory:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: <app-name>-<env>
namespace: argocd
spec:
project: default
destination:
name: idl-xnl-jhb1-rc01
namespace: event-<env>
source:
repoURL: registry-1.docker.io
chart: christhonie/<chart-name>
targetRevision: <version>-RELEASE
helm:
releaseName: <env>-<app-name>
valuesObject:
# ... values configuration
syncPolicy:
automated:
prune: true
selfHeal: true
allowEmpty: false
syncOptions:
- CreateNamespace=true
revisionHistoryLimit: 3
Step 2: Configure Values
Add the appropriate values for your environment. Reference existing deployments for patterns.
Common Issues and Solutions
Application OutOfSync but Won’t Sync
Cause: Resource has been manually modified or has invalid fields.
Solution:
argocd app sync <app-name> --force
Pod CrashLoopBackOff
Check the pod logs:
kubectl logs -n event-<env> -l app.kubernetes.io/name=<app-name> --previous
Common causes:
-
Missing secrets: Verify
existingsecretpoints to valid secret -
Database connection failed: Check database URL and credentials
-
Missing K8s dependencies: Ensure
spring-cloud-starter-kubernetes-fabric8-configis included
CreateContainerError: no command specified
Cause: Docker image built without proper entrypoint.
Solution: Rebuild the Docker image with proper ENTRYPOINT or CMD in Dockerfile.
Environment Conventions
| Environment | Namespace | Hostname Pattern |
|---|---|---|
Development |
|
|
Staging |
|
|
Production |
|
|
Related Documentation
-
Helm Chart Patterns - How charts are structured
-
Manual Helm Release - Publishing charts
-
GreenMail Email Server - Email testing in dev