Skip to content

Commit

Permalink
Update docs of snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed May 21, 2024
1 parent 85fc8f6 commit 466a82a
Showing 1 changed file with 41 additions and 13 deletions.
54 changes: 41 additions & 13 deletions site/content/en/docs/user/kwokctl-snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ 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 (default)
- k8s yaml

## etcd snapshot

Save and restore clusters from etcd

### Save Cluster

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

## k8s yaml
## k8s yaml snapshot

We can use `--filter` to filter the resources you want to save or restore.
Save and restore clusters from apiserver

### Save Cluster

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

### Restore Cluster
Expand All @@ -46,19 +43,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 --path cluster.yaml --snapshot
```

## 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 +64,36 @@ 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

### 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
```

0 comments on commit 466a82a

Please sign in to comment.