From 621a74e85261bbcf2ffebca84527cf6cf1c5d380 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Tue, 21 May 2024 10:17:44 +0800 Subject: [PATCH] Fix snapshot docs --- site/content/en/docs/user/kwokctl-snapshot.md | 54 ++++++++++++++----- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/site/content/en/docs/user/kwokctl-snapshot.md b/site/content/en/docs/user/kwokctl-snapshot.md index 4c95d37028..5ff27ba8d0 100644 --- a/site/content/en/docs/user/kwokctl-snapshot.md +++ b/site/content/en/docs/user/kwokctl-snapshot.md @@ -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 @@ -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 @@ -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. @@ -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 ```