fix(control-plane): fetch discovery kubeconfig when adding control plane nodes with remove_anonymous_access (#13683)

* fix(control-plane): fetch discovery kubeconfig when adding control plane nodes

The 'Get kubeconfig for join discovery process' task is run_once, so its
'when' is evaluated only for the first control plane node. On an existing
cluster that node has already run kubeadm, so the task is skipped for all
hosts and 'Copy discovery kubeconfig' fails on the new control plane nodes
with "'dict object' has no attribute 'stdout'" when
remove_anonymous_access (file discovery) is enabled.

Drop the kubeadm_already_run condition from the run_once fetch. The copy
and join tasks keep their per-host conditions.

Signed-off-by: s3onghyun <s3onghyun.hong@gmail.com>

* control-plane: mark discovery kubeconfig fetch as not changed

Co-authored-by: guoard <guoard@users.noreply.github.com>

---------

Signed-off-by: s3onghyun <s3onghyun.hong@gmail.com>
Co-authored-by: guoard <guoard@users.noreply.github.com>
This commit is contained in:
SEONGHYUN HONG
2026-10-26 03:56:06 +00:00
committed by GitHub
co-authored by guoard
parent fdb798e7ea
commit 4427a95bfe
@@ -45,9 +45,9 @@
register: kubeconfig_file_discovery register: kubeconfig_file_discovery
run_once: true run_once: true
delegate_to: "{{ groups['kube_control_plane'] | first }}" delegate_to: "{{ groups['kube_control_plane'] | first }}"
changed_when: false
when: when:
- kubeadm_use_file_discovery - kubeadm_use_file_discovery
- kubeadm_already_run is not defined or not kubeadm_already_run.stat.exists
- name: Copy discovery kubeconfig - name: Copy discovery kubeconfig
copy: copy: