Adjust endpoints for kube-proxy,controller,scheduler to proper ip (#5150)
Change-Id: I5aa009358bee7035922b5a10327997e47c9ba434
This commit is contained in:
parent
5f02068f90
commit
9b0f57a0a6
3 changed files with 19 additions and 1 deletions
|
@ -104,10 +104,12 @@
|
|||
- kubeadm_discovery_address != kube_apiserver_endpoint | replace("https://", "")
|
||||
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
|
||||
shell: >-
|
||||
{{ 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 -
|
||||
run_once: true
|
||||
when:
|
||||
|
|
13
roles/kubernetes/master/tasks/kubeadm-fix-apiserver.yml
Normal file
13
roles/kubernetes/master/tasks/kubeadm-fix-apiserver.yml
Normal 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 }}"
|
|
@ -73,3 +73,6 @@
|
|||
- name: Include kubeadm etcd extra tasks
|
||||
include_tasks: kubeadm-etcd.yml
|
||||
when: etcd_kubeadm_enabled
|
||||
|
||||
- name: Include kubeadm secondary server apiserver fixes
|
||||
include_tasks: kubeadm-fix-apiserver.yml
|
||||
|
|
Loading…
Reference in a new issue