2017-11-11 19:14:21 +08:00
|
|
|
|
# 部署节点:运行这份 ansible 脚本的节点
|
|
|
|
|
[deploy]
|
2017-11-30 15:01:24 +08:00
|
|
|
|
192.168.1.1
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
2018-02-25 12:30:15 +08:00
|
|
|
|
# etcd集群请提供如下NODE_NAME、NODE_IP变量,注意etcd集群必须是1,3,5,7...奇数个节点
|
2017-11-11 19:14:21 +08:00
|
|
|
|
[etcd]
|
2017-11-30 15:01:24 +08:00
|
|
|
|
192.168.1.1 NODE_NAME=etcd1 NODE_IP="192.168.1.1"
|
|
|
|
|
192.168.1.2 NODE_NAME=etcd2 NODE_IP="192.168.1.2"
|
|
|
|
|
192.168.1.3 NODE_NAME=etcd3 NODE_IP="192.168.1.3"
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
|
|
|
|
[kube-master]
|
2017-11-30 15:01:24 +08:00
|
|
|
|
192.168.1.1 NODE_IP="192.168.1.1"
|
|
|
|
|
192.168.1.2 NODE_IP="192.168.1.2"
|
2017-11-21 09:26:51 +08:00
|
|
|
|
|
|
|
|
|
# 负载均衡至少两个节点,安装 haproxy+keepalived
|
|
|
|
|
[lb]
|
2018-03-02 15:16:40 +08:00
|
|
|
|
192.168.1.1 LB_IF="eth0" LB_ROLE=backup # 注意根据实际使用网卡设置 LB_IF变量
|
2017-11-30 15:01:24 +08:00
|
|
|
|
192.168.1.2 LB_IF="eth0" LB_ROLE=master
|
2017-11-21 09:26:51 +08:00
|
|
|
|
[lb:vars]
|
2018-03-02 15:16:40 +08:00
|
|
|
|
master1="192.168.1.1:6443" # 根据实际master节点数量设置
|
|
|
|
|
master2="192.168.1.2:6443" # 需同步设置roles/lb/templates/haproxy.cfg.j2
|
|
|
|
|
#master3="192.168.1.x:6443"
|
2018-03-09 22:29:39 +08:00
|
|
|
|
ROUTER_ID=57 # 取值在0-255之间,区分多个instance的VRRP组播,同网段不能重复
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
|
|
|
|
[kube-node]
|
2018-03-14 16:53:21 +08:00
|
|
|
|
192.168.1.2 NODE_IP="192.168.1.2"
|
|
|
|
|
192.168.1.3 NODE_IP="192.168.1.3"
|
|
|
|
|
192.168.1.4 NODE_IP="192.168.1.4"
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
2017-12-25 15:05:21 +08:00
|
|
|
|
# 如果启用harbor,请配置后面harbor相关参数
|
|
|
|
|
[harbor]
|
2017-12-26 15:52:35 +08:00
|
|
|
|
#192.168.1.8 NODE_IP="192.168.1.8"
|
2017-12-25 15:05:21 +08:00
|
|
|
|
|
2018-03-18 22:51:05 +08:00
|
|
|
|
# 预留组,后续添加master节点使用
|
|
|
|
|
[new-master]
|
|
|
|
|
#192.168.1.5 NODE_IP="192.168.1.5"
|
|
|
|
|
|
2017-11-25 21:37:43 +08:00
|
|
|
|
# 预留组,后续添加node节点使用
|
|
|
|
|
[new-node]
|
2018-03-14 16:53:21 +08:00
|
|
|
|
#192.168.1.xx NODE_IP="192.168.1.xx"
|
2017-11-25 21:37:43 +08:00
|
|
|
|
|
2017-11-21 09:26:51 +08:00
|
|
|
|
[all:vars]
|
2017-11-11 19:14:21 +08:00
|
|
|
|
# ---------集群主要参数---------------
|
2018-03-16 18:23:34 +08:00
|
|
|
|
#集群部署模式:allinone, single-master, multi-master
|
|
|
|
|
DEPLOY_MODE=multi-master
|
|
|
|
|
|
2018-04-17 21:14:03 +08:00
|
|
|
|
#集群 MASTER IP即 LB节点VIP地址,为区别与默认apiserver端口,设置VIP监听的服务端口8443
|
2017-11-30 15:01:24 +08:00
|
|
|
|
MASTER_IP="192.168.1.10"
|
|
|
|
|
KUBE_APISERVER="https://192.168.1.10:8443"
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
|
|
|
|
#TLS Bootstrapping 使用的 Token,使用 head -c 16 /dev/urandom | od -An -t x | tr -d ' ' 生成
|
2017-11-21 09:26:51 +08:00
|
|
|
|
BOOTSTRAP_TOKEN="c30302226d4b810e08731702d3890f50"
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
2018-01-02 22:12:51 +08:00
|
|
|
|
# 集群网络插件,目前支持calico和flannel
|
2018-02-25 12:30:15 +08:00
|
|
|
|
CLUSTER_NETWORK="flannel"
|
2018-01-02 22:12:51 +08:00
|
|
|
|
|
2018-01-04 22:00:34 +08:00
|
|
|
|
# 部分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"
|
|
|
|
|
|
2018-01-04 22:50:09 +08:00
|
|
|
|
# 部分flannel配置,详见roles/flannel/templates/kube-flannel.yaml.j2
|
|
|
|
|
FLANNEL_BACKEND="vxlan"
|
|
|
|
|
|
2017-11-11 19:14:21 +08:00
|
|
|
|
# 服务网段 (Service CIDR),部署前路由不可达,部署后集群内使用 IP:Port 可达
|
|
|
|
|
SERVICE_CIDR="10.68.0.0/16"
|
|
|
|
|
|
2017-11-30 15:01:24 +08:00
|
|
|
|
# POD 网段 (Cluster CIDR),部署前路由不可达,**部署后**路由可达
|
2017-11-11 19:14:21 +08:00
|
|
|
|
CLUSTER_CIDR="172.20.0.0/16"
|
|
|
|
|
|
|
|
|
|
# 服务端口范围 (NodePort Range)
|
2017-12-17 17:48:44 +08:00
|
|
|
|
NODE_PORT_RANGE="20000-40000"
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
|
|
|
|
# kubernetes 服务 IP (预分配,一般是 SERVICE_CIDR 中第一个IP)
|
|
|
|
|
CLUSTER_KUBERNETES_SVC_IP="10.68.0.1"
|
|
|
|
|
|
|
|
|
|
# 集群 DNS 服务 IP (从 SERVICE_CIDR 中预分配)
|
|
|
|
|
CLUSTER_DNS_SVC_IP="10.68.0.2"
|
|
|
|
|
|
|
|
|
|
# 集群 DNS 域名
|
|
|
|
|
CLUSTER_DNS_DOMAIN="cluster.local."
|
|
|
|
|
|
|
|
|
|
# etcd 集群间通信的IP和端口, **根据实际 etcd 集群成员设置**
|
2017-11-30 15:01:24 +08:00
|
|
|
|
ETCD_NODES="etcd1=https://192.168.1.1:2380,etcd2=https://192.168.1.2:2380,etcd3=https://192.168.1.3:2380"
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
|
|
|
|
# etcd 集群服务地址列表, **根据实际 etcd 集群成员设置**
|
2017-11-30 15:01:24 +08:00
|
|
|
|
ETCD_ENDPOINTS="https://192.168.1.1:2379,https://192.168.1.2:2379,https://192.168.1.3:2379"
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
|
|
|
|
# 集群basic auth 使用的用户名和密码
|
|
|
|
|
BASIC_AUTH_USER="admin"
|
|
|
|
|
BASIC_AUTH_PASS="test1234"
|
|
|
|
|
|
|
|
|
|
# ---------附加参数--------------------
|
2018-05-19 22:40:41 +08:00
|
|
|
|
#是否对操作系统进行安全加固 "yes"/"no"
|
|
|
|
|
OS_HARDEN="no"
|
|
|
|
|
|
2017-11-11 19:14:21 +08:00
|
|
|
|
#默认二进制文件目录
|
2018-05-06 09:08:09 +08:00
|
|
|
|
bin_dir="/opt/kube/bin"
|
2017-11-11 19:14:21 +08:00
|
|
|
|
|
|
|
|
|
#证书目录
|
|
|
|
|
ca_dir="/etc/kubernetes/ssl"
|
|
|
|
|
|
2017-11-30 15:01:24 +08:00
|
|
|
|
#部署目录,即 ansible 工作目录,建议不要修改
|
2017-11-11 19:14:21 +08:00
|
|
|
|
base_dir="/etc/ansible"
|
|
|
|
|
|
|
|
|
|
#私有仓库 harbor服务器 (域名或者IP)
|
2017-12-25 15:05:21 +08:00
|
|
|
|
#HARBOR_IP="192.168.1.8"
|
|
|
|
|
#HARBOR_DOMAIN="harbor.yourdomain.com"
|