-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathUSAGE.md.gotmpl
90 lines (68 loc) · 5.96 KB
/
USAGE.md.gotmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Usage
Root command:
```
{{ .Env.USAGE }}
```
The Kubernetes resources created by pv-migrate are sourced from a [Helm chart](helm/pv-migrate).
You can pass raw values to the backing Helm chart
using the `--helm-*` flags for further customization: container images,
resources, serviceacccounts, additional annotations etc.
## Strategies
`pv-migrate` has multiple strategies implemented to carry out the migration operation. Those are the following:
| Name | Description |
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `mnt2` | **Mount both** - Mounts both PVCs in a single pod and runs a regular rsync, without using SSH or the network. Only applicable if source and destination PVCs are in the same namespace and both can be mounted from a single pod. |
| `svc` | **Service** - Runs rsync+ssh over a Kubernetes Service (`ClusterIP`). Only applicable when source and destination PVCs are in the same Kubernetes cluster. |
| `lbsvc` | **Load Balancer Service** - Runs rsync+ssh over a Kubernetes Service of type `LoadBalancer`. Always applicable (will fail if `LoadBalancer` IP is not assigned for a long period). |
| `local` | **Local Transfer** - Runs sshd on both source and destination, then uses a combination of `kubectl port-forward` logic and an SSH reverse proxy to tunnel all the traffic over the client device (the device which runs pv-migrate, e.g. your laptop). Requires `ssh` command to be available on the client device. <br/><br/>Note that this strategy is **experimental** (and not enabled by default), potentially can put heavy load on both apiservers and is not as resilient as others. It is recommended for small amounts of data and/or when the only access to both clusters seems to be through `kubectl` (e.g. for air-gapped clusters, on jump hosts etc.). |
## Examples
See the various examples below which copy the contents of the `old-pvc` into the `new-pvc`.
### Example 1: In a single namespace (minimal example)
```bash
$ pv-migrate --source old-pvc --dest new-pvc
```
### Example 2: Between namespaces
```bash
$ pv-migrate \
--source-namespace source-ns --source old-pvc \
--dest-namespace dest-ns --dest new-pvc
```
### Example 3: Between different clusters
```bash
pv-migrate \
--source-kubeconfig /path/to/source/kubeconfig \
--source-context some-context \
--source-namespace source-ns \
--source old-pvc \
--dest-kubeconfig /path/to/dest/kubeconfig \
--dest-context some-other-context \
--dest-namespace dest-ns \
--dest-delete-extraneous-files \
--dest new-pvc
```
### Example 4: Using custom container images from custom repository
```bash
$ pv-migrate \
--helm-set rsync.image.repository=mycustomrepo/rsync \
--helm-set rsync.image.tag=v1.2.3 \
--helm-set sshd.image.repository=mycustomrepo/sshd \
--helm-set sshd.image.tag=v1.2.3 \
--source old-pvc \
--dest new-pvc
```
### Example 5: Enabling network policies (on clusters with deny-all traffic rules)
```bash
$ pv-migrate \
--helm-set sshd.networkPolicy.enabled=true \
--helm-set rsync.networkPolicy.enabled=true \
--source-namespace source-ns --source old-pvc \
--dest-namespace dest-ns --dest new-pvc
```
### Example 6: Passing additional rsync arguments
```bash
$ pv-migrate \
--helm-set rsync.extraArgs="--partial --inplace" \
--source old-pvc --dest new-pvc
```
**For further customization on the rendered manifests**
(custom labels, annotations, etc.), see the [Helm chart values](helm/pv-migrate).