- π Automated backups using Kubernetes CronJob
- π¦ Uses official
argocd admin export
command for reliable backups - ποΈ Supports any S3-compatible storage (AWS S3, MinIO, etc.)
- π Secure credential management through Kubernetes secrets
- π Easy deployment via Helm chart or ArgoCD application
- β° Configurable backup schedule and timezone
- π Detailed logging and error reporting
- π Docker Image
- π Helm Package
- π° Helm Index
- π Github Releases
- Add the Helm repository:
helm repo add argocd-backup-s3 https://oguzhan-yilmaz.github.io/argocd-backup-s3/
helm repo update argocd-backup-s3
- Get the default values file:
helm show values argocd-backup-s3/argocd-backup-s3 > my-argocd-backup-s3.values.yaml
- Configure the required values in
my-argocd-backup-s3.values.yaml
:
timeZone: 'Asia/Istanbul' # optional -- https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
schedule: "00 20 * * *" # https://crontab.guru/#00_20_*_*_*
secretEnvVars:
AWS_ACCESS_KEY_ID: ""
AWS_SECRET_ACCESS_KEY: ""
AWS_DEFAULT_REGION: ""
S3_UPLOAD_PREFIX: ""
S3_BUCKET_NAME: ""
ARGOCD_SERVER: ""
ARGOCD_ADMIN_USERNAME: "admin"
ARGOCD_ADMIN_PASSWORD: ""
# If you want to use S3 compatible storage, you can use the following env var
# https://docs.aws.amazon.com/sdkref/latest/guide/feature-ss-endpoints.html
# AWS_ENDPOINT_URL_S3: 'https://s3.amazonaws.com'
- Install the chart:
helm upgrade --install \
-n argocd \
-f my-argocd-backup-s3.values.yaml \
argocd-backup-s3 argocd-backup-s3/argocd-backup-s3
- Download the ArgoCD application manifest:
curl -sL https://raw.githubusercontent.com/oguzhan-yilmaz/argocd-backup-s3/refs/heads/main/argocd-application.yaml -o argocd-backup-s3.argoapp.yaml
- Edit the
.valuesObject
section in the manifest with your configuration - Apply the manifest:
kubectl apply -f argocd-backup-s3.argoapp.yaml
The following script helps you set up the required AWS resources (S3 bucket and IAM user) for the backup solution:
# Set your company prefix
PREFIX="mycompany-argocd-backup-s3"
# Get AWS Account Info
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
AWS_REGION=$(aws configure get region 2>/dev/null || echo "eu-west-1")
echo "AWS_ACCOUNT_ID: ${AWS_ACCOUNT_ID}"
echo "AWS_REGION: ${AWS_REGION}"
# Create bucket name using AWS Account ID as suffix
BUCKET_NAME="${PREFIX}-${AWS_ACCOUNT_ID}"
IAM_USER_NAME="${BUCKET_NAME}"
echo "BUCKET_NAME: ${BUCKET_NAME}"
echo "IAM_USER_NAME: ${IAM_USER_NAME}"
# Create S3 Bucket
aws s3 mb "s3://${BUCKET_NAME}" --region "${AWS_REGION}"
# Create IAM User and Policy
aws iam create-user --user-name "${IAM_USER_NAME}"
POLICY_NAME="${IAM_USER_NAME}-bucket-access-policy"
aws iam create-policy \
--policy-name "${POLICY_NAME}" \
--policy-document '{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::'"${BUCKET_NAME}"'",
"arn:aws:s3:::'"${BUCKET_NAME}"'/*"
]
}
]
}'
# Attach Policy to User
aws iam attach-user-policy \
--user-name "${IAM_USER_NAME}" \
--policy-arn "$(aws iam list-policies --query "Policies[?PolicyName=='${POLICY_NAME}'].Arn" --output text)"
# Create Access Keys
CREDENTIALS=$(aws iam create-access-key --user-name "${IAM_USER_NAME}")
# Print Helm Values
echo "------ SUCCESS ------"
echo "Helm values.yaml:"
echo ""
echo "secretEnvVars:"
echo " AWS_ACCESS_KEY_ID: '$(echo "${CREDENTIALS}" | jq -r '.AccessKey.AccessKeyId')'"
echo " AWS_SECRET_ACCESS_KEY: '$(echo "${CREDENTIALS}" | jq -r '.AccessKey.SecretAccessKey')'"
echo " AWS_DEFAULT_REGION: ${AWS_REGION}"
echo " S3_BUCKET_NAME: ${BUCKET_NAME}"
echo " S3_UPLOAD_PREFIX: my-argo-instance/"
echo " ARGOCD_SERVER: argocd-server.argocd"
echo " ARGOCD_ADMIN_USERNAME: 'admin'"
echo " ARGOCD_ADMIN_PASSWORD: ''"
echo " AWS_ENDPOINT_URL_S3: 'https://s3.amazonaws.com'"
AWS_ACCESS_KEY_ID
: AWS access key for S3 accessAWS_SECRET_ACCESS_KEY
: AWS secret key for S3 accessAWS_DEFAULT_REGION
: AWS region for S3 bucketS3_BUCKET_NAME
: Name of the S3 bucketS3_UPLOAD_PREFIX
: Prefix for uploaded backup filesARGOCD_SERVER
: ArgoCD server addressARGOCD_ADMIN_PASSWORD
: ArgoCD admin password
timeZone
: Timezone for the CronJob (default: UTC) https://en.wikipedia.org/wiki/List_of_tz_database_time_zonesschedule
: Cron schedule for backups (default: "00 20 * * *")AWS_ENDPOINT_URL_S3
: (env var) Custom S3 endpoint for non-AWS S3 storageARGOCD_ADMIN_USERNAME
: Custom ArgoCD Admin UsernameserviceAccount.irsaEnabled
: This value allows your pods to access AWS S3 API via IAM Role please check the details
- WoodProgrammer: added Service Account EKS IRSA support
- lieblinger: added
ca-certificates
and fixedARGOCD_EXTRA_ARGS
in entrypoint script
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.