Skip to content

Commit 79bd2dd

Browse files
author
Christian Handschuh
committed
fix: download kubeconfig after nodes join the cluster
`tasks/main.yml` fetched `/etc/rancher/rke2/rke2.yaml` from `groups[rke2_servers_group_name].0`, before `remaining_nodes.yml` ran. But that file only exists once that host's rke2-server has actually started, which is true for a fresh bootstrap (`first_server.yml`) but not when the node at index 0 is instead rejoining an existing cluster - in that case 'remaining_nodes.yml' is what starts rke2-server on it, and it runs after the kubeconfig fetch, so the fetch fails. Move the kubeconfig download after "Prepare and join remaining nodes of the cluster" so it runs once the index-0 host has a running rke2-server regardless of which path (bootstrap or join) it took.
1 parent 0ef24b4 commit 79bd2dd

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tasks/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@
7070
- inventory_hostname == active_server or inventory_hostname == groups[rke2_servers_group_name].0
7171
- do_etcd_restore is defined or do_etcd_restore_from_s3 is defined
7272

73-
- name: Download kubeconfig to ansible localhost
74-
ansible.builtin.include_tasks: download_kubeconfig.yaml
75-
when:
76-
- rke2_download_kubeconf | bool
77-
- inventory_hostname == groups[rke2_servers_group_name].0
78-
7973
- name: Prepare and join remaining nodes of the cluster
8074
ansible.builtin.include_tasks: remaining_nodes.yml
8175
when:
8276
- active_server is defined
8377
- groups[rke2_cluster_group_name] | length | int >= 2
8478

79+
- name: Download kubeconfig to ansible localhost
80+
ansible.builtin.include_tasks: download_kubeconfig.yaml
81+
when:
82+
- rke2_download_kubeconf | bool
83+
- inventory_hostname == groups[rke2_servers_group_name].0
84+
8585
- name: Rolling cordon and drain restart when version changes - servers
8686
ansible.builtin.include_tasks: rolling_restart.yml
8787
with_items: "{{ groups[rke2_servers_group_name] }}"

0 commit comments

Comments
 (0)