kubeasz/roles/prepare/tasks/common.yml

33 lines
765 B
YAML

# 禁用系统swap
- name: 禁用系统 swap
shell: "swapoff -a && sysctl -w vm.swappiness=0"
ignore_errors: true
- name: 删除fstab swap 相关配置
lineinfile:
path: /etc/fstab
regexp: 'swap'
state: absent
backup: 'yes'
# 设置系统参数for k8s
# 消除docker info 警告WARNING: bridge-nf-call-ip[6]tables is disabled
- name: 设置系统参数
template: src=95-k8s-sysctl.conf.j2 dest=/etc/sysctl.d/95-k8s-sysctl.conf
- name: 生效系统参数
shell: "sysctl -p /etc/sysctl.d/95-k8s-sysctl.conf"
ignore_errors: true
- name: 加载内核模块
modprobe: name={{ item }} state=present
with_items:
- br_netfilter
- ip_vs
- ip_vs_rr
- ip_vs_wrr
- ip_vs_sh
- nf_conntrack_ipv4
ignore_errors: true