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/capi-remote.md
+75Lines changed: 75 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -207,3 +207,78 @@ spec:
207
207
```
208
208
209
209
When CAPI controller creates a `RemoteMachine` from template object for the `K0sControlPlane`, k0smotron will pick one of the `PooledRemoteMachine` objects and use it's values for the `RemoteMachine` object.
210
+
211
+
### Using Sudo for Commands
212
+
213
+
When connecting to remote machines, you may need to execute commands with elevated privileges.
214
+
The `useSudo` field allows k0smotron to wrap all executed commands with `sudo`. This is particularly useful when the SSH user doesn't have root privileges but has sudo access:
All commands executed on this machine will be prefixed with `sudo`, allowing operations that require elevated privileges.
232
+
233
+
## Cleanup
234
+
235
+
If you delete a `RemoteMachine`, k0smotron will perform cleanup of the k0s installation on the machine before deleting the object.
236
+
237
+
!!! note
238
+
239
+
Cleanup is only performed if the `RemoteMachine` has been successfully provisioned using `K0sWorkerConfig` or `K0sControlPlane` objects.
240
+
If the `RemoteMachine` was provisioned using some other bootstrap provider, cleanup can be performed using `customCleanUpCommands` (see below).
241
+
242
+
The cleanup process for a k0s installation includes:
243
+
244
+
- Leaving the etcd cluster (if the node is a controller)
245
+
- Stopping the k0s service
246
+
- Running `k0s reset` to clean up k0s data ([read more](https://docs.k0sproject.io/stable/reset/)).
247
+
248
+
## Custom Cleanup Commands
249
+
250
+
k0smotron supports executing custom commands during the machine cleanup process when a `RemoteMachine` is deleted. This feature is particularly useful for:
251
+
252
+
- Cleaning up custom installations or configurations
253
+
- Removing additional services or agents
254
+
- Performing custom data cleanup
255
+
- Handling special cleanup requirements
256
+
257
+
!!! warning
258
+
When using `customCleanUpCommands`, you are responsible for the complete cleanup of the k0s installation. The default k0s cleanup will not be performed.
259
+
260
+
You can specify custom cleanup commands in the `customCleanUpCommands` field of a `RemoteMachine` or `PooledRemoteMachine`. For example:
0 commit comments