Skip to content

ETCD Backup script is designed for performing backups of the ETCD database on Kubernetes environments. It handles the creation of timestamped backup files, compresses them, and manages the retention of these backups by deleting older files.

License

Notifications You must be signed in to change notification settings

mk3-v8/etcd-backup-script

Repository files navigation

ETCD Backup and Restore Scripts

Overview

This repository contains scripts for backing up and restoring the ETCD database in Kubernetes environments. These scripts facilitate the creation of timestamped backup files, handle their compression, and manage the retention of these backups by deleting older files.

Features

  • Automated backup of ETCD database.
  • Backup file compression.
  • Backup retention management.
  • Ansible playbook for easy deployment and execution.
  • Restoration script for ETCD data.

Prerequisites

  • Root access to a Kubernetes environment with ETCD (Masters).
  • Required tools: etcdctl, gzip, crontab, and standard Linux utilities (date, find, etc.).
  • Ansible for running playbooks.

Installation

  1. Clone the repository:
   git clone https://github.com/mk3-v8/etcd-backup-script.git
   cd etcd-backup-script

Usage

Backup

Deploy and run the backup script using Ansible:

ansible-playbook copy.yml

Restore

List backups and prompt for the backup file to restore:

ansible-playbook restore.yml

Environment Variables (optional)

  • RETENTION_DAYS: Number of days to retain the backup files.
  • BACKUP_DIR: Directory where backup files are stored.

Customization

You can modify the CRON_SCHEDULE variable within the script to set a custom schedule for the cron job.

Contribution

Contributions to this script are welcome. Please fork the repository and submit a pull request with your changes.

Tested

Tested in Kubespray Kubernetes Deployment Version v1.25.6

License

MIT License

Copyright (c) 2024 Mohammed Aladwani

Contact


Note: This script is provided as-is with no guarantees. Please ensure you test it in your environment before using it in production.

About

ETCD Backup script is designed for performing backups of the ETCD database on Kubernetes environments. It handles the creation of timestamped backup files, compresses them, and manages the retention of these backups by deleting older files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages