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: README.md
+24-5Lines changed: 24 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -384,6 +384,14 @@ Example:
384
384
385
385
```yaml
386
386
hooks:
387
+
connect:
388
+
after:
389
+
- echo "connected and detected" >> k0sctl-connect.log
390
+
upgrade:
391
+
before:
392
+
- echo "about to upgrade" >> k0sctl-upgrade.log
393
+
after:
394
+
- echo "upgraded" >> k0sctl-upgrade.log
387
395
apply:
388
396
before:
389
397
- date >> k0sctl-apply.log
@@ -393,16 +401,30 @@ hooks:
393
401
394
402
The currently available "hook points" are:
395
403
404
+
* `connect`:
405
+
- `after`: Runs immediately after OS detection completes
396
406
* `apply`: Runs during `k0sctl apply`
397
407
- `before`: Runs after configuration and host validation, right before configuring k0s on the host
398
408
- `after`: Runs before disconnecting from the host after a successful apply operation
409
+
* `upgrade`: Runs during `k0sctl apply`
410
+
- `before`: Runs for each host that is going to be upgraded, before the upgrade begins
411
+
- `after`: Runs for each host that was upgraded, after the upgrade completes
412
+
* `install`: Runs during `k0sctl apply`
413
+
- `before`: Runs on each host just before installing its k0s components. This includes the first controller (Initialize the k0s cluster), additional controllers, and workers.
414
+
- `after`: Runs on each host immediately after installing its k0s components (service started and ready checks done).
399
415
* `backup`: Runs during `k0s backup`
400
416
- `before`: Runs before k0sctl runs the `k0s backup` command
401
417
- `after`: Runs before disconnecting from the host after successfully taking a backup
402
-
* `reset`: Runs during `k0sctl reset`
418
+
* `reset`: Runs during `k0sctl reset` or when `k0sctl apply` resets a host.
403
419
- `before`: Runs after gathering information about the cluster, right before starting to remove the k0s installation.
404
420
- `after`: Runs before disconnecting from the host after a successful reset operation
405
421
422
+
Notes:
423
+
424
+
- Hooks run on each host that defines them, using the same remote user as the connection. If elevated privileges are required, prefix commands with `sudo`.
425
+
- In dry-run mode, hooks are not executed; k0sctl prints what would run on each host.
426
+
- Hooks execute only on hosts targeted by the related phase. For example, `upgrade` hooks run only for hosts that need upgrade.
Override OS distribution auto-detection. By default `k0sctl` detects the OS by reading `/etc/os-release` or `/usr/lib/os-release` files. In case your system is based on e.g. Debian but the OS release info has something else configured you can override `k0sctl` to use Debian based functionality for the node with:
@@ -741,7 +763,7 @@ The following tokens can be used in the `k0sDownloadURL` and `files.[*].src` fie
0 commit comments