From ed7079046138f26873ead455d2e010e93e295dc1 Mon Sep 17 00:00:00 2001 From: jmgao Date: Fri, 2 Mar 2018 08:40:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86kube-master=E7=BB=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01.prepare.yml | 3 ++- 03.kubectl.yml | 3 ++- 04.docker.yml | 5 +++-- 07.calico.yml | 4 +++- 07.flannel.yml | 4 +++- 90.setup.yml | 14 ++++++++++---- 99.clean.yml | 17 +++++++++++++++-- example/hosts.allinone.example | 4 ---- example/hosts.m-masters.example | 5 ----- example/hosts.s-master.example | 4 ---- 10 files changed, 38 insertions(+), 25 deletions(-) diff --git a/01.prepare.yml b/01.prepare.yml index e54009e..26fef8b 100644 --- a/01.prepare.yml +++ b/01.prepare.yml @@ -5,7 +5,8 @@ # 集群节点的公共配置任务 - hosts: - - kube-cluster + - kube-master + - kube-node - deploy - etcd - lb diff --git a/03.kubectl.yml b/03.kubectl.yml index bdd0c01..03805e9 100644 --- a/03.kubectl.yml +++ b/03.kubectl.yml @@ -1,5 +1,6 @@ - hosts: - - kube-cluster + - kube-master + - kube-node - deploy roles: - kubectl diff --git a/04.docker.yml b/04.docker.yml index 8abecf9..8f3eb97 100644 --- a/04.docker.yml +++ b/04.docker.yml @@ -1,4 +1,5 @@ -- hosts: kube-cluster - #gather_facts: True +- hosts: + - kube-master + - kube-node roles: - docker diff --git a/07.calico.yml b/07.calico.yml index 2191e6f..fddb9d5 100644 --- a/07.calico.yml +++ b/07.calico.yml @@ -1,3 +1,5 @@ -- hosts: kube-cluster +- hosts: + - kube-master + - kube-node roles: - { role: calico, when: "CLUSTER_NETWORK == 'calico'" } diff --git a/07.flannel.yml b/07.flannel.yml index b5a971d..d2adb8f 100644 --- a/07.flannel.yml +++ b/07.flannel.yml @@ -1,3 +1,5 @@ -- hosts: kube-cluster +- hosts: + - kube-master + - kube-node roles: - { role: flannel, when: "CLUSTER_NETWORK == 'flannel'" } diff --git a/90.setup.yml b/90.setup.yml index 6186e1a..007b5a5 100644 --- a/90.setup.yml +++ b/90.setup.yml @@ -6,7 +6,8 @@ # 集群节点的公共配置任务 - hosts: - - kube-cluster + - kube-master + - kube-node - deploy - etcd - lb @@ -25,13 +26,16 @@ # kubectl 客户端配置 - hosts: - - kube-cluster + - kube-master + - kube-node - deploy roles: - kubectl # docker服务安装 -- hosts: kube-cluster +- hosts: + - kube-master + - kube-node roles: - docker @@ -46,7 +50,9 @@ - kube-node # 集群网络插件部署,只能选择一种安装 -- hosts: kube-cluster +- hosts: + - kube-master + - kube-node roles: - { role: calico, when: "CLUSTER_NETWORK == 'calico'" } - { role: flannel, when: "CLUSTER_NETWORK == 'flannel'" } diff --git a/99.clean.yml b/99.clean.yml index 612257a..e7265d9 100644 --- a/99.clean.yml +++ b/99.clean.yml @@ -39,9 +39,9 @@ - "/etc/kubernetes/" - hosts: - - kube-cluster + - kube-master + - kube-node - new-node - - deploy tasks: - name: stop docker service shell: "systemctl stop docker" @@ -116,3 +116,16 @@ - "/etc/keepalived" ignore_errors: true +- hosts: + - kube-master + - kube-node + - new-node + - deploy + - etcd + - lb + task: + - name: 清理证书目录和文件 + file: name={{ item }} state=absent + with_items: + - "{{ ca_dir }}" + diff --git a/example/hosts.allinone.example b/example/hosts.allinone.example index 40941d5..8fc844b 100644 --- a/example/hosts.allinone.example +++ b/example/hosts.allinone.example @@ -12,10 +12,6 @@ [kube-node] 192.168.1.1 NODE_ID=node1 NODE_IP="192.168.1.1" -[kube-cluster:children] -kube-node -kube-master - # 如果启用harbor,请配置后面harbor相关参数 [harbor] #192.168.1.8 NODE_IP="192.168.1.8" diff --git a/example/hosts.m-masters.example b/example/hosts.m-masters.example index 46aefe6..bcbd8ab 100644 --- a/example/hosts.m-masters.example +++ b/example/hosts.m-masters.example @@ -20,7 +20,6 @@ [lb:vars] LB_EP1="192.168.1.1:6443" # api-server 实际成员地址端口 LB_EP2="192.168.1.2:6443" # api-server 实际成员地址端口 -MASTER_IP="192.168.1.10" # api-server 虚地址 MASTER_PORT="8443" # api-server 服务端口 [kube-node] @@ -28,10 +27,6 @@ MASTER_PORT="8443" # api-server 服务端口 192.168.1.3 NODE_ID=node2 NODE_IP="192.168.1.3" 192.168.1.4 NODE_ID=node3 NODE_IP="192.168.1.4" -[kube-cluster:children] -kube-node -kube-master - # 如果启用harbor,请配置后面harbor相关参数 [harbor] #192.168.1.8 NODE_IP="192.168.1.8" diff --git a/example/hosts.s-master.example b/example/hosts.s-master.example index 072aef9..c376a54 100644 --- a/example/hosts.s-master.example +++ b/example/hosts.s-master.example @@ -16,10 +16,6 @@ 192.168.1.2 NODE_ID=node2 NODE_IP="192.168.1.2" 192.168.1.3 NODE_ID=node3 NODE_IP="192.168.1.3" -[kube-cluster:children] -kube-node -kube-master - # 如果启用harbor,请配置后面harbor相关参数 [harbor] #192.168.1.8 NODE_IP="192.168.1.8"