Ensure kubeadm doesn't use proxy (#7275)

* Move proxy_env to kubespray-defaults/defaults

There is no reasons to use set_facts here

Signed-off-by: Etienne Champetier <e.champetier@ateme.com>

* Ensure kubeadm doesn't use proxy

*_proxy variables might be present in the environment (/etc/environment, bash profile, ...)
When this is the case we end up with those proxy configuration in /etc/kubernetes/manifests/kube-*.yaml manifests

We cannot unset env variables, but kubeadm is nice enough to ignore empty vars
93d288e2a4/cmd/kubeadm/app/util/env.go (L27)

Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
This commit is contained in:
Etienne Champetier
2021-02-16 11:44:58 -05:00
committed by GitHub
parent f2d10e9465
commit 1c5391dda7
11 changed files with 34 additions and 19 deletions

View File

@@ -42,6 +42,7 @@
- name: Create kubeadm token for joining nodes with 24h expiration (default)
command: "{{ bin_dir }}/kubeadm token create"
environment: "{{ proxy_disable_env }}"
register: temp_token
delegate_to: "{{ groups['kube-master'][0] }}"
when: kubeadm_token is not defined
@@ -54,6 +55,7 @@
- name: Get the kubeadm version
command: "{{ bin_dir }}/kubeadm version -o short"
environment: "{{ proxy_disable_env }}"
register: kubeadm_output
changed_when: false
@@ -69,8 +71,7 @@
when: not is_kube_master
- name: Join to cluster if needed
environment:
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
environment: '{{ proxy_disable_env | combine({"PATH": "{{ bin_dir }}:{{ ansible_env.PATH }}:/sbin"}) }}'
when: not is_kube_master and (not kubelet_conf.stat.exists)
block: