A CLI tool that allows you to interactively or programmatically download Kubernetes manifests from one or multiple namespaces.
- 🔍 Interactive Selection: Choose clusters, namespaces, and resource types through intuitive prompts
- 📦 Comprehensive Resource Support: Downloads all resource types including Custom Resource Definitions (CRDs)
- ⎈ Helm Values Export: Export Helm release values from one or multiple namespaces
- 🚫 Smart Filtering: Automatically excludes PersistentVolumes and PersistentVolumeClaims
- 🧹 Clean Manifests: Removes runtime fields (status, managedFields, UIDs, etc.) for clean exports
- 📁 Organized Output: Manifests are organized by namespace/resource-type/name.yaml
- 🔄 Multi-Cluster Support: Export from multiple clusters in a single run
- 👁️ Dry-Run Mode: Preview what would be downloaded without writing files
Download the latest release for your platform from the GitHub Releases page.
Available platforms:
- Linux (amd64, arm64)
- macOS (amd64, arm64)
- Windows (amd64)
After downloading, make the binary executable:
chmod +x manifold-k8s-*
sudo mv manifold-k8s-* /usr/local/bin/manifold-k8sgit clone https://github.com/davidschrooten/manifold-k8s
cd manifold-k8s
make buildThe binary will be available at bin/manifold-k8s.
go install github.com/davidschrooten/manifold-k8s@latestmanifold-k8s provides several commands:
kubectl-manifests: Interactive mode for Kubernetes manifests (best for exploration)kubectl-manifests-export: Non-interactive mode for Kubernetes manifests (best for scripting/CI-CD)helm-values: Interactive mode for Helm release valueshelm-values-export: Non-interactive mode for Helm release values
manifold-k8s kubectl-manifestsThis will start an interactive session that guides you through:
- Selecting cluster context(s) from your kubeconfig
- Selecting namespace(s)
- Selecting resource type(s) to export
- Choosing a target directory
manifold-k8s kubectl-manifests-export --context prod --namespaces default --resources pods,deployments -o ./outputThis requires all parameters via flags (no prompts).
Interactive Command:
manifold-k8s kubectl-manifests [flags]
Flags:
--dry-run Preview what would be downloaded without writing files
-o, --output string Output directory (will be prompted if not provided)Export Command:
manifold-k8s kubectl-manifests-export [flags]
Flags:
-a, --all-resources Export all resource types
-c, --context string Kubernetes context (required)
--dry-run Preview what would be exported without writing files
-n, --namespaces strings Namespaces to export (comma-separated, required)
-o, --output string Output directory (required)
-r, --resources strings Resource types to export (comma-separated, e.g. pods,deployments)Global Flags:
--kubeconfig string Path to kubeconfig file (default is $HOME/.kube/config)
--config string Config file (default is ./config.toml)Basic interactive use:
manifold-k8s kubectl-manifestsInteractive with pre-specified output directory:
manifold-k8s kubectl-manifests -o ./my-manifestsInteractive dry-run:
manifold-k8s kubectl-manifests --dry-runUse a specific kubeconfig:
manifold-k8s kubectl-manifests --kubeconfig ~/.kube/config-prodExport specific resources from specific namespaces:
manifold-k8s kubectl-manifests-export --context prod --namespaces default,kube-system --resources pods,deployments,services -o ./outputExport all resources from a namespace:
manifold-k8s kubectl-manifests-export --context staging --namespaces myapp --all-resources -o ./backupDry-run in non-interactive mode:
manifold-k8s kubectl-manifests-export --context prod --namespaces default --resources configmaps --dry-run -o ./testExport from multiple namespaces:
manifold-k8s kubectl-manifests-export -c prod -n namespace1,namespace2,namespace3 -r deployments,statefulsets -o ./manifestsExport Helm release values from your clusters. Requires helm CLI to be installed.
Basic usage:
manifold-k8s helm-valuesThis will interactively guide you through:
- Selecting cluster context(s)
- Selecting namespace(s)
- Automatically discovers and exports all Helm releases
With pre-specified output directory:
manifold-k8s helm-values -o ./helm-backupExport all Helm releases from specific namespaces:
manifold-k8s helm-values-export --context prod --namespaces default,app1 --all -o ./helm-valuesExport specific Helm releases:
manifold-k8s helm-values-export -c prod -n default -r myapp,nginx -o ./valuesDry-run:
manifold-k8s helm-values-export -c staging -n myapp --all --dry-run -o ./testManifests are organized in the following directory structure:
output-directory/
├── namespace1/
│ ├── deployments/
│ │ ├── app1.yaml
│ │ └── app2.yaml
│ ├── services/
│ │ └── app1-svc.yaml
│ └── configmaps/
│ └── app-config.yaml
└── namespace2/
└── pods/
└── pod1.yaml
- Go 1.21 or later
- Access to a Kubernetes cluster (for testing)
make build# Run all tests
make test
# Run tests with coverage
make coverage
# Run linters
make lintThe project maintains high test coverage with extensive mocking:
- Core Packages Average: 91.7%
pkg/exporter: 100.0% (complete coverage with all error paths tested)pkg/k8s: 92.5% (comprehensive resource discovery and filtering)pkg/selector: 89.6% (extensive mocking of survey library)pkg/helm: 84.8% (Helm CLI integration and parsing)
- cmd Package: 51.1%
- Core functionality (non-interactive): ~85% coverage
- Interactive functions excluded from coverage (require user input)
- Includes comprehensive tests for:
- Command structure and flags
- Kubernetes manifest export logic
- Helm values export logic
- Error handling paths
- Overall: 68.0%
Note: Interactive command functions (kubectl-manifests and helm-values) are excluded from coverage metrics as they require user prompts and are not easily testable. All non-interactive command paths (kubectl-manifests-export, helm-values-export) have comprehensive test coverage.
The project follows Test-Driven Development (TDD) principles:
- Write tests first
- Implement functionality to make tests pass
- Commit changes to feature branches
- Merge to master after tests pass
Releases are automated via GitHub Actions. To create a new release:
-
Tag a commit with a version number:
git tag -a v1.0.0 -m "Release v1.0.0" git push origin v1.0.0 -
The release workflow will automatically:
- Run tests
- Build binaries for all supported platforms
- Create checksums
- Create a GitHub release with all artifacts
- Generate release notes
The project is organized into three main packages:
- pkg/k8s: Kubernetes client management, resource discovery, and filtering
- pkg/selector: Interactive prompts using the survey library
- pkg/exporter: Manifest cleaning and file writing logic
- cmd: Cobra command structure and workflow orchestration
The tool uses Viper for configuration management. You can create a config.toml file:
kubeconfig = "/path/to/kubeconfig"Or use environment variables with the MANIFOLD_ prefix:
export MANIFOLD_KUBECONFIG=/path/to/kubeconfigMIT License - see LICENSE file for details
Contributions are welcome! Please ensure:
- Tests are written for new functionality
- Test coverage remains high
- Code follows existing patterns and conventions
- Commit messages are descriptive