Skip to content

Script to a make backup of all resources of a namespace on kubernetes.

License

Notifications You must be signed in to change notification settings

LorenzoAstengo/k8s-backup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

k8s-backup

k8s-backup is a useful script to make a backup of all the resources of a namespace on kubernetes.

The script exports:

  • deployments
  • services
  • configMaps
  • persistentVolumes
  • persistentVolumeClaim
  • ingress
  • gateways
  • virtualServices
  • serviceAccounts

The script creates in the current path a folder called as the namespace, all backup files are generated in it. All resources are saved in yaml files, those contained in the configMaps are instead saved separately from each other in special folders. It also has a clean mode that does not save the cluster resource information in all generated files and a cmyaml mode that saves configmaps as yaml files.

How to

To allow the correct functioning of the script, it must be run with a user enabled to read all the resources of the indicated namespace. For correct execution, indicate the namespace in one of the following four ways:

./k8s-backup.sh -n=<NAMESPACE>
./k8s-backup.sh -n=<NAMESPACE> -clean or --clean (remove metadata informations) --cmyaml (backup cm as yaml file)"
./k8s-backup.sh -h (script help)

If you use arguments separated by '=', don't use spaces in them.

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%