Skip to content

Commit

Permalink
fix网络组件偶尔连不上svc kubernetes的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Sep 21, 2018
1 parent 51b1003 commit c366125
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions roles/calico/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 部分calico相关配置,更全配置可以去roles/calico/templates/calico.yaml.j2自定义

# 如果 node 节点有多块网卡,请设置 true
# 另外发现设置为 true 时能够解决v1.10使用ipvs偶尔出现pod内‘dial tcp 10.68.0.1:443: i/o timeout’的 bug
NODE_WITH_MULTIPLE_NETWORKS: "true"

# etcd 集群服务地址列表, 根据etcd组成员自动生成
Expand Down
4 changes: 4 additions & 0 deletions roles/cilium/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 部分cilium相关配置, Note: cilium 需要Linux kernel >= 4.9.17

# 如果 node 节点有多块网卡,请设置 true
# 另外发现设置为 true 时能够解决v1.10使用ipvs偶尔出现pod内‘dial tcp 10.68.0.1:443: i/o timeout’的 bug
NODE_WITH_MULTIPLE_NETWORKS: "true"

# debug mode
Debug_Mode: "false"

Expand Down
8 changes: 8 additions & 0 deletions roles/cilium/templates/cilium.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ spec:
name: cilium-config
key: sidecar-istio-proxy-image
optional: true
{% if NODE_WITH_MULTIPLE_NETWORKS == 'true' %}
# if hosts have multiple net interfaces, set following two ENVs
- name: KUBERNETES_SERVICE_HOST
value: "{{ MASTER_IP }}"
#value: "{{ KUBE_APISERVER.split(':')[1].lstrip('/') }}"
- name: KUBERNETES_SERVICE_PORT
value: "{{ KUBE_APISERVER.split(':')[2] }}"
{% endif %}
livenessProbe:
exec:
command:
Expand Down
4 changes: 4 additions & 0 deletions roles/kube-router/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更多设置,参考https://github.com/cloudnativelabs/kube-router/blob/master/docs/user-guide.md

# 如果 node 节点有多块网卡,请设置 true
# 另外发现设置为 true 时能够解决v1.10使用ipvs偶尔出现pod内‘dial tcp 10.68.0.1:443: i/o timeout’的 bug
NODE_WITH_MULTIPLE_NETWORKS: "true"

# Router 支持开关
ROUTER_ENABLE: "true"

Expand Down
8 changes: 8 additions & 0 deletions roles/kube-router/templates/kuberouter-all.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{% if NODE_WITH_MULTIPLE_NETWORKS == 'true' %}
# if hosts have multiple net interfaces, set following two ENVs
- name: KUBERNETES_SERVICE_HOST
value: "{{ MASTER_IP }}"
#value: "{{ KUBE_APISERVER.split(':')[1].lstrip('/') }}"
- name: KUBERNETES_SERVICE_PORT
value: "{{ KUBE_APISERVER.split(':')[2] }}"
{% endif %}
livenessProbe:
httpGet:
path: /healthz
Expand Down
8 changes: 8 additions & 0 deletions roles/kube-router/templates/kuberouter.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{% if NODE_WITH_MULTIPLE_NETWORKS == 'true' %}
# if hosts have multiple net interfaces, set following two ENVs
- name: KUBERNETES_SERVICE_HOST
value: "{{ MASTER_IP }}"
#value: "{{ KUBE_APISERVER.split(':')[1].lstrip('/') }}"
- name: KUBERNETES_SERVICE_PORT
value: "{{ KUBE_APISERVER.split(':')[2] }}"
{% endif %}
livenessProbe:
httpGet:
path: /healthz
Expand Down

0 comments on commit c366125

Please sign in to comment.