Skip to content

Commit b5fb183

Browse files
committed
Add section on secrets encryption v3
Signed-off-by: Derek Nola <derek.nola@suse.com>
1 parent 28542a1 commit b5fb183

File tree

1 file changed

+84
-12
lines changed

1 file changed

+84
-12
lines changed

docs/cli/secrets-encrypt.md

Lines changed: 84 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,113 @@ K3s contains a CLI tool `secrets-encrypt`, which enables automatic control over
2323
Failure to follow proper procedure for rotating encryption keys can leave your cluster permanently corrupted. Proceed with caution.
2424
:::
2525

26-
### Encryption Key Rotation
26+
### New Encryption Key Rotation (Expiremental)
2727

28-
<Tabs>
28+
:::info Version Gate
29+
Available as of [v1.28.1+k3s1](https://github.com/k3s-io/k3s/releases/tag/v1.28.1%2Bk3s1). This new version of the tool utilized K8s [automatic config reloading](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/#configure-automatic-reloading) which is currently in beta. GA is expected in v1.29.0
30+
31+
For older releases, see [Encryption Key Rotation Classic](#encryption-key-rotation-classic)
32+
:::
33+
34+
<Tabs groupId="se">
35+
<TabItem value="Single-Server" default>
36+
To rotate secrets encryption keys on a single-server cluster:
37+
38+
1. Start the K3s server with the flag `--secrets-encryption`
39+
40+
:::note
41+
Starting K3s without encryption and enabling it at a later time is currently *not* supported.
42+
:::
43+
44+
2. Rotate secrets encryption keys
45+
```
46+
k3s secrets-encrypt rotate-keys
47+
```
48+
49+
3. Wait for reencryption to finish. Watch the server logs, or wait for:
50+
```bash
51+
$ k3s secrets-encrypt status
52+
Encryption Status: Enabled
53+
Current Rotation Stage: reencrypt_finished
54+
```
55+
56+
</TabItem>
57+
<TabItem value="High-Availability">
58+
59+
To rotate secrets encryption keys on HA setups:
60+
61+
62+
1. Start up all three K3s servers with the `--secrets-encryption` flag. For brevity, the servers will be referred to as S1, S2, S3.
63+
64+
:::note
65+
Starting K3s without encryption and enabling it at a later time is currently *not* supported.
66+
:::
67+
68+
2. Rotate secrets encryption keys on S1
69+
70+
```bash
71+
k3s secrets-encrypt rotate-keys
72+
```
73+
74+
3. Wait for reencryption to finish. Watch the server logs, or wait for:
75+
```bash
76+
$ k3s secrets-encrypt status
77+
Encryption Status: Enabled
78+
Current Rotation Stage: reencrypt_finished
79+
```
80+
:::info
81+
K3s will reencrypt ~5 secrets per second. Clusters with large # of secrets can take several minutes to reencrypt. You can track progress in the server logs.
82+
:::
83+
84+
4. Restart K3s on S1 with same arguments. If running K3s as a service:
85+
```bash
86+
# If using systemd
87+
systemctl restart k3s
88+
# If using openrc
89+
rc-service k3s restart
90+
```
91+
92+
5. Once S1 is up, restart K3s on S2 and S3
93+
94+
95+
</TabItem>
96+
</Tabs>
97+
98+
### Encryption Key Rotation Classic
99+
100+
<Tabs groupId="se">
29101
<TabItem value="Single-Server" default>
30102
31103
To rotate secrets encryption keys on a single-server cluster:
32104
33-
- Start the K3s server with the flag `--secrets-encryption`
105+
1. Start the K3s server with the flag `--secrets-encryption`
34106
35107
:::note
36108
Starting K3s without encryption and enabling it at a later time is currently *not* supported.
37109
:::
38110
39-
1. Prepare
111+
2. Prepare
40112
41113
```bash
42114
k3s secrets-encrypt prepare
43115
```
44116
45-
2. Kill and restart the K3s server with same arguments. If running K3s as a service:
117+
3. Kill and restart the K3s server with same arguments. If running K3s as a service:
46118
```bash
47119
# If using systemd
48120
systemctl restart k3s
49121
# If using openrc
50122
rc-service k3s restart
51123
```
52124
53-
3. Rotate
125+
4. Rotate
54126
55127
```bash
56128
k3s secrets-encrypt rotate
57129
```
58130
59-
4. Kill and restart the K3s server with same arguments
60-
5. Reencrypt
131+
5. Kill and restart the K3s server with same arguments
132+
6. Reencrypt
61133
:::info
62134
K3s will reencrypt ~5 secrets per second.
63135
Clusters with large # of secrets can take several minutes to reencrypt.
@@ -68,7 +140,7 @@ Starting K3s without encryption and enabling it at a later time is currently *no
68140
69141
70142
</TabItem>
71-
<TabItem value="High-Availability" default>
143+
<TabItem value="High-Availability">
72144
73145
The steps are the same for both embedded DB and external DB clusters.
74146
@@ -123,8 +195,8 @@ To rotate secrets encryption keys on HA setups:
123195
</TabItem>
124196
</Tabs>
125197
126-
### Secrets Encryption Disable/Enable
127-
<Tabs>
198+
### Secrets Encryption Disable/Re-enable
199+
<Tabs groupId="se">
128200
<TabItem value="Single-Server" default>
129201
130202
After launching a server with `--secrets-encryption` flag, secrets encryption can be disabled.
@@ -168,7 +240,7 @@ To re-enable secrets encryption on a single node cluster:
168240
```
169241
170242
</TabItem>
171-
<TabItem value="High-Availability" default>
243+
<TabItem value="High-Availability">
172244
173245
After launching a HA cluster with `--secrets-encryption` flags, secrets encryption can be disabled.
174246

0 commit comments

Comments
 (0)