Merge pull request #4027 from riverzhang/kube-proxy
Add update server field in kube-proxy kubeconfig
This commit is contained in:
commit
d4a36aa55b
2 changed files with 30 additions and 3 deletions
|
@ -21,9 +21,9 @@ bin_dir: /usr/local/bin
|
||||||
## Internal loadbalancers for apiservers
|
## Internal loadbalancers for apiservers
|
||||||
#loadbalancer_apiserver_localhost: true
|
#loadbalancer_apiserver_localhost: true
|
||||||
|
|
||||||
## Local loadbalancer should use this port instead, if defined.
|
## Local loadbalancer should use this port
|
||||||
## Defaults to kube_apiserver_port (6443)
|
## And must be set port 6443
|
||||||
#nginx_kube_apiserver_port: 8443
|
nginx_kube_apiserver_port: 6443
|
||||||
|
|
||||||
### OTHER OPTIONAL VARIABLES
|
### OTHER OPTIONAL VARIABLES
|
||||||
## For some things, kubelet needs to load kernel modules. For example, dynamic kernel services are needed
|
## For some things, kubelet needs to load kernel modules. For example, dynamic kernel services are needed
|
||||||
|
|
|
@ -116,6 +116,33 @@
|
||||||
- kubeadm_discovery_address != kube_apiserver_endpoint
|
- kubeadm_discovery_address != kube_apiserver_endpoint
|
||||||
notify: restart kubelet
|
notify: restart kubelet
|
||||||
|
|
||||||
|
- 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'
|
||||||
|
| {{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf replace -f -
|
||||||
|
delegate_to: "{{groups['kube-master']|first}}"
|
||||||
|
run_once: true
|
||||||
|
when:
|
||||||
|
- kubeadm_config_api_fqdn is not defined
|
||||||
|
- is_kube_master
|
||||||
|
- kubeadm_discovery_address != kube_apiserver_endpoint
|
||||||
|
- not kube_proxy_remove
|
||||||
|
tags:
|
||||||
|
- kube-proxy
|
||||||
|
|
||||||
|
- name: Restart all kube-proxy pods to ensure that they load the new configmap
|
||||||
|
shell: "{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf delete pod -n kube-system -l k8s-app=kube-proxy"
|
||||||
|
delegate_to: "{{groups['kube-master']|first}}"
|
||||||
|
run_once: true
|
||||||
|
when:
|
||||||
|
- kubeadm_config_api_fqdn is not defined
|
||||||
|
- is_kube_master
|
||||||
|
- kubeadm_discovery_address != kube_apiserver_endpoint
|
||||||
|
- not kube_proxy_remove
|
||||||
|
tags:
|
||||||
|
- kube-proxy
|
||||||
|
|
||||||
# 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