Adjust endpoints for kube-proxy,controller,scheduler to proper ip (#5150)

Change-Id: I5aa009358bee7035922b5a10327997e47c9ba434
This commit is contained in:
Matthew Mosesohn 2019-09-09 20:33:20 +03:00 committed by Kubernetes Prow Robot
parent 5f02068f90
commit 9b0f57a0a6
3 changed files with 19 additions and 1 deletions

View file

@ -104,10 +104,12 @@
- kubeadm_discovery_address != kube_apiserver_endpoint | replace("https://", "") - kubeadm_discovery_address != kube_apiserver_endpoint | replace("https://", "")
notify: restart kubelet notify: restart kubelet
# FIXME(mattymo): Need to point to localhost, otherwise masters will all point
# incorrectly to first master, creating SPoF.
- name: Update server field in kube-proxy kubeconfig - name: Update server field in kube-proxy kubeconfig
shell: >- shell: >-
{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf get configmap kube-proxy -n kube-system -o yaml {{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf get configmap kube-proxy -n kube-system -o yaml
| sed 's#server:.*#server:\ {{ kube_apiserver_endpoint }}#g' | sed 's#server:.*#server: https://127.0.0.1:{{ kube_apiserver_port }}#g'
| {{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf replace -f - | {{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf replace -f -
run_once: true run_once: true
when: when:

View file

@ -0,0 +1,13 @@
---
- name: Update server field in component kubeconfigs
lineinfile:
dest: "{{ kube_config_dir }}/{{ item }}.conf"
regexp: 'server:'
line: ' server: {{ kube_apiserver_endpoint }}'
backup: yes
with_items:
- controller-manager
- scheduler
when:
- not loadbalancer_apiserver is defined
notify: "Master | Restart kube-{{ item }}"

View file

@ -73,3 +73,6 @@
- name: Include kubeadm etcd extra tasks - name: Include kubeadm etcd extra tasks
include_tasks: kubeadm-etcd.yml include_tasks: kubeadm-etcd.yml
when: etcd_kubeadm_enabled when: etcd_kubeadm_enabled
- name: Include kubeadm secondary server apiserver fixes
include_tasks: kubeadm-fix-apiserver.yml