Skip to content

Commit

Permalink
转移calico/flannel的配置到对应的roles目录
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgao1983 committed Jun 9, 2018
1 parent e45a023 commit 2340b9f
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 46 deletions.
11 changes: 1 addition & 10 deletions example/hosts.allinone.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,14 @@ DEPLOY_MODE=allinone
MASTER_IP="192.168.1.1"

#集群 APISERVER
KUBE_APISERVER="https://192.168.1.1:6443"
KUBE_APISERVER="https://{{ MASTER_IP }}:6443"

#TLS Bootstrapping 使用的 Token,使用 head -c 16 /dev/urandom | od -An -t x | tr -d ' ' 生成
BOOTSTRAP_TOKEN="d18f94b5fa585c7123f56803d925d2e7"

# 集群网络插件,目前支持calico和flannel
CLUSTER_NETWORK="flannel"

# 部分calico相关配置,更全配置可以去roles/calico/templates/calico.yaml.j2自定义
# 设置 CALICO_IPV4POOL_IPIP=“off”,可以提高网络性能,条件限制详见 05.安装calico网络组件.md
CALICO_IPV4POOL_IPIP="always"
# 设置 calico-node使用的host IP,bgp邻居通过该地址建立,可手动指定端口"interface=eth0"或使用如下自动发现
IP_AUTODETECTION_METHOD="can-reach=223.5.5.5"

# 部分flannel配置,详见roles/flannel/templates/kube-flannel.yaml.j2
FLANNEL_BACKEND="vxlan"

# 服务网段 (Service CIDR),部署前路由不可达,部署后集群内使用 IP:Port 可达
SERVICE_CIDR="10.68.0.0/16"

Expand Down
11 changes: 1 addition & 10 deletions example/hosts.m-masters.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,14 @@ DEPLOY_MODE=multi-master

#集群 MASTER IP即 LB节点VIP地址,为区别与默认apiserver端口,设置VIP监听的服务端口8443
MASTER_IP="192.168.1.10"
KUBE_APISERVER="https://192.168.1.10:8443"
KUBE_APISERVER="https://{{ MASTER_IP }}:8443"

#TLS Bootstrapping 使用的 Token,使用 head -c 16 /dev/urandom | od -An -t x | tr -d ' ' 生成
BOOTSTRAP_TOKEN="c30302226d4b810e08731702d3890f50"

# 集群网络插件,目前支持calico和flannel
CLUSTER_NETWORK="flannel"

# 部分calico相关配置,更全配置可以去roles/calico/templates/calico.yaml.j2自定义
# 设置 CALICO_IPV4POOL_IPIP=“off”,可以提高网络性能,条件限制详见 05.安装calico网络组件.md
CALICO_IPV4POOL_IPIP="always"
# 设置 calico-node使用的host IP,bgp邻居通过该地址建立,可手动指定端口"interface=eth0"或使用如下自动发现
IP_AUTODETECTION_METHOD="can-reach=223.5.5.5"

# 部分flannel配置,详见roles/flannel/templates/kube-flannel.yaml.j2
FLANNEL_BACKEND="vxlan"

# 服务网段 (Service CIDR),部署前路由不可达,部署后集群内使用 IP:Port 可达
SERVICE_CIDR="10.68.0.0/16"

Expand Down
11 changes: 1 addition & 10 deletions example/hosts.s-master.example
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,14 @@ DEPLOY_MODE=single-master
MASTER_IP="192.168.1.1"

#集群 APISERVER
KUBE_APISERVER="https://192.168.1.1:6443"
KUBE_APISERVER="https://{{ MASTER_IP }}:6443"

#TLS Bootstrapping 使用的 Token,使用 head -c 16 /dev/urandom | od -An -t x | tr -d ' ' 生成
BOOTSTRAP_TOKEN="d18f94b5fa585c7123f56803d925d2e7"

# 集群网络插件,目前支持calico和flannel
CLUSTER_NETWORK="flannel"

# 部分calico相关配置,更全配置可以去roles/calico/templates/calico.yaml.j2自定义
# 设置 CALICO_IPV4POOL_IPIP=“off”,可以提高网络性能,条件限制详见 05.安装calico网络组件.md
CALICO_IPV4POOL_IPIP="always"
# 设置 calico-node使用的host IP,bgp邻居通过该地址建立,可手动指定端口"interface=eth0"或使用如下自动发现
IP_AUTODETECTION_METHOD="can-reach=223.5.5.5"

# 部分flannel配置,详见roles/flannel/templates/kube-flannel.yaml.j2
FLANNEL_BACKEND="vxlan"

# 服务网段 (Service CIDR),部署前路由不可达,部署后集群内使用 IP:Port 可达
SERVICE_CIDR="10.68.0.0/16"

Expand Down
17 changes: 17 additions & 0 deletions roles/calico/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 部分calico相关配置,更全配置可以去roles/calico/templates/calico.yaml.j2自定义

# 设置 CALICO_IPV4POOL_IPIP=“off”,可以提高网络性能,条件限制详见 05.安装calico网络组件.md
CALICO_IPV4POOL_IPIP: "always"

# 设置 Felix 日志级别
FELIX_LOG_LVL: "warning"

# 设置 calico-node使用的host IP,bgp邻居通过该地址建立,可手工指定也可以自动发现
#IP_AUTODETECTION_METHOD: "interface=eth0"
IP_AUTODETECTION_METHOD: "can-reach={{ MASTER_IP }}"

calico_node_ver: "v3.0.6"

calico_cni_ver: "v2.0.5"

calico_kube_controller_ver: "v2.0.4"
24 changes: 12 additions & 12 deletions roles/calico/templates/calico.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Calico Version v3.0.6
# https://docs.projectcalico.org/v3.0/releases#v3.0.6
# Calico Version {{ calico_node_ver }}
# https://docs.projectcalico.org/v3.0/releases#{{ calico_node_ver }}
# This manifest includes the following component versions:
# calico/node:v3.0.6
# calico/cni:v2.0.5
# calico/kube-controllers:v2.0.4
# calico/node:{{ calico_node_ver }}
# calico/cni:{{ calico_cni_ver }}
# calico/kube-controllers:{{ calico_kube_controller_ver }}

# This ConfigMap is used to configure a self-hosted Calico installation.
kind: ConfigMap
Expand Down Expand Up @@ -102,8 +102,8 @@ spec:
# container programs network policy and routes on each
# host.
- name: calico-node
#image: quay.io/calico/node:v3.0.6
image: calico/node:v3.0.6
#image: quay.io/calico/node:{{ calico_node_ver }}
image: calico/node:{{ calico_node_ver }}
env:
# The location of the Calico etcd cluster.
- name: ETCD_ENDPOINTS
Expand Down Expand Up @@ -141,7 +141,7 @@ spec:
value: "false"
# Set Felix logging to "warning"
- name: FELIX_LOGSEVERITYSCREEN
value: "warning"
value: {{ FELIX_LOG_LVL }}
# Set MTU for tunnel device used if ipip is enabled
- name: FELIX_IPINIPMTU
value: "1440"
Expand Down Expand Up @@ -199,8 +199,8 @@ spec:
# This container installs the Calico CNI binaries
# and CNI network config file on each node.
- name: install-cni
#image: quay.io/calico/cni:v2.0.5
image: calico/cni:v2.0.5
#image: quay.io/calico/cni:{{ calico_cni_ver }}
image: calico/cni:{{ calico_cni_ver }}
command: ["/install-cni.sh"]
env:
# Name of the CNI config file to create.
Expand Down Expand Up @@ -282,8 +282,8 @@ spec:
serviceAccountName: calico-kube-controllers
containers:
- name: calico-kube-controllers
#image: quay.io/calico/kube-controllers:v2.0.4
image: calico/kube-controllers:v2.0.4
#image: quay.io/calico/kube-controllers:{{ calico_kube_controller_ver }}
image: calico/kube-controllers:{{ calico_kube_controller_ver }}
env:
# The location of the Calico etcd cluster.
- name: ETCD_ENDPOINTS
Expand Down
11 changes: 11 additions & 0 deletions roles/flannel/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 部分flannel配置,详见roles/flannel/templates/kube-flannel.yaml.j2

# 设置flannel 后端
#FLANNEL_BACKEND: "host-gw"
FLANNEL_BACKEND: "vxlan"

#install_cni_image: "quay.io/coreos/flannel:v0.10.0-amd64"
install_cni_image: "jmgao1983/flannel:v0.10.0-amd64"

#flanneld_image: "quay.io/coreos/flannel:v0.10.0-amd64"
flanneld_image: "jmgao1983/flannel:v0.10.0-amd64"
6 changes: 2 additions & 4 deletions roles/flannel/templates/kube-flannel.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ spec:
serviceAccountName: flannel
initContainers:
- name: install-cni
image: jmgao1983/flannel:v0.10.0-amd64
#image: quay.io/coreos/flannel:v0.10.0-amd64
image: {{ install_cni_image }}
command:
- cp
args:
Expand All @@ -119,8 +118,7 @@ spec:
mountPath: /etc/kube-flannel/
containers:
- name: kube-flannel
#image: quay.io/coreos/flannel:v0.10.0-amd64
image: jmgao1983/flannel:v0.10.0-amd64
image: {{ flanneld_image }}
command:
- /opt/bin/flanneld
args:
Expand Down

0 comments on commit 2340b9f

Please sign in to comment.