This commit is contained in:
Felix Seifert 2026-01-08 22:38:00 +00:00 committed by GitHub
commit 2dc4e878e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 2 deletions

View File

@ -91,6 +91,16 @@ ansible-playbook reset.yml -i inventory/my-cluster/hosts.ini
>You should also reboot these nodes due to the VIP not being destroyed
### ⏻️ Reboot Cluster Nodes
The cluster nodes can all be rebooted at once, or staggered. For a staggered reboot, you can use `concurrent_reboots` to specify
how many nodes can be rebooted simultaneously. You can also use `wait_seconds_after_reboot` to specify how many seconds wait
time there should be between a successful reboot and starting the next reboot; this could be helpful for waiting to restart pods.
```bash
ansible-playbook reboot.yml -i inventory/my-cluster/hosts.ini --extra-vars 'concurrent_reboots=2 wait_seconds_after_reboot=30'
```
## ⚙️ Kube Config
To copy your `kube config` locally so that you can access your **Kubernetes** cluster run:

View File

@ -2,9 +2,27 @@
- name: Reboot k3s_cluster
hosts: k3s_cluster
gather_facts: true
# concurrent_reboots defines how many hosts to reboot concurrently, if not defined, all hosts rebooted at once
serial: "{{ concurrent_reboots | default('100%') }}"
tasks:
- name: Reboot the nodes (and Wait upto 5 mins max)
become: true
- name: >-
{{
'Reboot all nodes at once'
if (concurrent_reboots is not defined)
else 'Reboot nodes with concurrency of ' ~ concurrent_reboots
}}
ansible.builtin.reboot:
reboot_command: "{{ custom_reboot_command | default(omit) }}"
reboot_timeout: 300
test_command: >-
{{ 'kubectl get nodes' if 'master' in group_names else 'whoami' }}
- name: Optional wait after reboot before next rebooting next node
ansible.builtin.pause:
seconds: "{{ wait_seconds_after_reboot | default(0) }}"
when: >-
concurrent_reboots is defined and
wait_seconds_after_reboot is defined and
wait_seconds_after_reboot | int > 0