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

dev1
gjmzj 2019-07-21 16:17:31 +08:00
parent f50779bade
commit 1a7deaf9ad
2 changed files with 17 additions and 0 deletions

View File

@ -99,6 +99,21 @@
set_fact: CLUSTER_DNS_SVC_IP={{ DNS_SVC_IP.stdout }}
tags: restart_node
# 判断 kubernetes 版本
- name: 注册变量 TMP_VER
shell: "{{ base_dir }}/bin/kube-apiserver --version|cut -d' ' -f2|cut -d'v' -f2"
register: TMP_VER
connection: local
tags: upgrade_k8s, restart_node
- name: 获取 kubernetes 主版本号
set_fact:
KUBE_VER: "{{ TMP_VER.stdout.split('.')[0]|int + TMP_VER.stdout.split('.')[1]|int/100 }}"
tags: upgrade_k8s, 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: upgrade_k8s, 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.13 %}
--allow-privileged=true \
{% endif %}
--anonymous-auth=false \
--authentication-token-webhook \
--authorization-mode=Webhook \