Skip to content

Commit

Permalink
fix:nf_conntrack模块安装判断等
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Oct 15, 2021
1 parent 8d24ad9 commit 7b4fd56
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/setup/00-planning_and_overall_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ssh-copy-id $IPs #$IPs为所有节点地址包括自身,按照提示输入yes
``` bash
# 下载工具脚本ezdown,举例使用kubeasz版本3.0.0
export release=3.0.0
curl -C- -fLO --retry 3 https://github.com/easzlab/kubeasz/releases/download/${release}/ezdown
wget https://github.com/easzlab/kubeasz/releases/download/${release}/ezdown
chmod +x ./ezdown
# 使用工具脚本下载
./ezdown -D
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/offline_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kubeasz 2.0.1 开始支持**完全离线安装**,目前已测试 `Ubuntu1604|1

``` bash
export release=3.0.0
curl -C- -fLO --retry 3 https://github.com/easzlab/kubeasz/releases/download/${release}/ezdown
wget https://github.com/easzlab/kubeasz/releases/download/${release}/ezdown
chmod +x ./ezdown
```

Expand Down
2 changes: 1 addition & 1 deletion docs/setup/quickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

``` bash
export release=3.0.0
curl -C- -fLO --retry 3 https://github.com/easzlab/kubeasz/releases/download/${release}/ezdown
wget https://github.com/easzlab/kubeasz/releases/download/${release}/ezdown
chmod +x ./ezdown
```

Expand Down
2 changes: 1 addition & 1 deletion ezctl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ EOF

function new() {
# check if already existed
[[ -d "clusters/$1" ]] && { logger error "cluster:$1 already existed, if cluster:$1 setup failed, try 'rm -rf clusters/$1' first!"; exit 1; }
[[ -d "clusters/$1" ]] && { logger error "cluster:$1 already existed, if cluster:$1 setup failed, try 'rm -rf $BASE/clusters/$1' first!"; exit 1; }

logger debug "generate custom cluster files in $BASE/clusters/$1"
mkdir -p "clusters/$1"
Expand Down
8 changes: 4 additions & 4 deletions ezdown
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ function download_docker() {
logger warn "docker binaries already existed"
else
logger info "downloading docker binaries, version $DOCKER_VER"
if [[ -e /usr/bin/curl ]];then
curl -C- -O --retry 3 "$DOCKER_URL" || { logger error "downloading docker failed"; exit 1; }
if [[ -e /usr/bin/wget ]];then
wget -c --no-check-certificate "$DOCKER_URL" || { logger error "downloading docker failed"; exit 1; }
else
wget -c "$DOCKER_URL" || { logger error "downloading docker failed"; exit 1; }
curl -k -C- -O --retry 3 "$DOCKER_URL" || { logger error "downloading docker failed"; exit 1; }
fi
/bin/mv -f "./docker-$DOCKER_VER.tgz" "$BASE/down"
fi
Expand Down Expand Up @@ -345,7 +345,7 @@ function start_kubeasz_docker() {
fi

# create a link '/usr/bin/python' in Ubuntu1604
if [[ ! -e /usr/bin/python && -e /etc/debian_version ]]; then
if [[ ! -e /usr/bin/python && -e /usr/bin/python3 ]]; then
logger debug "create a soft link '/usr/bin/python'"
ln -s /usr/bin/python3 /usr/bin/python
fi
Expand Down
18 changes: 10 additions & 8 deletions roles/prepare/tasks/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@

- name: 转换内核版本为浮点数
set_fact:
KERNEL_VER: "{{ ansible_kernel.split('-')[0].split('.')[0]|int + ansible_kernel.split('-')[0].split('.')[1]|int/100 }}"
KERNEL_VER: "{{ ansible_kernel.split('-')[0].split('.')[0]|int + ansible_kernel.split('-')[0].split('.')[1]|int/100 }}"

- name: 设置 nf_conntrack 模块名
set_fact: NF_CONNTRACK="nf_conntrack"
when: "KERNEL_VER|float >= 4.19"
#- name: 设置 nf_conntrack 模块名
# set_fact: NF_CONNTRACK="nf_conntrack"
# when: "KERNEL_VER|float >= 4.19"

- name: 设置 nf_conntrack_ipv4 模块名
set_fact: NF_CONNTRACK="nf_conntrack_ipv4"
when: "KERNEL_VER|float < 4.19"
#- name: 设置 nf_conntrack_ipv4 模块名
# set_fact: NF_CONNTRACK="nf_conntrack_ipv4"
# when: "KERNEL_VER|float < 4.19"

# 若提示nf_conntrack_ipv4模块不存在,错误可以忽略
- name: 加载内核模块
modprobe: name={{ item }} state=present
with_items:
Expand All @@ -30,7 +31,8 @@
- ip_vs_rr
- ip_vs_wrr
- ip_vs_sh
- "{{ NF_CONNTRACK }}"
- nf_conntrack
- nf_conntrack_ipv4
ignore_errors: true

- name: 启用systemd自动加载模块服务
Expand Down
3 changes: 2 additions & 1 deletion roles/prepare/templates/10-k8s-modules.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ ip_vs
ip_vs_rr
ip_vs_wrr
ip_vs_sh
{{ NF_CONNTRACK }}
nf_conntrack
nf_conntrack_ipv4

0 comments on commit 7b4fd56

Please sign in to comment.