mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-10-29 22:03:22 -02:30
control-plane: fix kubeadm ops when advertiseAddress cannot be derived from default gateway (#13156)
* download: add apiserver ip in InitConfiguration In setups where the advertiseAddress cannot be derived from the default gateway, setting localAPIEndpoint.advertiseAddress will eliminate the error caused by that. this is like other kubeadm configs that we have. Signed-off-by: Seena Fallah <seenafallah@gmail.com> * control-plane: pass kubeadm config when creating token kubeadm token create subcommand will generate a default config when nothing as --config is passed. therefore if we have setups that need the config values to let kubeadm work (like if the ip cannot be derived by the default gateway) it will fail. Signed-off-by: Seena Fallah <seenafallah@gmail.com> --------- Signed-off-by: Seena Fallah <seenafallah@gmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
apiVersion: kubeadm.k8s.io/v1beta4
|
||||
kind: InitConfiguration
|
||||
localAPIEndpoint:
|
||||
advertiseAddress: "{{ kube_apiserver_address }}"
|
||||
nodeRegistration:
|
||||
criSocket: {{ cri_socket }}
|
||||
---
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
- name: Create hardcoded kubeadm token for joining nodes with 24h expiration (if defined)
|
||||
shell: >-
|
||||
{{ bin_dir }}/kubeadm --kubeconfig {{ kube_config_dir }}/admin.conf token delete {{ kubeadm_token }} || :;
|
||||
{{ bin_dir }}/kubeadm --kubeconfig {{ kube_config_dir }}/admin.conf token create {{ kubeadm_token }}
|
||||
{{ bin_dir }}/kubeadm --kubeconfig {{ kube_config_dir }}/admin.conf token create {{ kubeadm_token }} --config={{ kube_config_dir }}/kubeadm-config.yaml
|
||||
changed_when: false
|
||||
when:
|
||||
- inventory_hostname == first_kube_control_plane
|
||||
@@ -235,7 +235,7 @@
|
||||
when: inventory_hostname == first_kube_control_plane and remove_anonymous_access
|
||||
|
||||
- name: Create kubeadm token for joining nodes with 24h expiration (default)
|
||||
command: "{{ bin_dir }}/kubeadm --kubeconfig {{ kube_config_dir }}/admin.conf token create"
|
||||
command: "{{ bin_dir }}/kubeadm --kubeconfig {{ kube_config_dir }}/admin.conf token create --config={{ kube_config_dir }}/kubeadm-config.yaml"
|
||||
changed_when: false
|
||||
register: temp_token
|
||||
retries: 5
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
run_once: true
|
||||
|
||||
- name: Create kubeadm token for joining nodes with 24h expiration (default)
|
||||
command: "{{ bin_dir }}/kubeadm token create"
|
||||
command: "{{ bin_dir }}/kubeadm token create --config={{ kube_config_dir }}/kubeadm-config.yaml"
|
||||
register: temp_token
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
when: kubeadm_token is not defined
|
||||
|
||||
Reference in New Issue
Block a user