Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dougsland/kubectl-grab-resources
A kubectl plugin to grab all resources based on label
https://github.com/dougsland/kubectl-grab-resources
backup kubectl restore yaml
Last synced: 4 days ago
JSON representation
A kubectl plugin to grab all resources based on label
- Host: GitHub
- URL: https://github.com/dougsland/kubectl-grab-resources
- Owner: dougsland
- License: apache-2.0
- Created: 2020-09-16T04:24:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-04T14:06:17.000Z (about 4 years ago)
- Last Synced: 2024-12-14T11:12:12.197Z (9 days ago)
- Topics: backup, kubectl, restore, yaml
- Language: Shell
- Homepage:
- Size: 82 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KUBECTL GRAB RESOURCES
**kubectl grab-resources** command collects all resources from the cluster based on **label** input and export to a single YAML file.# Table of Contents
1. [**Why?**](#why)
2. [**Requirements**](#requirements)
3. [**How to install?**](#how-to-install)
4. [**How to use?**](#how-to-use)
5. [**Export your entire deployment**](#export-your-entire-deployment)
6. [**Restore your deployment**](#restore-your-deployment)
7. [**Demo**](#demo)## **Why**
Simple command to collect all resources related to a specific label saving the output to a single YAML file.
Later, users can just use ***kubectl apply -f filename.yaml*** to **restore the resources**.## **Requirements**
- [kubectl cli](https://github.com/kubernetes/kubectl)
- [Krew package manager for kubectl](https://github.com/kubernetes-sigs/krew)
- [neat plugin for kubectl](https://github.com/itaysk/kubectl-neat)## **How to install?**
After installing krew and neat plugin, just copy kubectl-grab_resources to your $PATH/bin## **How to use?**
```
$ kubectl grab-resources -l LABEL_NAME -o OUTPUT_FILENAME.yaml
```## **Restore your resources**
```
$ kubectl grab-resources -l app=kibana -o kibana-2020-09-16-00:10:25.yaml
```
**Example**(s):
- *user deleted kibana resources by mistake*
```
Restoring:
$ kubectl apply -f kibana-2020-09-16-00:10:25.yaml
```
## Demo
### grab-resources argocd
[![asciicast](https://asciinema.org/a/Vsz0HJSSryCCvwEqOFycFdO2Q.svg)](https://asciinema.org/a/Vsz0HJSSryCCvwEqOFycFdO2Q)### grab-resources Kibana
[![asciicast](https://asciinema.org/a/JAhrlIUjiCAfRu62my4fzVcLI.svg)](https://asciinema.org/a/JAhrlIUjiCAfRu62my4fzVcLI)