Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Update docs of snapshot #1100

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ This document walks you through how to save and restore a cluster with `kwokctl`

{{< /hint >}}

So far, we provide two ways to save and restore clusters:
## etcd snapshot

- etcd snapshot (default)
- k8s yaml
Save and restore clusters from etcd

## etcd snapshot
<img width="700px" src="./etcd-snapshot.svg">

### Save Cluster

Expand All @@ -29,14 +28,16 @@ kwokctl snapshot save --path snapshot.db
kwokctl snapshot restore --path snapshot.db
```

## k8s yaml
## k8s yaml snapshot

Save and restore clusters from apiserver

We can use `--filter` to filter the resources you want to save or restore.
<img width="700px" src="./yaml-snapshot.svg">

### Save Cluster

``` bash
kwokctl snapshot save --path cluster.yaml --format k8s
kwokctl snapshot record --snapshot --path cluster.yaml
```

### Restore Cluster
Expand All @@ -46,19 +47,19 @@ and the `ownerReference` field of the resources is updated to re-link them with
so we can preserve the hierarchy and dependencies of the resources in restore.

``` bash
kwokctl snapshot restore --path cluster.yaml --format k8s
kwokctl snapshot replay --snapshot --path cluster.yaml
```

## Export External Cluster
### Export External Cluster

This like `kwokctl snapshot save --format k8s` but it will use the kubeconfig to connect to the cluster.
It will use the kubeconfig to connect to the cluster and export resources.
This is useful when you want to snapshot a cluster that is not managed by `kwokctl`.

``` bash
kwokctl snapshot export --path external-snapshot.yaml --kubeconfig /path/to/kubeconfig
```

### Restore External Cluster
#### Restore External Cluster

Let's restore the cluster we just exported.

Expand All @@ -67,5 +68,38 @@ so we can preserve the hierarchy and dependencies of the resources in restore.

``` bash
kwokctl create cluster
kwokctl snapshot restore --path external-snapshot.yaml --format k8s
kwokctl snapshot replay --path external-snapshot.yaml --snapshot
```

## k8s yaml recording

Record and replay cluster over time from apiserver

<img width="700px" src="./yaml-recording.svg">

### Record Cluster

Press Ctrl+C to stop recording resources

``` bash
kwokctl snapshot record --path recording.yaml
```

### Replay Cluster

``` bash
kwokctl snapshot replay --path recording.yaml
```

### Export External Cluster

``` bash
kwokctl snapshot export --path external-recording.yaml --record --kubeconfig /path/to/kubeconfig
```

#### Replay External Cluster

``` bash
kwokctl create cluster
kwokctl snapshot replay --path external-recording.yaml
```