Skip to content

Commit

Permalink
废弃ansible hosts变量SERVICE_PROXY
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Jul 9, 2018
1 parent 2a916c0 commit 5f07276
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/06.kube-router.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Members:
...
```

- 6.ipvs虚拟服务器查看 (roles/kube-router/defaults/main.yml 需配置`SERVICE_PROXY="true"`)
- 6.ipvs虚拟服务器查看 (roles/kube-router/defaults/main.yml 需配置`SERVICE_PROXY: "true"`)

``` bash
# 首先创建测试应用
Expand Down
3 changes: 0 additions & 3 deletions example/hosts.allinone.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ BOOTSTRAP_TOKEN="d18f94b5fa585c7123f56803d925d2e7"
# 集群网络插件,目前支持calico, flannel, kube-router
CLUSTER_NETWORK="flannel"

# 默认使用kube-proxy, 可选SERVICE_PROXY="IPVS" (前提是网络选择kube-router)
SERVICE_PROXY="kube-proxy"

# 服务网段 (Service CIDR),注意不要与内网已有网段冲突
SERVICE_CIDR="10.68.0.0/16"

Expand Down
3 changes: 0 additions & 3 deletions example/hosts.m-masters.example
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ BOOTSTRAP_TOKEN="c30302226d4b810e08731702d3890f50"
# 集群网络插件,目前支持calico, flannel, kube-router
CLUSTER_NETWORK="flannel"

# 默认使用kube-proxy, 可选SERVICE_PROXY="IPVS" (前提是网络选择kube-router)
SERVICE_PROXY="kube-proxy"

# 服务网段 (Service CIDR),注意不要与内网已有网段冲突
SERVICE_CIDR="10.68.0.0/16"

Expand Down
3 changes: 0 additions & 3 deletions example/hosts.s-master.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ BOOTSTRAP_TOKEN="d18f94b5fa585c7123f56803d925d2e7"
# 集群网络插件,目前支持calico, flannel, kube-router
CLUSTER_NETWORK="flannel"

# 默认使用kube-proxy, 可选SERVICE_PROXY="IPVS" (前提是网络选择kube-router)
SERVICE_PROXY="kube-proxy"

# 服务网段 (Service CIDR),注意不要与内网已有网段冲突
SERVICE_CIDR="10.68.0.0/16"

Expand Down
3 changes: 3 additions & 0 deletions roles/kube-node/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 默认使用kube-proxy的 'iptables' 模式,可选 'ipvs' 模式(experimental)
PROXY_MODE: "iptables"

14 changes: 7 additions & 7 deletions roles/kube-router/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
# kube-router 不带service proxy
- name: 准备配置 kube-router DaemonSet (without IPVS)
template: src=kuberouter.yaml.j2 dest=/opt/kube/kube-system/kube-router/kuberouter.yaml
when: 'SERVICE_PROXY == "kube-proxy"'
when: 'SERVICE_PROXY != "true"'

- name: 停止 kube-proxy 服务
shell: "systemctl stop kube-proxy.service; systemctl disable kube-proxy.service"
when: 'SERVICE_PROXY == "IPVS"'
service: name=kube-proxy state=stopped enabled=no
when: 'SERVICE_PROXY == "true"'
ignore_errors: true

- name: 清理 kube-proxy产生的iptables规则
shell: "{{ bin_dir }}/kube-proxy --cleanup"
when: 'SERVICE_PROXY == "IPVS"'
- name: 清理 kube-proxy产生的iptables或ipvs规则
shell: "{{ bin_dir }}/kube-proxy --cleanup; ipvsadm -C"
when: 'SERVICE_PROXY == "true"'
ignore_errors: true

# kube-router 带service proxy (IPVS/LVS)
- name: 准备配置 kube-router DaemonSet (with IPVS)
template: src=kuberouter-all.yaml.j2 dest=/opt/kube/kube-system/kube-router/kuberouter.yaml
when: 'SERVICE_PROXY == "IPVS"'
when: 'SERVICE_PROXY == "true"'

# 【可选】推送离线docker 镜像,可以忽略执行错误
- name: 尝试推送离线docker 镜像(若执行失败,可忽略)
Expand Down

0 comments on commit 5f07276

Please sign in to comment.