hostnameOverride on a per-node basis (#3708)
This commit is contained in:
parent
d8e9b0f675
commit
3fafa583d1
3 changed files with 27 additions and 2 deletions
|
@ -28,7 +28,6 @@ cloudProvider: {{ cloud_provider }}
|
|||
kubeProxy:
|
||||
config:
|
||||
mode: {{ kube_proxy_mode }}
|
||||
hostnameOverride: {{ inventory_hostname }}
|
||||
{% if kube_proxy_nodeport_addresses %}
|
||||
nodePortAddresses: [{{ kube_proxy_nodeport_addresses_cidr }}]
|
||||
{% endif %}
|
||||
|
|
|
@ -180,7 +180,6 @@ conntrack:
|
|||
tcpEstablishedTimeout: 24h0m0s
|
||||
enableProfiling: false
|
||||
healthzBindAddress: 0.0.0.0:10256
|
||||
hostnameOverride: {{ inventory_hostname }}
|
||||
iptables:
|
||||
masqueradeAll: false
|
||||
masqueradeBit: 14
|
||||
|
|
|
@ -7,6 +7,33 @@
|
|||
recurse: yes
|
||||
tags: [init, cni]
|
||||
|
||||
- name: Apply kube-proxy hostnameOverride
|
||||
block:
|
||||
- name: Copy kube-proxy daemonset hostnameOverride patch
|
||||
copy:
|
||||
src: hostnameOverride-patch.json
|
||||
dest: "{{ kubernetes_user_manifests_path }}/hostnameOverride-patch.json"
|
||||
|
||||
- name: Check current command for kube-proxy daemonset
|
||||
shell: "{{bin_dir}}/kubectl get ds kube-proxy --namespace=kube-system -o jsonpath='{.spec.template.spec.containers[0].command}'"
|
||||
register: current_kube_proxy_command
|
||||
|
||||
- name: Apply hostnameOverride patch for kube-proxy daemonset
|
||||
shell: "{{bin_dir}}/kubectl patch ds kube-proxy --namespace=kube-system --type=strategic -p \"$(cat hostnameOverride-patch.json)\""
|
||||
args:
|
||||
chdir: "{{ kubernetes_user_manifests_path }}"
|
||||
register: patch_kube_proxy_command
|
||||
when: not current_kube_proxy_command.stdout is search("--hostname-override=${NODE_NAME}")
|
||||
|
||||
- debug: msg={{ patch_kube_proxy_command.stdout_lines }}
|
||||
when: patch_kube_proxy_command is not skipped
|
||||
|
||||
- debug: msg={{ patch_kube_proxy_command.stderr_lines }}
|
||||
when: patch_kube_proxy_command is not skipped
|
||||
tags: init
|
||||
when:
|
||||
- not kube_proxy_remove
|
||||
|
||||
- name: Apply kube-proxy nodeselector
|
||||
block:
|
||||
- name: Copy kube-proxy daemonset nodeselector patch
|
||||
|
|
Loading…
Reference in a new issue