Git Product home page Git Product logo

kube-dump's Introduction

Kube-dump

Backup a Kubernetes cluster as a yaml manifest.

Logo

GitHub release (latest by date) GitHub branch checks state GitHub GitHub last commit Docker Pulls Docker Cloud Build Status Docker Image Size (latest semver)

Description

With this utility you can save your cluster resources as nice yaml manifests without unnecessary metadata.

Key features:

  • Saving only those resources to which you have read access;
  • Can work with a list of namespaces otherwise all available ones will be used;
  • Can save both namespaced and cluster wide resources;
  • You can run locally, in a container or in a cluster;
  • Can archive and rotate dump archives;
  • Can commit dumps to a git repository and send to a remote repository;
  • You can specify a list of resources to be dumped;
  • It is possible to configure via command line arguments as well as via environment variables.

Plans to implement:

  • Sending dumps to s3 bucket;
  • Sending notifications by email and webhook;****
  • Git-crypt to encrypt secrets
  • Bash autocomplete

asciicast

Quick Start Guides

Dependencies

Required dependencies:

  • kubectl - Kubernetes command-line tool
  • jq - Command-line JSON processor
  • yq - Command-line YAML processor

Optional dependencies:

  • curl - Used to check kubernetes api livez probe when use serviceaccount
  • git - Used to store backups as a git repository
  • tar - Used to create backup archives with one of the compression libraries:
    • xz - a lossless data compression file format based on the LZMA algorithm
    • gzip - single-file/stream lossless data compression utility
    • bzip2 - compression program that uses the Burrows–Wheeler algorithm

Commands and flags

./kube-dump [command] [[flags]]

Available Commands:
  all, dump                     Dump all kubernetes resources
  ns,  dump-namespaces          Dump namespaced kubernetes resources
  cls, dump-cluster             Dump cluster wide kubernetes resources

The command can also be passed through the environment variable MODE.
All flags presented below have a similar variable in uppercase, with underscores
For example:
  --destination-dir == DESTINATION_DIR 

Flags:
  -h, --help                    This help
  -s, --silent                  Execute silently, suppress all stdout messages
  -d, --destination-dir         Path to dir for store dumps, default ./data
  -f, --force-remove            Delete resources in data directory before launch

Kubernetes flags:
  -n, --namespaces              List of kubernetes namespaces
  -r, --namespaced-resources    List of namespaced resources
  -k, --cluster-resources       List of cluster resources
      --kube-config             Path to kubeconfig file
      --kube-context            The name of the kubeconfig context to use
      --kube-cluster            The name of the kubeconfig cluster to use
      --kube-insecure-tls       Skip check server's certificate for validity

Git commit flags:
  -c, --git-commit              Commit changes
  -p, --git-push                Commit changes and push to origin
  -b, --git-branch              Branch name
      --git-commit-user         Commit author username
      --git-commit-email        Commit author email
      --git-remote-name         Remote repo name, defualt is origin
      --git-remote-url          Remote repo URL

Archivate flags:
  -a, --archivate               Create archive of data dir
      --archive-rotate-days     Rotate archives older than N days
      --archive-type            Archive type xz, gz or bz2, default is tar

Example of use:
  $cmd dump-namespaces -n default,dev -d /mnt/dump -spa --archive-type gz

Environment variables

All environment variables are described in the .env file, you can use them both for the container launch configuration and directly from the .env file, it is read automatically at startup.

Resources default's

All resources automatically discovered from the API if not pass as argument.

  • List of namespaces
  • List of default namespaced resources
  • List of default cluster wide resources

kube-dump's People

Contributors

woozymasta avatar davidalger avatar viacheslave avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.