fix: download kubeconfig after nodes join the cluster - #413
Open
izerecord wants to merge 1 commit into
Open
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When replacing the first server node I realized, that it's not working, because the task for extracting the kubeconfig is hard-wired to the first server node, runs too early and therefore fails.
Swapping the the two tasks seems, at least for me, the easiest fix. I don't know, if there is more refactoring needed, where the first node is potentially hard-wired with
groups[rke2_servers_group_name].0.tasks/main.ymlfetched/etc/rancher/rke2/rke2.yamlfromgroups[rke2_servers_group_name].0, beforeremaining_nodes.ymlran.But that file only exists once that host's rke2-server has actually
started, which is true for a fresh bootstrap (
first_server.yml) butnot 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.
Type of change
How Has This Been Tested?
I tested it with a running cluster, replacing the first server node, and with a fresh cluster, with
rke2_api_ipset for kube-vip.It is my first Pull Request on GitHub. Hopefully I did nothing wrong and provided all the information you need.