Difference between revisions of "Kube-dump"

From wikieduonline
Jump to navigation Jump to search
 
(25 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{lc}}[[wikipedia:kubedump]] https://github.com/WoozyMasta/kube-dump
 
{{lc}}[[wikipedia:kubedump]] https://github.com/WoozyMasta/kube-dump
  
 +
* <code>[[kube-dump ns]]</code>
 +
** <code>[[kube-dump ns -n]] your-namespace</code>
 +
* <code>[[kube-dump all]]</code>
 +
* <code>[[kube-dump cls]]</code>
 +
* <code>[[kube-dump dump]]</code>
 +
* <code>[[kube-dump dump -ca]]</code>
 +
 +
== Installation ==
 +
* https://github.com/WoozyMasta/kube-dump/blob/master/docs/local.md
 +
 +
* <code>sudo apt install -y [[bash]] [[git]] [[tar]] [[xz-utils]] [[gzip]] [[bzip2]] [[curl]] [[yq]] [[jq]]</code>
 +
* <code>[[snap install kubectl --classic]]</code>
 +
* <code>git clone https://github.com/WoozyMasta/kube-dump.git && cd kube-dump</code>
 +
 +
== Examples ==
 
To backup all namespaces:
 
To backup all namespaces:
 
* <code>[[kube-dump ns]]</code>
 
* <code>[[kube-dump ns]]</code>
Line 6: Line 21:
 
To backup an specific namespace:
 
To backup an specific namespace:
 
* <code>[[kube-dump ns -n]] your-namespace</code>
 
* <code>[[kube-dump ns -n]] your-namespace</code>
 +
 +
=== Multi namespace ===
 +
* <code>[[kube-dump ns -n]] your-namespace1 -n namespace2</code>
 +
 +
== Help ==
 +
<pre>
 +
./kube-dump --help
 +
Dump kubernetes cluster resources
 +
 +
Usage:
 +
  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
 +
      --detailed                Do not remove detailed state specific fields
 +
      --output-by-type          Organize output into directories by resource type
 +
      --flat                    Organize all resources of the same type in the same file
 +
 +
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:
 +
  kube-dump dump-namespaces -n default,dev -d /mnt/dump -spa --archive-type gz
 +
 +
Report bugs at:
 +
  https://github.com/WoozyMasta/kube-dump/issues
 +
 +
 +
</pre>
  
 
== Related ==
 
== Related ==
 
* <code>[[snap install yq]]</code>
 
* <code>[[snap install yq]]</code>
 
* <code>[[kubectl get all]]</code>
 
* <code>[[kubectl get all]]</code>
 +
* [[Fail]]
 +
* [[--kube-config]]
 +
* [[kubedump]]
 +
* <code>[[kubectl cp]]</code>
  
 
== See also ==
 
== See also ==

Latest revision as of 13:14, 15 January 2024

wikipedia:kubedump https://github.com/WoozyMasta/kube-dump

Installation[edit]

Examples[edit]

To backup all namespaces:

To backup an specific namespace:

Multi namespace[edit]

Help[edit]

./kube-dump --help
Dump kubernetes cluster resources

Usage:
  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
      --detailed                Do not remove detailed state specific fields
      --output-by-type          Organize output into directories by resource type
      --flat                    Organize all resources of the same type in the same file

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:
  kube-dump dump-namespaces -n default,dev -d /mnt/dump -spa --archive-type gz

Report bugs at:
  https://github.com/WoozyMasta/kube-dump/issues
  <[email protected]>

Related[edit]

See also[edit]

Advertising: