Merge pull request #2872 from riverzhang/kube-proxy
Reconfigure kube-proxy to access kube-apiserver via the LB(kubeadm)
This commit is contained in:
commit
f2c160e7e0
1 changed files with 15 additions and 1 deletions
|
@ -7,7 +7,6 @@
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ kube_apiserver_endpoint }}
|
{{ kube_apiserver_endpoint }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
when: not is_kube_master
|
|
||||||
tags:
|
tags:
|
||||||
- facts
|
- facts
|
||||||
|
|
||||||
|
@ -61,6 +60,21 @@
|
||||||
when: not is_kube_master and kubeadm_discovery_address != kube_apiserver_endpoint
|
when: not is_kube_master and kubeadm_discovery_address != kube_apiserver_endpoint
|
||||||
notify: restart kubelet
|
notify: restart kubelet
|
||||||
|
|
||||||
|
- name: Update server field in kube-proxy kubeconfig
|
||||||
|
shell: >-
|
||||||
|
{{ bin_dir }}/kubectl get configmap kube-proxy -n kube-system -o yaml
|
||||||
|
| sed 's#server:.*#server:\ {{ kube_apiserver_endpoint }}#g'
|
||||||
|
| kubectl replace -f -
|
||||||
|
delegate_to: "{{groups['kube-master']|first}}"
|
||||||
|
run_once: true
|
||||||
|
when: is_kube_master and kubeadm_discovery_address != kube_apiserver_endpoint
|
||||||
|
|
||||||
|
- name: Restart all kube-proxy pods to ensure that they load the new configmap
|
||||||
|
shell: "{{ bin_dir }}/kubectl delete pod -n kube-system -l k8s-app=kube-proxy"
|
||||||
|
delegate_to: "{{groups['kube-master']|first}}"
|
||||||
|
run_once: true
|
||||||
|
when: is_kube_master and kubeadm_discovery_address != kube_apiserver_endpoint
|
||||||
|
|
||||||
# FIXME(mattymo): Reconcile kubelet kubeconfig filename for both deploy modes
|
# FIXME(mattymo): Reconcile kubelet kubeconfig filename for both deploy modes
|
||||||
- name: Symlink kubelet kubeconfig for calico/canal
|
- name: Symlink kubelet kubeconfig for calico/canal
|
||||||
file:
|
file:
|
||||||
|
|
Loading…
Reference in a new issue