The path of kubeconfig should be configurable, and its default value is /etc/kubernetes/admin.conf. Most paths of the file are configurable but some were not. This make those configurable.
This commit is contained in:
parent
04a8a19ce6
commit
bf1bb5984b
5 changed files with 7 additions and 7 deletions
|
@ -150,8 +150,8 @@
|
||||||
|
|
||||||
- name: Create hardcoded kubeadm token for joining nodes with 24h expiration (if defined)
|
- name: Create hardcoded kubeadm token for joining nodes with 24h expiration (if defined)
|
||||||
shell: >-
|
shell: >-
|
||||||
{{ bin_dir }}/kubeadm --kubeconfig /etc/kubernetes/admin.conf token delete {{ kubeadm_token }} || :;
|
{{ bin_dir }}/kubeadm --kubeconfig {{ kube_config_dir }}/admin.conf token delete {{ kubeadm_token }} || :;
|
||||||
{{ bin_dir }}/kubeadm --kubeconfig /etc/kubernetes/admin.conf token create {{ kubeadm_token }}
|
{{ bin_dir }}/kubeadm --kubeconfig {{ kube_config_dir }}/admin.conf token create {{ kubeadm_token }}
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == groups['kube_control_plane']|first
|
- inventory_hostname == groups['kube_control_plane']|first
|
||||||
|
@ -161,7 +161,7 @@
|
||||||
- kubeadm_token
|
- kubeadm_token
|
||||||
|
|
||||||
- name: Create kubeadm token for joining nodes with 24h expiration (default)
|
- name: Create kubeadm token for joining nodes with 24h expiration (default)
|
||||||
command: "{{ bin_dir }}/kubeadm --kubeconfig /etc/kubernetes/admin.conf token create"
|
command: "{{ bin_dir }}/kubeadm --kubeconfig {{ kube_config_dir }}/admin.conf token create"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: temp_token
|
register: temp_token
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
- name: kubeadm | scale down coredns replicas to 0 if not using coredns dns_mode
|
- name: kubeadm | scale down coredns replicas to 0 if not using coredns dns_mode
|
||||||
command: >-
|
command: >-
|
||||||
{{ bin_dir }}/kubectl
|
{{ bin_dir }}/kubectl
|
||||||
--kubeconfig /etc/kubernetes/admin.conf
|
--kubeconfig {{ kube_config_dir }}/admin.conf
|
||||||
-n kube-system
|
-n kube-system
|
||||||
scale deployment/coredns --replicas 0
|
scale deployment/coredns --replicas 0
|
||||||
register: scale_down_coredns
|
register: scale_down_coredns
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
- name: remove-node | Drain node except daemonsets resource # noqa 301
|
- name: remove-node | Drain node except daemonsets resource # noqa 301
|
||||||
command: >-
|
command: >-
|
||||||
{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf drain
|
{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf drain
|
||||||
--force
|
--force
|
||||||
--ignore-daemonsets
|
--ignore-daemonsets
|
||||||
--grace-period {{ drain_grace_period }}
|
--grace-period {{ drain_grace_period }}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: Uncordon node
|
- name: Uncordon node
|
||||||
command: "{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf uncordon {{ kube_override_hostname|default(inventory_hostname) }}"
|
command: "{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf uncordon {{ kube_override_hostname|default(inventory_hostname) }}"
|
||||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||||
when:
|
when:
|
||||||
- needs_cordoning|default(false)
|
- needs_cordoning|default(false)
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
delay: "{{ drain_retry_delay_seconds }}"
|
delay: "{{ drain_retry_delay_seconds }}"
|
||||||
rescue:
|
rescue:
|
||||||
- name: Set node back to schedulable
|
- name: Set node back to schedulable
|
||||||
command: "{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf uncordon {{ inventory_hostname }}"
|
command: "{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf uncordon {{ inventory_hostname }}"
|
||||||
when: upgrade_node_uncordon_after_drain_failure
|
when: upgrade_node_uncordon_after_drain_failure
|
||||||
- name: Fail after rescue
|
- name: Fail after rescue
|
||||||
fail:
|
fail:
|
||||||
|
|
Loading…
Reference in a new issue