mirror of https://github.com/easzlab/kubeasz.git
rewrite kubelet installation for different systems
parent
f2f62f347d
commit
9acff29630
|
@ -30,9 +30,7 @@ Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
|||
|
||||
[Service]
|
||||
WorkingDirectory=/var/lib/kubelet
|
||||
{% if ansible_distribution == "Debian" and ansible_distribution_version|int >= 10 %}
|
||||
ExecStartPre=/bin/mount -o remount,rw '/sys/fs/cgroup'
|
||||
{% endif %}
|
||||
{% if KUBE_RESERVED_ENABLED == "yes" or SYS_RESERVED_ENABLED == "yes" %}
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/cpu/podruntime.slice
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/cpuacct/podruntime.slice
|
||||
|
@ -48,11 +46,9 @@ ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/memory/system.slice
|
|||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/pids/system.slice
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/systemd/system.slice
|
||||
|
||||
{% if ansible_distribution != "Debian" %}
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/hugetlb/podruntime.slice
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/hugetlb/system.slice
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
ExecStart={{ bin_dir }}/kubelet \
|
||||
--config=/var/lib/kubelet/config.yaml \
|
||||
--container-runtime-endpoint=unix:///run/containerd/containerd.sock \
|
||||
|
|
|
@ -38,6 +38,20 @@
|
|||
template: src=kubelet-config.yaml.j2 dest=/var/lib/kubelet/config.yaml
|
||||
tags: upgrade_k8s, restart_node
|
||||
|
||||
- name: 检查文件/run/systemd/resolve/resolv.conf
|
||||
stat: path="/run/systemd/resolve/resolv.conf"
|
||||
register: resolv
|
||||
tags: upgrade_k8s, restart_node
|
||||
|
||||
- name: 替换resolvConf 配置
|
||||
lineinfile:
|
||||
dest: /var/lib/kubelet/config.yaml
|
||||
state: present
|
||||
regexp: 'resolvConf'
|
||||
line: 'resolvConf: /run/systemd/resolve/resolv.conf'
|
||||
when: "resolv.stat.isreg is defined"
|
||||
tags: upgrade_k8s, restart_node
|
||||
|
||||
- name: 创建kubelet的systemd unit文件
|
||||
template: src=kubelet.service.j2 dest=/etc/systemd/system/kubelet.service
|
||||
tags: upgrade_k8s, restart_node
|
||||
|
|
|
@ -71,11 +71,7 @@ podPidsLimit: {{ POD_MAX_PIDS }}
|
|||
port: 10250
|
||||
# disable readOnlyPort
|
||||
readOnlyPort: 0
|
||||
{% if ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int > 16 %}
|
||||
resolvConf: /run/systemd/resolve/resolv.conf
|
||||
{% else %}
|
||||
resolvConf: /etc/resolv.conf
|
||||
{% endif %}
|
||||
runtimeRequestTimeout: 2m0s
|
||||
serializeImagePulls: true
|
||||
streamingConnectionIdleTimeout: 4h0m0s
|
||||
|
|
|
@ -4,9 +4,7 @@ Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
|||
|
||||
[Service]
|
||||
WorkingDirectory=/var/lib/kubelet
|
||||
{% if ansible_distribution == "Debian" and ansible_distribution_version|int >= 10 %}
|
||||
ExecStartPre=/bin/mount -o remount,rw '/sys/fs/cgroup'
|
||||
{% endif %}
|
||||
{% if KUBE_RESERVED_ENABLED == "yes" or SYS_RESERVED_ENABLED == "yes" %}
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/cpu/podruntime.slice
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/cpuacct/podruntime.slice
|
||||
|
@ -22,11 +20,9 @@ ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/memory/system.slice
|
|||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/pids/system.slice
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/systemd/system.slice
|
||||
|
||||
{% if ansible_distribution != "Debian" %}
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/hugetlb/podruntime.slice
|
||||
ExecStartPre=/bin/mkdir -p /sys/fs/cgroup/hugetlb/system.slice
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
ExecStart={{ bin_dir }}/kubelet \
|
||||
--config=/var/lib/kubelet/config.yaml \
|
||||
--container-runtime-endpoint=unix:///run/containerd/containerd.sock \
|
||||
|
|
Loading…
Reference in New Issue