kube-save-restore

command module
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 10 Imported by: 0

README

kube-save-restore Logo

Kube-Save-Restore

A robust and user-friendly tool for backing up and restoring Kubernetes resources

IntroductionFeaturesInstallationUsageConfigurationContributingLicense

Go version Go Report Release

kube-save-restore Demo

Introduction

Ever wanted to do an old fashioned backup of your Kubernetes clusters resources? Enter kube-save-restore, your cluster's personal bodyguard. It backs up resources faster than you can say "kubectl", whether you're managing a cozy cluster or a Kubernetes behemoth. Think of it as a time machine for your cluster - minus the paradoxes! Let kube-save-restore protect you from data loss and config mishaps.

Features

🔄 Comprehensive Backup: Capture deployments, services, configmaps, secrets, statefulsets, and more across all namespaces.

🚀 Seamless Restore: Restore your Kubernetes resources with ease, ensuring minimal downtime.

🧪 Dry Run Mode: Validate backup and restore operations without making actual changes.

Concurrent Processing: Utilize worker pools for efficient handling of multiple resources.

📊 Customizable Logging: Configure log levels and output destinations to suit your monitoring needs.

🛠️ Configuration Flexibility: Easily configure via flags or environment variables.

🧬 Automated Testing: Comprehensive test suite ensuring reliability and stability.

Installation

Go Install

go install github.com/chaoscypher/kube-save-restore@latest

Building from Source

  1. Clone the repository:

    git clone git@github.com:ChaosCypher/kube-save-restore.git
    
  2. Navigate to the project directory:

    cd kube-save-restore
    
  3. Build the binary:

    go build -o kube-save-restore
    
  4. Move the binary to your PATH:

    sudo mv kube-save-restore /usr/local/bin/
    
  5. Run the binary:

    kube-save-restore --help
    

Usage

kube-save-restore offers two primary modes: backup and restore.

Backup

To create a backup of your Kubernetes resources:

./kube-save-restore --mode=backup --backup-dir=/path/to/backup --dry-run=false --log-level=info

This command will backup all supported resources from all namespaces in your cluster.

Restore

To restore your Kubernetes resources from a backup:

./kube-save-restore --mode=restore --restore-dir=/path/to/backup --dry-run=true --log-level=debug

It's recommended to use the --dry-run=true flag first to verify the restore operation before applying changes.

Additional Options

  • Use --context to specify a different Kubernetes context.
  • Set --log-file to save logs to a file instead of stdout.
  • Adjust --log-level to control the verbosity of logging.

For a full list of options, run:

./kube-save-restore --help

Configuration

kube-save-restore can be configured using command-line flags or environment variables:

Flag Environment Variable Description
--kubeconfig KUBECONFIG Path to the kubeconfig file
--context KUBE_CONTEXT Kubernetes context to use
--backup-dir BACKUP_DIR Directory where backups will be stored
--restore-dir RESTORE_DIR Directory from where backups will be restored
--mode MODE Operation mode: backup or restore
--dry-run DRY_RUN Execute a dry run without making any changes
--log-level LOG_LEVEL Logging level: debug, info, warn, error
--log-file LOG_FILE Path to the log file

Environment variables take precedence over command-line flags.

Contributing

We welcome contributions to kube-save-restore! Here's how you can contribute:

  1. Fork the Repository: Start by forking the kube-save-restore repository.

  2. Clone Your Fork:

    git clone git@github.com:YourUsername/kube-save-restore.git
    
  3. Create a Feature Branch:

    git checkout -b feature/YourFeature
    
  4. Make Your Changes: Implement your feature or bugfix.

  5. Run Tests: Ensure all tests pass:

    go test ./...
    
  6. Commit Your Changes:

    git commit -m "Add your feature"
    
  7. Push to Your Fork:

    git push origin feature/YourFeature
    
  8. Open a Pull Request: Go to the original kube-save-restore repository and open a pull request with your changes.

Coding Standards

  • Follow Go best practices and idiomatic Go code style.
  • Ensure your code is properly formatted using gofmt.
  • Write clear, concise commit messages.
  • Include tests for new features or bugfixes.
  • Update documentation as necessary.

Reporting Issues

If you find a bug or have a suggestion for improvement:

  1. Check the existing issues to avoid duplicates.
  2. If your issue isn't already listed, open a new issue.
  3. Clearly describe the problem or suggestion, including steps to reproduce if applicable.

License

kube-save-restore is open-source software licensed under the MIT License.

Contact

For any inquiries or support, please open an issue on the GitHub repository.


Made with ❤️ by ChaosCypher

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL