废弃ansible hosts变量K8S_VER,改为自动识别

pull/475/head
gjmzj 2019-03-01 09:49:24 +08:00
parent 64350c4b5c
commit bf2c9353b5
11 changed files with 10 additions and 31 deletions

View File

@ -2,7 +2,7 @@
集群升级存在一定风险,请谨慎操作。 集群升级存在一定风险,请谨慎操作。
- 项目分支`master`安装的集群可以在k8s 1.8/1.9/1.10/1.11/1.12/1.13 任意小版本、大版本间升级(特别注意如果跨大版本升级需要修改/etc/ansible/hosts文件中的参数K8S_VER - 项目分支`master`安装的集群可以在k8s 1.8/1.9/1.10/1.11/1.12/1.13 任意小版本、大版本间升级
- 项目分支`closed`已停止更新安装的集群目前只能进行小版本1.8.x的升级 - 项目分支`closed`已停止更新安装的集群目前只能进行小版本1.8.x的升级
### 备份etcd数据 ### 备份etcd数据

View File

@ -62,9 +62,6 @@
#集群部署模式allinone, single-master, multi-master #集群部署模式allinone, single-master, multi-master
DEPLOY_MODE=multi-master DEPLOY_MODE=multi-master
#集群主版本号,目前支持: v1.8, v1.9, v1.10v1.11v1.12
K8S_VER="v1.11"
# 创建内网云负载均衡,然后配置:前端监听 tcp 8443后端 tcp 6443后端节点即 master 节点 # 创建内网云负载均衡,然后配置:前端监听 tcp 8443后端 tcp 6443后端节点即 master 节点
MASTER_IP="10.1.0.200" # 即负载均衡内网地址 MASTER_IP="10.1.0.200" # 即负载均衡内网地址
KUBE_APISERVER="https://{{ MASTER_IP }}:8443" KUBE_APISERVER="https://{{ MASTER_IP }}:8443"

View File

@ -28,9 +28,6 @@
#集群部署模式allinone, single-master, multi-master #集群部署模式allinone, single-master, multi-master
DEPLOY_MODE=allinone DEPLOY_MODE=allinone
#集群主版本号,目前支持: v1.8, v1.9, v1.10v1.11, v1.12, v1.13
K8S_VER="v1.10"
#集群 MASTER IP自动生成 #集群 MASTER IP自动生成
MASTER_IP="{{ groups['kube-master'][0] }}" MASTER_IP="{{ groups['kube-master'][0] }}"
KUBE_APISERVER="https://{{ MASTER_IP }}:6443" KUBE_APISERVER="https://{{ MASTER_IP }}:6443"

View File

@ -29,9 +29,6 @@
# Cluster Deployment Mode: allinone, single-master, multi-master # Cluster Deployment Mode: allinone, single-master, multi-master
DEPLOY_MODE=allinone DEPLOY_MODE=allinone
# Versions supported: v1.8, v1.9, v1.10, v1.11, v1.12, v1.13
K8S_VER="v1.10"
# Cluster's Master IP, auto generated # Cluster's Master IP, auto generated
MASTER_IP="{{ groups['kube-master'][0] }}" MASTER_IP="{{ groups['kube-master'][0] }}"
KUBE_APISERVER="https://{{ MASTER_IP }}:6443" KUBE_APISERVER="https://{{ MASTER_IP }}:6443"

View File

@ -27,9 +27,6 @@
#集群部署模式allinone, single-master, multi-master #集群部署模式allinone, single-master, multi-master
DEPLOY_MODE=multi-master DEPLOY_MODE=multi-master
#集群主版本号,目前支持: v1.8, v1.9, v1.10v1.11, v1.12, v1.13
K8S_VER="v1.10"
# 公有云上一般都有提供负载均衡产品且不允许自己创建lb # 公有云上一般都有提供负载均衡产品且不允许自己创建lb
# 创建公有云内网负载均衡,然后配置:前端监听 tcp 8443后端 tcp 6443后端节点即 master 节点 # 创建公有云内网负载均衡,然后配置:前端监听 tcp 8443后端 tcp 6443后端节点即 master 节点
MASTER_IP="192.168.1.10" # 即负载均衡内网地址 MASTER_IP="192.168.1.10" # 即负载均衡内网地址

View File

@ -28,9 +28,6 @@
# Cluster Deployment Mode: allinone, single-master, multi-master # Cluster Deployment Mode: allinone, single-master, multi-master
DEPLOY_MODE=multi-master DEPLOY_MODE=multi-master
# Versions supported: v1.8, v1.9, v1.10, v1.11, v1.12, v1.13
K8S_VER="v1.10"
# use loadballance service by the Cloud Providor, no 'lb' nodes needed # use loadballance service by the Cloud Providor, no 'lb' nodes needed
# cloud loadballance service: listen on tcp 8443, with kube-masters(apiservers) as backend servers # cloud loadballance service: listen on tcp 8443, with kube-masters(apiservers) as backend servers
MASTER_IP="192.168.1.10" MASTER_IP="192.168.1.10"

View File

@ -37,9 +37,6 @@
#集群部署模式allinone, single-master, multi-master #集群部署模式allinone, single-master, multi-master
DEPLOY_MODE=multi-master DEPLOY_MODE=multi-master
#集群主版本号,目前支持: v1.8, v1.9, v1.10v1.11, v1.12, v1.13
K8S_VER="v1.10"
# 集群 MASTER IP即 LB节点VIP地址为区别与默认apiserver端口设置VIP监听的服务端口8443 # 集群 MASTER IP即 LB节点VIP地址为区别与默认apiserver端口设置VIP监听的服务端口8443
# 公有云上请使用云负载均衡内网地址和监听端口 # 公有云上请使用云负载均衡内网地址和监听端口
MASTER_IP="192.168.1.10" MASTER_IP="192.168.1.10"

View File

@ -38,9 +38,6 @@
# Cluster Deployment Mode: allinone, single-master, multi-master # Cluster Deployment Mode: allinone, single-master, multi-master
DEPLOY_MODE=multi-master DEPLOY_MODE=multi-master
# Versions supported: v1.8, v1.9, v1.10, v1.11, v1.12, v1.13
K8S_VER="v1.10"
# Cluster's Master IP, generated by 'keepalived' daemon on a 'lb' node here # Cluster's Master IP, generated by 'keepalived' daemon on a 'lb' node here
# 'haproxy' daemon listens on port 8443, directs requests to real apiservers on port 6443 # 'haproxy' daemon listens on port 8443, directs requests to real apiservers on port 6443
MASTER_IP="192.168.1.10" MASTER_IP="192.168.1.10"

View File

@ -29,9 +29,6 @@
#集群部署模式allinone, single-master, multi-master #集群部署模式allinone, single-master, multi-master
DEPLOY_MODE=single-master DEPLOY_MODE=single-master
#集群主版本号,目前支持: v1.8, v1.9, v1.10v1.11, v1.12, v1.13
K8S_VER="v1.11"
#集群 MASTER IP自动生成 #集群 MASTER IP自动生成
MASTER_IP="{{ groups['kube-master'][0] }}" MASTER_IP="{{ groups['kube-master'][0] }}"
KUBE_APISERVER="https://{{ MASTER_IP }}:6443" KUBE_APISERVER="https://{{ MASTER_IP }}:6443"

View File

@ -30,9 +30,6 @@
# Cluster Deployment Mode: allinone, single-master, multi-master # Cluster Deployment Mode: allinone, single-master, multi-master
DEPLOY_MODE=single-master DEPLOY_MODE=single-master
# Versions supported: v1.8, v1.9, v1.10, v1.11, v1.12, v1.13
K8S_VER="v1.11"
# Cluster's Master IP, auto generated # Cluster's Master IP, auto generated
MASTER_IP="{{ groups['kube-master'][0] }}" MASTER_IP="{{ groups['kube-master'][0] }}"
KUBE_APISERVER="https://{{ MASTER_IP }}:6443" KUBE_APISERVER="https://{{ MASTER_IP }}:6443"

View File

@ -45,15 +45,21 @@
- name: 创建 basic-auth.csv - name: 创建 basic-auth.csv
template: src=basic-auth.csv.j2 dest={{ ca_dir }}/basic-auth.csv template: src=basic-auth.csv.j2 dest={{ ca_dir }}/basic-auth.csv
# 为兼容v1.8版本,配置不同 kube-apiserver的systemd unit文件
- name: 获取 k8s 版本信息
shell: "{{ bin_dir }}/kube-apiserver --version"
register: k8s_ver
tags: upgrade_k8s, restart_master
- name: 创建kube-apiserver的systemd unit文件 - name: 创建kube-apiserver的systemd unit文件
template: src=kube-apiserver.service.j2 dest=/etc/systemd/system/kube-apiserver.service template: src=kube-apiserver.service.j2 dest=/etc/systemd/system/kube-apiserver.service
tags: upgrade_k8s, restart_master tags: upgrade_k8s, restart_master
when: "'v1.8' not in k8s_ver.stdout"
# 为兼容之前的模式需特别对v1.8版本重新配置kube-apiserver的systemd unit文件
- name: 创建kube-apiserver v1.8的systemd unit文件 - name: 创建kube-apiserver v1.8的systemd unit文件
template: src=kube-apiserver-{{ K8S_VER }}.service.j2 dest=/etc/systemd/system/kube-apiserver.service template: src=kube-apiserver-v1.8.service.j2 dest=/etc/systemd/system/kube-apiserver.service
tags: upgrade_k8s, restart_master tags: upgrade_k8s, restart_master
when: "K8S_VER is defined and K8S_VER == 'v1.8'" when: "'v1.8' in k8s_ver.stdout"
- name: 创建kube-controller-manager的systemd unit文件 - name: 创建kube-controller-manager的systemd unit文件
template: src=kube-controller-manager.service.j2 dest=/etc/systemd/system/kube-controller-manager.service template: src=kube-controller-manager.service.j2 dest=/etc/systemd/system/kube-controller-manager.service