{"id":15322783,"url":"https://github.com/msfidelis/kubedump","last_synced_at":"2025-07-31T21:05:38.070Z","repository":{"id":185428991,"uuid":"673530492","full_name":"msfidelis/kubedump","owner":"msfidelis","description":":whale: :package: :rocket: - Simple tool to dump and restore kubernetes resources","archived":false,"fork":false,"pushed_at":"2024-05-14T14:28:30.000Z","size":118,"stargazers_count":46,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-05-14T15:45:51.923Z","etag":null,"topics":["backup","cloudnative","cobra","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msfidelis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-01T20:57:05.000Z","updated_at":"2024-05-30T04:28:25.990Z","dependencies_parsed_at":null,"dependency_job_id":"d60102c2-20b4-4eaf-946d-372c5ea70f53","html_url":"https://github.com/msfidelis/kubedump","commit_stats":null,"previous_names":["msfidelis/kubedump"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fkubedump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fkubedump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fkubedump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fkubedump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msfidelis","download_url":"https://codeload.github.com/msfidelis/kubedump/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710438,"owners_count":21149188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","cloudnative","cobra","kubernetes"],"created_at":"2024-10-01T09:17:58.040Z","updated_at":"2025-04-13T11:52:07.202Z","avatar_url":"https://github.com/msfidelis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubedump - Simple tool to dump and restore kubernetes resources\n\n![logo](.github/img/logo.png)\n\n\u003cp\u003e\n  \u003ca href=\"README.md\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Documentation\" src=\"https://img.shields.io/badge/documentation-yes-brightgreen.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"LICENSE\" target=\"_blank\"\u003e\n    \u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"/\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Build CI\" src=\"https://github.com/msfidelis/kubedump/workflows/kubedump%20ci/badge.svg\" /\u003e\n  \u003c/a\u003e  \n  \u003ca href=\"/\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Release\" src=\"https://github.com/msfidelis/kubedump/workflows/release%20packages/badge.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/fidelissauro\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Twitter: fidelissauro\" src=\"https://img.shields.io/twitter/follow/fidelissauro.svg?style=social\" /\u003e\n  \u003c/a\u003e  \n\u003c/p\u003e\n\n# Introduction\n\n\u003e Kubedump is a simple tool to make easy backups and workloads migrations between clusters.\n\n\n# Installation \n\n## Docker \n\n```bash\ndocker pull fidelissauro/kubedump:latest\n```\n\n```bash\ndocker run --network -v ~/.kubeconfig:/home/root/.kubeconfig host -it fidelissauro/kubedump:latest dump chip\n```\n\n\n## MacOS amd64\n\n```bash\nwget https://github.com/msfidelis/kubedump/releases/download/v0.1.8/kubedump_0.1.8_darwin_arm64 -O kubedump \nmv kubedump /usr/local/bin \nchmod +x /usr/local/bin/kubedump\n```\n\n\n## MacOS arm64\n\n```bash\nwget https://github.com/msfidelis/kubedump/releases/download/v0.1.8/kubedump_0.1.8_darwin_amd64 -O kubedump \nmv kubedump /usr/local/bin \nchmod +x /usr/local/bin/kubedump\n```\n\n## Linux amd64 \n\n```bash\nwget https://github.com/msfidelis/kubedump/releases/download/v0.1.8/kubedump_0.1.8_linux_amd64 -O kubedump \nmv kubedump /usr/local/bin \nchmod +x /usr/local/bin/kubedump\n```\n\n## Linux arm64 \n\n```bash\nwget https://github.com/msfidelis/kubedump/releases/download/v0.1.8/kubedump_0.1.8_linux_arm64 -O kubedump \nmv kubedump /usr/local/bin \nchmod +x /usr/local/bin/kubedump\n```\n\n## Freebsd amd64 \n\n```bash\nwget https://github.com/msfidelis/kubedump/releases/download/v0.1.8/kubedump_0.1.8_freebsd_amd64 -O kubedump \nmv kubedump /usr/local/bin \nchmod +x /usr/local/bin/kubedump\n```\n\n## Freebsd arm64 \n\n```bash\nwget https://github.com/msfidelis/kubedump/releases/download/v0.1.8/kubedump_0.1.8_freebsd_arm64 -O kubedump \nmv kubedump /usr/local/bin \nchmod +x /usr/local/bin/kubedump\n```\n\n#  Usage\n\n```bash\nkubedump --help\n\nUsage:\n  kubedump [command]\n\nAvailable Commands:\n  completion   Generate the autocompletion script for the specified shell\n  dump         dump all resources of a Kubernetes namespace\n  dump-file    dump all resources of with file custom configs\n  help         Help about any command\n  restore      restore all resources dumped using kubedump of a Kubernetes namespace\n  restore-file restore all resources of with custom configs from configuration files\n\nFlags:\n  -h, --help   help for kubedump\n\nUse \"kubedump [command] --help\" for more information about a command.\n``````\n\n## Usage - Dump\n\n```bash\nkubedump dump --help\n\ndump all resources of a Kubernetes namespace\n\nUsage:\n  kubedump dump [namespace] [flags]\n\nFlags:\n  -d, --dry-run                   Perform a dry-run backup (no actual backup will be performed)\n      --format string             Dump output format (default \"yaml\")\n  -h, --help                      help for dump\n      --kubectl-location string   Custom kubectl binary or alias (default \"kubectl\")\n      --project string            Project name (default \"kubedump\")\n      --resources string          Kubernetes resources separated by comma (default \"deployment,service,hpa,ingress,serviceaccount,daemonset,statefulset,job,cronjob\")\n```\n\n### Dump namespace resources \n\n```bash\n❯ kubedump dump chip --project cluster_x\n\n2023/08/02 21:48:08 INFO Starting dump namespace=chip\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=namespace\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=deployment\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=service\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=hpa\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=ingress\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=serviceaccount\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=daemonset\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=statefulset\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=job\n2023/08/02 21:48:08 INFO Dumping resources namespace=chip resource=cronjob\n2023/08/02 21:48:08 INFO Success namespace=chip output_files=./cluster_x/chip\n```\n\nAn folder will be created with `project` name, with output structure like \n\n```\n❯ tree cluster_x\ncluster_x\n└── chip\n    ├── 00-namespace.yaml\n    ├── cronjob.yaml\n    ├── daemonset.yaml\n    ├── deployment.yaml\n    ├── hpa.yaml\n    ├── ingress.yaml\n    ├── job.yaml\n    ├── service.yaml\n    ├── serviceaccount.yaml\n    └── statefulset.yaml\n```\n\n### Dump custom resources \n\n```bash\nkubedump dump chip --project cluster_x --resources deployment,service,hpa,ingress,serviceaccount,daemonset,statefulset,job,cronjob,virtualservice,gateway,destinationrules\n\n2023/08/02 21:49:19 INFO Starting dump namespace=chip\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=namespace\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=deployment\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=service\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=hpa\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=ingress\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=serviceaccount\n2023/08/02 21:49:19 WARN No resource found in namespace namespace=chip resource=serviceaccount\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=daemonset\n2023/08/02 21:49:19 WARN No resource found in namespace namespace=chip resource=daemonset\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=statefulset\n2023/08/02 21:49:19 WARN No resource found in namespace namespace=chip resource=statefulset\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=job\n2023/08/02 21:49:19 WARN No resource found in namespace namespace=chip resource=job\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=cronjob\n2023/08/02 21:49:19 WARN No resource found in namespace namespace=chip resource=cronjob\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=virtualservice\n2023/08/02 21:49:19 ERRO Error to Dump resource namespace=chip resource=virtualservice file=error exit status 1=\"missing value\"\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=gateway\n2023/08/02 21:49:19 ERRO Error to Dump resource namespace=chip resource=gateway file=error exit status 1=\"missing value\"\n2023/08/02 21:49:19 INFO Dumping resources namespace=chip resource=destinationrules\n2023/08/02 21:49:20 ERRO Error to Dump resource namespace=chip resource=destinationrules file=error exit status 1=\"missing value\"\n2023/08/02 21:49:20 INFO Success namespace=chip output_files=./cluster_x/chip\n```\n\n### Dump format option \n\n```\nkubedump dump chip --project cluster_x --format yaml\nkubedump dump chip --project cluster_y --format json\n```\n\n```\n❯ tree cluster_x\ncluster_x\n└── chip\n    ├── 00-namespace.yaml\n    ├── cronjob.yaml\n    ├── daemonset.yaml\n    ├── deployment.yaml\n    ├── hpa.yaml\n    ├── ingress.yaml\n    ├── job.yaml\n    ├── service.yaml\n    ├── serviceaccount.yaml\n    └── statefulset.yaml\n\n1 directory, 10 files\n❯ tree cluster_y\ncluster_y\n└── chip\n    ├── 00-namespace.json\n    ├── cronjob.json\n    ├── daemonset.json\n    ├── deployment.json\n    ├── hpa.json\n    ├── ingress.json\n    ├── job.json\n    ├── service.json\n    ├── serviceaccount.json\n    └── statefulset.json\n\n1 directory, 10 files\n```\n\n\n## Usage - Restore \n\n```bash\n❯ kubedump restore --help\nrestore all resources dumped using kubedump of a Kubernetes namespace\n\nUsage:\n  kubedump restore [namespace] [flags]\n\nFlags:\n      --config-file string        kubedump config file location\n  -h, --help                      help for restore\n      --kubectl-location string   Custom kubectl binary or alias (default \"/usr/local/bin/kubectl\")\n      --project string            Project name (default \"kubedump\")\n```\n\n\n```bash\nkubedump restore chip \n\n2023/08/02 21:50:13 INFO Restoring resources namespace=chip resource=namespace\n2023/08/02 21:50:13 INFO Resources restored: namespace=chip resources=kubedump/chip/00-namespace.yaml\n2023/08/02 21:50:13 INFO Resources restored: namespace=chip resources=kubedump/chip/deployment.yaml\n2023/08/02 21:50:13 INFO Resources restored: namespace=chip resources=kubedump/chip/hpa.yaml\n2023/08/02 21:50:13 INFO Resources restored: namespace=chip resources=kubedump/chip/ingress.yaml\n2023/08/02 21:50:13 INFO Resources restored: namespace=chip resources=kubedump/chip/service.yaml\n```\n\n\n## Using Config Files \n\n\nYou can use `dump-file` and `restore-file` command with yaml file configuration to automate dumps between a lot of namespaces at same time. \n\nYou can create a `kubedump-file.yaml` example like this: \n\n```yaml\nproject: cluster_x\nformat: yaml\nnamespaces: \n  - chip\n  - whois\nresources:\n  - deployment\n  - service\n  - hpa\n  - ingress\n  - serviceaccount\n  - daemonset\n  - statefulset\n  - jobs\n  - cronjob\n  - secret\n  - configmap\n\n```\n\nIn any case, you can bootstrap a project config file using `init` command\n\n```bash\nkubedump init --project kubedump\n2025/03/23 14:39:31 INFO Initializing project=kubedump\n2025/03/23 14:39:31 INFO Project folder created folder=./kubedump/\n2025/03/23 14:39:31 INFO Project file created project=./kubedump/project.yaml\n```\n\n```bash\nkubedump dump-file --config-file kubedump-file.yaml\n\n2023/08/02 21:52:13 INFO Dumping resources namespace=chip resource=namespace\n2023/08/02 21:52:13 INFO Dumping resources namespace=chip resource=deployment\n2023/08/02 21:52:14 INFO Dumping resources namespace=chip resource=service\n2023/08/02 21:52:14 INFO Dumping resources namespace=chip resource=hpa\n2023/08/02 21:52:14 INFO Dumping resources namespace=chip resource=ingress\n2023/08/02 21:52:14 INFO Dumping resources namespace=chip resource=serviceaccount\n2023/08/02 21:52:14 WARN No resource found in namespace namespace=chip resource=serviceaccount\n2023/08/02 21:52:14 INFO Success namespace=chip output_files=./cluster_x/chip\n2023/08/02 21:52:14 INFO Dumping resources namespace=whois resource=namespace\n2023/08/02 21:52:14 INFO Dumping resources namespace=whois resource=deployment\n2023/08/02 21:52:14 INFO Dumping resources namespace=whois resource=service\n2023/08/02 21:52:14 INFO Dumping resources namespace=whois resource=hpa\n2023/08/02 21:52:14 INFO Dumping resources namespace=whois resource=ingress\n2023/08/02 21:52:14 INFO Dumping resources namespace=whois resource=serviceaccount\n2023/08/02 21:52:14 WARN No resource found in namespace namespace=whois resource=serviceaccount\n2023/08/02 21:52:14 INFO Success namespace=whois output_files=./cluster_x/whois\n```\n\n\n```bash\nkubedump restore-file --config-file kubedump-file.yaml\n\n2023/08/02 21:52:45 INFO Restoring resources namespace=chip resource=namespace\n2023/08/02 21:52:45 INFO Resources restored: namespace=chip resources=cluster_x/chip/00-namespace.yaml\n2023/08/02 21:52:45 INFO Resources restored: namespace=chip resources=cluster_x/chip/deployment.yaml\n2023/08/02 21:52:45 INFO Resources restored: namespace=chip resources=cluster_x/chip/hpa.yaml\n2023/08/02 21:52:46 INFO Resources restored: namespace=chip resources=cluster_x/chip/ingress.yaml\n2023/08/02 21:52:46 INFO Resources restored: namespace=chip resources=cluster_x/chip/service.yaml\n2023/08/02 21:52:46 INFO Restoring resources namespace=whois resource=namespace\n2023/08/02 21:52:46 INFO Resources restored: namespace=whois resources=cluster_x/whois/00-namespace.yaml\n2023/08/02 21:52:46 INFO Resources restored: namespace=whois resources=cluster_x/whois/deployment.yaml\n2023/08/02 21:52:46 INFO Resources restored: namespace=whois resources=cluster_x/whois/hpa.yaml\n2023/08/02 21:52:46 INFO Resources restored: namespace=whois resources=cluster_x/whois/ingress.yaml\n2023/08/02 21:52:46 INFO Resources restored: namespace=whois resources=cluster_x/whois/service.yaml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsfidelis%2Fkubedump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsfidelis%2Fkubedump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsfidelis%2Fkubedump/lists"}