https://github.com/wiremind/kubectl-db-restore
A `kubectl` plugin that allows you to perform restore on various databases.
https://github.com/wiremind/kubectl-db-restore
Last synced: 5 months ago
JSON representation
A `kubectl` plugin that allows you to perform restore on various databases.
- Host: GitHub
- URL: https://github.com/wiremind/kubectl-db-restore
- Owner: wiremind
- License: apache-2.0
- Created: 2025-06-10T18:36:54.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-24T09:23:24.000Z (about 1 year ago)
- Last Synced: 2025-06-24T09:44:16.938Z (about 1 year ago)
- Language: Go
- Size: 41 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kubectl-db-restore
`kubectl-db-restore` is a [Krew](https://krew.sigs.k8s.io/) plugin for restoring databases running in Kubernetes, directly from your terminal using `kubectl`.
This plugin supports cloud-native database restoration workflows via Kubernetes Jobs. It is designed to be engine-extensible (currently supports ClickHouse and a placeholder for PostgreSQL) and integrates seamlessly into Kubernetes-native workflows.
---
## ๐ง Features
- โก Fast and CLI-native
- ๐ฆ Restore databases from S3-compatible backups
- ๐ Extensible engine system (e.g., ClickHouse, PostgreSQL)
- ๐งช Dry-run support
- ๐ Secret-based credential resolution from Kubernetes Secret
- ๐ ๏ธ Runs restore commands as Kubernetes Jobs
---
## ๐ฆ Installation (via Krew)
Ensure [Krew](https://krew.sigs.k8s.io/docs/user-guide/setup/install/) is installed:
```sh
kubectl krew install restore
```
Then invoke the plugin using:
```
kubectl db-restore
```
---
๐ง Supported Engines
Engine Status
[ClickHouse](doc/clickhouse.md) โ
Fully Supported
PostgreSQL โ ๏ธ Not yet implemented
๐ Example
```
export CLICKHOUSE_AWS_S3_ENDPOINT_URL_BACKUP="https://backup-name.s3.region-name.amazonaws.com"
kubectl db-restore database \
--engine clickhouse \
--backup-name daily-backup-2025-06-16 \
--database my_db \
--namespace analytics \
--service-name clickhouse-svc \
--secret-ref CLICKHOUSE_USER=clickhouse-secrets:user \
--secret-ref CLICKHOUSE_PASSWORD=clickhouse-secrets:password \
--secret-ref AWS_ACCESS_KEY_ID=aws-creds:access-key-id \
--secret-ref AWS_SECRET_ACCESS_KEY=aws-creds:secret-access-key \
```
These credentials are used to formulate the restore SQL and run it via clickhouse-client inside a Kubernetes Job.
๐งช Dry Run Mode
You can preview the generated SQL without actually executing it by passing the --dry-run flag:
```
kubectl db-restore database \
--dry-run \
--engine clickhouse ...
```
## ๐งฉ Contributing
Pull requests are welcome! Feel free to open issues or feature requests.