fix: kubelet 1.15 删除参数--allow-privileged

pull/641/head
gjmzj 2019-06-30 21:23:38 +08:00
parent 846f81668e
commit ccb5686e82
2 changed files with 18 additions and 0 deletions

View File

@ -76,6 +76,22 @@
set_fact: CLUSTER_DNS_SVC_IP={{ DNS_SVC_IP.stdout }}
tags: restart_node
# 判断 kubernetes 版本
- name: 注册变量 TMP_VER
shell: "{{ base_dir }}/bin/kubelet --version|cut -d' ' -f2|cut -d'v' -f2"
register: TMP_VER
connection: local
run_once: true
tags: restart_node
- name: 获取 kubernetes 主版本号
set_fact:
KUBE_VER: "{{ TMP_VER.stdout.split('.')[0]|int + TMP_VER.stdout.split('.')[1]|int/100 }}"
tags: restart_node
- name: debug info
debug: var="KUBE_VER"
- name: 创建kubelet的systemd unit文件
template: src=kubelet.service.j2 dest=/etc/systemd/system/kubelet.service
tags: restart_node

View File

@ -12,7 +12,9 @@ ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/pids/system.slice/kubelet.service
{% endif %}
ExecStart={{ bin_dir }}/kubelet \
--address={{ inventory_hostname }} \
{% if KUBE_VER|float < 1.15 %}
--allow-privileged=true \
{% endif %}
--anonymous-auth=false \
--authentication-token-webhook \
--authorization-mode=Webhook \