etcd-k8s-extract is a tool that processes an etcd data directory or database file used in Kubernetes, extracts Kubernetes resources, and writes them to disk in YAML format.
This tool is especially helpful when debugging Kubernetes clusters in environments where you have limited access, or when you only have an etcd backup available. It requires no running etcd instance or additional tooling—just the etcd data directory or database file and this tool.
When you run etcd-k8s-extract, it organizes the extracted resources into directories based on their types and namespaces, like this:
├── pods
│ ├── capd-system
│ │ └── capd-controller-manager-7dfb5f78df-bcz44
│ │ └── 5-2301.yaml
│ ├── capi-kubeadm-bootstrap-system
│ │ └── capi-kubeadm-bootstrap-controller-manager-6845c9fc68-q7z2c
│ │ └── 5-2254.yaml
│ ├── capi-kubeadm-control-plane-system
│ │ └── capi-kubeadm-control-plane-controller-manager-c9c8bccc6-97fck
│ │ └── 5-2277.yaml
│ ├── capi-system
│ │ └── capi-controller-manager-66dbddf59f-67x5g
│ │ └── 5-2233.yaml
- Debug Kubernetes clusters in restricted or remote environments.
- Analyze Kubernetes configurations when only an etcd backup is available.
- Operate independently of a running etcd instance or Kubernetes control plane.
You can download the latest release:
curl -L https://github.com/zawachte/etcd-k8s-extract/releases/download/v0.0.2/etcd-k8s-extract -o etcd-k8s-extract
If you already have Go installed:
go install github.com/zawachte/etcd-k8s-extract@latest
If you want to build the tool yourself:
make build
./etcd-k8s-extract <path-to-etcd-data-directory>
Example:
./etcd-k8s-extract testetcd/etcd
./etcd-k8s-extract <path-to-etcd-database-file>
Example:
./etcd-k8s-extract testetcd/etcd/member/snap/db
./etcd-k8s-extract <source> --output-path <custom-output-directory>
Example:
./etcd-k8s-extract testetcd/etcd --output-path customdir