Giter Club home page Giter Club logo

stash's Introduction

Go Report Card Build Status Docker Pulls Slack Twitter

Stash

Stash by AppsCode is a cloud-native data backup and recovery solution for Kubernetes workloads. If you are running production workloads in Kubernetes, you might want to take backup of your disks, databases, etc. Traditional tools are too complex to set up and maintain in a dynamic compute environment like Kubernetes. Stash is a Kubernetes operator that uses restic or Kubernetes CSI Driver VolumeSnapshotter functionality to address these issues. Using Stash, you can backup Kubernetes volumes mounted in workloads, stand-alone volumes, and databases. Users may even extend Stash via addons for any custom workload.

Features

Features Community Edition Enterprise Edition Scope
Open source Stash Free for everyone Open Core Stash for production Enterprise workloads
Backup & Restore Workload Data โœ“ โœ“ Deployment, DaemonSet, StatefulSet, ReplicaSet, ReplicationController, OpenShift DeploymentConfig
Backup & Restore Stand-alone Volume (PVC) โœ“ โœ“ PersistentVolumeClaim, PersistentVolume
Schedule Backup, Instant Backup โœ“ โœ“ Schedule through cron expression or trigger instant backup using Stash Kubernetes plugin
Pause Backup โœ“ โœ“ No new backup when paused.
Backup & Restore subset of files โœ“ โœ“ Only backup/restore the files that matches the provided patterns
Cleanup old snapshots automatically โœ“ โœ“ Cleanup old snapshots according to different retention policies
Encryption, Deduplication (send only diff) โœ“ โœ“ Encrypt backed up data with AES-256. Stash only sends the changes since last backup.
CSI Driver Integration โœ“ โœ“ VolumeSnapshot for Kubernetes workloads. Supported for Kubernetes v1.17.0+.
Prometheus Metrics โœ“ โœ“ Rich backup metrics, restore metrics and Stash operator metrics.
Security โœ“ โœ“ Built-in support for RBAC, PSP and Network Policy
CLI โœ“ โœ“ kubectl plugin (for Kubernetes 1.12+)
Extensibility and Customizability โœ“ โœ“ Write addons for bespoke applications and customize currently supported workloads
Hooks โœ“ โœ“ Execute httpGet, httpPost, tcpSocket and exec hooks before and after of backup or restore process.
Cloud Storage as Backend โœ“ โœ“ Stores backup data in AWS S3, Minio, Rook, GCS, Azure, OpenStack Swift, Backblaze B2 and Rest Server
On-prem Storage as Backend โœ— โœ“ Stores backup data in any locally mounted Kubernetes Volumes such as NFS, etc.
Backup & Restore databases โœ— โœ“ PostgreSQL, MySQL, MongoDB, Elasticsearch, Redis, MariaDB, Percona XtraDB
Auto Backup โœ— โœ“ Share backup configuration across workloads using templates. Enable backup for a target application via annotation.
Batch Backup & Batch Restore โœ— โœ“ Backup and restore co-related applications (eg, WordPress server and its database) together
Point-In-Time Recovery (PITR) โœ— Planned Restore a set of files from a time in the past.

Installation

To install Stash, please follow the guide here.

Using Stash

Want to learn how to use Stash? Please start here.

Contribution guidelines

Want to help improve Stash? Please start here.

Acknowledgement

Support

To speak with us, please leave a message on our website.

To join public discussions with the Stash community, join us in the AppsCode Slack team channel #stash. To sign up, use our Slack inviter.

To receive product announcements, follow us on Twitter.

If you have found a bug with Stash or want to request new features, please file an issue.

License

FOSSA Status

stash's People

Contributors

1gtm avatar anisurrahman75 avatar diptadas avatar eliasp avatar farcaller avatar fossabot avatar functionary avatar galexrt avatar hmsayem avatar hossainemruz avatar jeanlucmongrain avatar kodiakhq[bot] avatar lastcoolnameleft avatar legion2 avatar piyush1146115 avatar rzcastilho avatar sadlil avatar sajibcse68 avatar saumanbiswas avatar sebastien-prudhomme avatar suaas21 avatar tahsinrahman avatar tamalsaha avatar the-redback avatar whereisaaron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stash's Issues

TODOs

Somethings I noticed during the demo;

  • Soidecar container should use PullIfAbsent
  • Use Restik from our appscode repo.

Test TODOs

  • AWS
  • GCS
  • Azure
  • Snapshots endpoints
  • Swift
  • Rest server
  • BackBlaze B2
  • Prometheus Pushgateway Scrapping

Proposal: Imeplement Restic TPR Resource for Kubernetes

Motivation:

If you are running production workloads in Kubernetes, you want to take backup of your disks. Traditional tools like Bacula are too complex to setup and maintain manually in a dynamic compute environment like Kubernetes. So, we plan to implement a TPR controller based on restic to address these issues.

Goals:

  • Take backup of Persistent Volumes or Persistent Volume claims from any running pod in Kubernetes.
  • Take backup of host paths from Nodes in Kubernetes.

Non-goals:

  • Take bakup of unbound PV or PVCs in Kubernetes.
  • Taking backup of consistent disk snapshots. This is a non goal for initial implementation. See here #4

Why Restic

Design:

Taking Backups:

To take a backup 4 piece of information is required:

  • Destination: Where the restic repository will live?
  • Source: Which files or folders will be backed up?
  • Schedule: How frequently backup command will be run?
  • GC: Some policy based garbage collection of old snapshots.

This a how a TPR controller can implement backups:

  • User deploys restik TPR controller. This will automatically create TPR if not present.
  • User creates a TPR object defining the above 4 piece of information needed for taking backups.
  • Now, user has to connect the TPR with a RC/Deployment. We can do this in 2 ways. We need to discuss this:
  • Add pod selectors to TPR. TPR controller can watch for that and make modifications.
  • Use adds an label RCs, Deployments, etc that TPR controller watches for. It could be:
storage.appscode.com/backup: true
backup.appscode.com/config: <name_of_tpr>

Filtering for a custom controller (one running its own, singular list/watch) will reduce deserialization costs. So, restik TOR will watch for RCs, etc. with label storage.appscode.com/backup: true.

I think the label based option has some advantages:

  • TPR controller can easily identify which RC/ Deployment PodTemplate to updated, instead of doing a reverse mapping from selector to RC/Deployment in option 1.
  • Dashboards like Pharm can also show if a RC etc in backed up or not easily.
  • Since PV/PVCs are related to a single app, Restic TPR object will be also related a single application. So, asking users to create a TPR for each app is probably reasonable.
  • Given that we have to modify the PodTemplate directly, there is not much benefit of using pod selectors unlike in Prometheus opreator.

Once TPR controller finds RC etc that has enabled bckup, it will add a sidecar container with restic. Currently there is no way to add sidecard container to a running pod. So, restic will restart the pods for the first time. This is not ideal but this the best we can do at this time.

If the RC and TPR assocation is later removed, TPR controller will also remove the side car container.

Scheuling backups:

I think we can just use cron to run backups on a schedule inside the docker container. This sounds simple enough.

Entrypoint:

Since restic process will be run on a scheule, some process will be needed to be running as the entrypoint. This will be a kloader type process that watches restic TPR and translates that into the restic compatiable config. eg,

  • update cron schedule,
  • modify the parameteres passed to restic cli, etc.
    We should ensure that updated config does not impact a running backup process.

Essentially, we can create a new restik (with k) cli with 3 commands:

  • restik run: This is the main TPR controller entrypoint that is run as a single replica in Kubernetes.
  • restik watch: This will be the entrypoint. This will watch Kubernetes restic TPR and write a cron script like below:
#!/bin/sh
RESTIC_PASSWORD=secret restic -r xyz /myapp --json | restik log
  • restik log: This command will read the json output from restic cli. It can do few things with that:
    • Write a Kubernetes event to record backup completion.
    • It can send an alert using Searchlight in case of failure.
    • It can export stats to Prometheus, records how long it took to run backup. How much data was added, etc. I need to check what is available in the output json.

Supported Kubernetes Objects:

We should any Kubernetes object types that have PodTemplate in their schema. These are:

  • RC
  • Replica Set
  • StaefulSet
  • Deployment
  • DaemonSet

Since new side car containers can't added once a Pod is created, Pod types will not be supported.

Backup Nodes

Users might be interested in take backup of host paths. This can be done by deploying a DaemonSet with a do nothing busybox container. Restic TPR controller can use that as a vessel for running restic side card containers.

Restarting pods

As mentioned before, first time side car containers are added, pods will be restarted by controller. Who performs the restart will be done on a case-by-case basis. For example, Kubernetes itself will restarts pods behind a deployment. In such cases, TPR controller will let Kubernetes do that.

Implementers should be aware of the controller-ref concept to properly identify the pods managed by a RC, etc.

This situation can be improved once Kubernetes adds support for extensible admission controller. Restic TPRC can become an admission controller and modify the PodTemplate accordingly. This is avoid the first restart issue. This will also allow us to support Pods directly. See tracking bug #5.

Repo initialization

For initial implementation, users will be expected to initialize the repository. We can revisit this later. See tracking bug #6 .

HTTP api

An HTTP api server can be implemented to expose readonly data for repositories. This can be used to build web Dashboards. This is outside the scope for initial implementation. Tracking bug #7.

Recovery process

The recover process will be left to users for now. Later we can think about automation.

CLI

A cli can be created that can simplify repo initialization, recover process for a Kubernetes deployment. This is outside the scope for initial implementation. Also, note that we are building a cli called osm for managing various cloud bucket operations. Tracking bug #8

Support updating version of resitc side-car

Currently users can manually update stash side-car. To automate this we could add a resync: true annotation on TPR or Kube objects. Stash operator can resync those automatically.

The obvious issue is this will not work for DaemonSets & StatefulSets.

Support recreation of StatefulSets

Side car container can't be added to a StatefulSet once it is created. So, we can add an option to
backup.appscode.com/recreate: true to delete and recreate SS with side car. This is an advanced option. we can do this later.

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.