mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-07 02:27:43 +03:00
Use a variable for standardizing kubectl invocation (#8329)
* Add kubectl variable * Replace kubectl usage by kubectl variable in roles * Remove redundant --kubeconfig on kubectl usage * Replace unecessary shell usage with command
This commit is contained in:
@@ -115,9 +115,9 @@
|
||||
# incorrectly to first master, creating SPoF.
|
||||
- name: Update server field in kube-proxy kubeconfig
|
||||
shell: >-
|
||||
set -o pipefail && {{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf get configmap kube-proxy -n kube-system -o yaml
|
||||
set -o pipefail && {{ kubectl }} get configmap kube-proxy -n kube-system -o yaml
|
||||
| sed 's#server:.*#server: https://127.0.0.1:{{ kube_apiserver_port }}#g'
|
||||
| {{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf replace -f -
|
||||
| {{ kubectl }} replace -f -
|
||||
args:
|
||||
executable: /bin/bash
|
||||
run_once: true
|
||||
@@ -139,7 +139,7 @@
|
||||
mode: "0644"
|
||||
|
||||
- name: Restart all kube-proxy pods to ensure that they load the new configmap
|
||||
command: "{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf delete pod -n kube-system -l k8s-app=kube-proxy --force --grace-period=0"
|
||||
command: "{{ kubectl }} delete pod -n kube-system -l k8s-app=kube-proxy --force --grace-period=0"
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane']|first }}"
|
||||
delegate_facts: false
|
||||
|
||||
Reference in New Issue
Block a user