You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cli/secrets-encrypt.md
+84-12Lines changed: 84 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -23,41 +23,113 @@ K3s contains a CLI tool `secrets-encrypt`, which enables automatic control over
23
23
Failure to follow proper procedure for rotating encryption keys can leave your cluster permanently corrupted. Proceed with caution.
24
24
:::
25
25
26
-
### Encryption Key Rotation
26
+
### New Encryption Key Rotation (Expiremental)
27
27
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
+
<TabsgroupId="se">
35
+
<TabItemvalue="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">
29
101
<TabItem value="Single-Server" default>
30
102
31
103
To rotate secrets encryption keys on a single-server cluster:
32
104
33
-
- Start the K3s server with the flag `--secrets-encryption`
105
+
1. Start the K3s server with the flag `--secrets-encryption`
34
106
35
107
:::note
36
108
Starting K3s without encryption and enabling it at a later time is currently *not* supported.
37
109
:::
38
110
39
-
1. Prepare
111
+
2. Prepare
40
112
41
113
```bash
42
114
k3s secrets-encrypt prepare
43
115
```
44
116
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:
46
118
```bash
47
119
# If using systemd
48
120
systemctl restart k3s
49
121
# If using openrc
50
122
rc-service k3s restart
51
123
```
52
124
53
-
3. Rotate
125
+
4. Rotate
54
126
55
127
```bash
56
128
k3s secrets-encrypt rotate
57
129
```
58
130
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
61
133
:::info
62
134
K3s will reencrypt ~5 secrets per second.
63
135
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
68
140
69
141
70
142
</TabItem>
71
-
<TabItem value="High-Availability" default>
143
+
<TabItem value="High-Availability">
72
144
73
145
The steps are the same for both embedded DB and external DB clusters.
74
146
@@ -123,8 +195,8 @@ To rotate secrets encryption keys on HA setups:
123
195
</TabItem>
124
196
</Tabs>
125
197
126
-
### Secrets Encryption Disable/Enable
127
-
<Tabs>
198
+
### Secrets Encryption Disable/Re-enable
199
+
<Tabs groupId="se">
128
200
<TabItem value="Single-Server" default>
129
201
130
202
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:
168
240
```
169
241
170
242
</TabItem>
171
-
<TabItem value="High-Availability" default>
243
+
<TabItem value="High-Availability">
172
244
173
245
After launching a HA cluster with `--secrets-encryption` flags, secrets encryption can be disabled.
0 commit comments