有个好文档还是靠普很多,感谢同事的文档。升级步骤记录如下

1.检查现有环境

[root@master ~]# etcd --version
etcd Version: 3.2.
Git SHA: 1674e68
Go Version: go1.9.2
Go OS/Arch: linux/amd64
[root@master ~]# etcdctl2 cluster-health
member a4e80e96ea75f7c8 is healthy: got healthy result from https://192.168.0.103:2379
cluster is healthy
[root@master ~]# etcdctl2 member list
a4e80e96ea75f7c8: name=master.example.com peerURLs=https://192.168.0.103:2380 clientURLs=https://192.168.0.103:2379 isLeader=true
[root@master ~]# oc get dc/router -n default
NAME REVISION DESIRED CURRENT TRIGGERED BY
router config
[root@master ~]# oc get dc/docker-registry -n default
NAME REVISION DESIRED CURRENT TRIGGERED BY
docker-registry config
[root@master ~]# oc get node --show-labels
NAME STATUS AGE VERSION LABELS
master.example.com Ready 14h v1.6.1+5115d708d7 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=master.example.com,openshift-infra=apiserver,region=infra,router=true,zone=default
node1.example.com Ready 14h v1.6.1+5115d708d7 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=node1.example.com,region=infra,router=true,zone=default
node2.example.com NotReady 14h v1.6.1+5115d708d7 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=node2.example.com,region=infra,zone=default [root@master ~]# oc get pv
No resources found.
[root@master ~]# oc get pvc
No resources found.

2.备份ansible脚本

cd /usr/share/ansible
cp -r plugins/ plugins-3.6.bak
cp -r openshift-ansible/ openshift-ansible-3.6.bak
ll
total
drwxr-xr-x. root root Jul : openshift-ansible
drwxr-xr-x. root root Jul : openshift-ansible-3.6.bak
drwxr-xr-x. root root Jul : plugins
drwxr-xr-x. root root Jul : plugins-3.6.bak
drwxr-xr-x. root root Jan roles

3.备份etcd数据

cp -r /etc/etcd /etc/etcd.bak
etcdctl2 backup --data-dir /var/lib/etcd --backup-dir /tmp/etcd-data
cp /var/lib/etcd/member/snap/db /tmp/etcd-data
ll /etc/etcd.bak
total
drwx------. root root Jul : ca
-rw-------. root root Jul : ca.crt
-rw-r--r--. root root Jul : etcd.conf
-rw-r--r--. root root Jul : etcd.conf.32617.2018--@::~
drwx------. root root Jul : generated_certs
-rw-------. root root Jul : peer.crt
-rw-r--r--. root root Jul : peer.csr
-rw-------. root root Jul : peer.key
-rw-------. root root Jul : server.crt
-rw-r--r--. root root Jul : server.csr
-rw-------. root root Jul : server.key ll /var/lib/etcd/member/snap/db /tmp/etcd-data
-rw-------. etcd etcd Jul : /var/lib/etcd/member/snap/db /tmp/etcd-data:
total
-rw-------. root root Jul : db
drwx------. root root Jul : member

4.备份配置文件

master节点

cp -r /etc/origin/master /etc/origin/master.bak
cp -r /etc/origin/node /etc/origin/node.bak
cp -r /etc/sysconfig/atomic-openshift-master-api /etc/sysconfig/atomic-openshift-master-api.bak
cp -r /etc/sysconfig/atomic-openshift-master-controllers /etc/sysconfig/atomic-openshift-master-controller.bak
cp -r /etc/sysconfig/atomic-openshift-node /etc/sysconfig/atomic-openshift-node.bak ll /etc/origin/master.bak
ll /etc/origin/node /etc/origin/node.bak
ll /etc/sysconfig/atomic-openshift-master-api.bak
ll /etc/sysconfig/atomic-openshift-master-controller.bak
ll /etc/sysconfig/atomic-openshift-node.bak

node节点

cp -r /etc/origin/node /etc/origin/node.bak
cp -r /etc/sysconfig/atomic-openshift-node /etc/sysconfig/atomic-openshift-node.bak ll /etc/origin/node.bak
ll /etc/sysconfig/atomic-openshift-node.bak

备份yum repo文件

cp /etc/yum.repos.d/ocp.repo /etc/yum.repos.d/ocp.repo.bak

5.修改yum repository文件

当然先需要把Package导入

[root@master ~]# cat /etc/yum.repos.d/ocp.repo
[local-rhel--server-rpms]
name=rhel--server-rpms
baseurl=http://192.168.56.103:8080/repo/rhel-7-server-rpms
enabled=
gpgcheck=
[local-rhel--server-extras-rpms]
name=rhel--server-extras-rpms
baseurl=http://192.168.56.103:8080/repo/rhel-7-server-extras-rpms
enabled=
gpgcheck=
[local-rhel--fast-datapath-rpms]
name=rhel--fast-datapath-rpms
baseurl=http://192.168.56.103:8080/repo/rhel-7-fast-datapath-rpms
enabled=
gpgcheck=
[local-rhel--server-ose-3.7-rpms]
name=rhel--server-ose-3.7-rpms
baseurl=http://192.168.56.103:8080/repo/rhel-7-server-ose-3.7-rpms
enabled=
gpgcheck=
yum clean all
yum repolist yum update -y

6.升级ansible

yum update atomic-openshift-utils ansible
rpm -qa | grep atomic-openshift-utils
atomic-openshift-utils-3.7.-.git..cf01e48.el7.noarch

7.备份模板

mv /usr/share/openshift/examples /usr/share/openshift/examples.3.6
mkdir -p /usr/share/openshift/examples
cp -R /usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/v3./* /usr/share/openshift/examples/

8.导入镜像

导入镜像过程略,完成后需要对registry-console进行重新tag和push

docker tag registry.example.com/openshift3/registry-console:v3.7.64 registry.example.com/openshift3/registry-console:v3.

docker push registry.example.com/openshift3/registry-console:v3.

10.修改hosts文件

/etc/ansible/hosts文件

[OSEv3:children]
masters
nodes
etcd
nfs [OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=openshift-enterprise
openshift_release=v3. osm_use_cockpit=true
osm_cockpit_plugins=['cockpit-kubernetes']
openshift_cockpit_deployer_prefix='openshift3/'
openshift_cockpit_deployer_version='v3.7.64' osm_cluster_network_cidr=10.128.0.0/
openshift_portal_net=172.30.0.0/
openshift_master_api_port=
openshift_master_console_port= openshift_enable_service_catalog=true
openshift_service_catalog_image_prefix=registry.example.com/openshift3/ose-
openshift_service_catalog_image_version=v3.7.64
ansible_service_broker_image_prefix=registry.example.com/openshift3/ose-
ansible_service_broker_etcd_image_prefix=registry.example.com/rhel7/
template_service_broker_prefix=registry.example.com/openshift3/
oreg_url=registry.example.com/openshift3/ose-${component}:${version}
openshift_examples_modify_imagestreams=true
openshift_clock_enabled=true openshift_metrics_storage_kind=nfs
openshift_metrics_install_metrics=true
openshift_metrics_storage_access_modes=['ReadWriteOnce']
openshift_metrics_storage_host=nfs.example.com
openshift_metrics_storage_nfs_directory=/exports
openshift_metrics_storage_volume_name=metrics
openshift_metrics_storage_volume_size=10Gi
openshift_metrics_hawkular_hostname=hawkular-metrics.apps.example.com
openshift_metrics_cassandra_storage_type=emptydir
openshift_metrics_image_prefix=registry.example.com/openshift3/
openshift_hosted_metrics_deploy=true
openshift_hosted_metrics_public_url=https://hawkular-metrics.apps.example.com/hawkular/metrics
openshift_metrics_image_prefix=registry.example.com/openshift3/
openshift_metrics_image_version=v3.7.64 openshift_template_service_broker_namespaces=['openshift']
template_service_broker_selector={"node": "true"}
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]
# Default login account: admin / handhand
openshift_master_htpasswd_users={'admin': '$apr1$gfaL16Jf$c.5LAvg3xNDVQTkk6HpGB1'} #openshift_repos_enable_testing=true
openshift_disable_check=docker_image_availability,disk_availability,memory_availability,docker_storage
docker_selinux_enabled=false
openshift_docker_options=" --selinux-enabled --insecure-registry 172.30.0.0/16 --log-driver json-file --log-opt max-size=50M --log-opt max-file=3 --insecure-registry registry.example.com --add-registry registry.example.com"
openshift_docker_additional_registries=registry.example.com
openshift_docker_insecure_registries=registry.example.com
osm_etcd_image=rhel7/etcd
openshift_logging_image_prefix=registry.example.com/openshift3/ openshift_hosted_router_selector='region=infra,router=true'
openshift_master_default_subdomain=app.example.com # host group for masters
[masters]
master.example.com
# host group for etcd
[etcd]
master.example.com # host group for nodes, includes region info
[nodes]
master.example.com openshift_node_labels="{'region': 'infra', 'router': 'true', 'zone': 'default'}" openshift_schedulable=true
node1.example.com openshift_node_labels="{'region': 'infra', 'router': 'true', 'zone': 'default'}" openshift_schedulable=true
node2.example.com openshift_node_labels="{'region': 'infra', 'zone': 'default'}" openshift_schedulable=true [nfs]
nfs.example.com

11.升级前的检查

ansible-playbook --tags pre_upgrade /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/upgrades/v3_7/upgrade.yml 

遇到一个问题说master,node1,node2的节点的Docker的版本需要1.12以上,但master,node1,node2的docker版本已经是1.13.1

解决办法,修改/etc/yum.conf文件,屏蔽下面这句话,跳过检查

#exclude= docker*1.20*  docker*1.19*  docker*1.18*  docker*1.17*  docker*1.16*  docker*1.15*  docker*1.14*  docker*1.13* 

12.升级

升级master节点

ansible-playbook -vv /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/upgrades/v3_7/upgrade_control_plane.yml | tee /tmp/upgrade_control_plane_to_3_7.log;

升级完后显示

TASK [Warn if shared-resource-viewer could not be updated] **************************************************************************************************************
task path: /usr/share/ansible/openshift-ansible/playbooks/common/openshift-cluster/upgrades/post_control_plane.yml:
skipping: [master.example.com] => {"changed": false, "skip_reason": "Conditional result was False"}
META: ran handlers PLAY RECAP **************************************************************************************************************************************************************
localhost : ok= changed= unreachable= failed=
master.example.com : ok= changed= unreachable= failed=
nfs.example.com : ok= changed= unreachable= failed=
node1.example.com : ok= changed= unreachable= failed=
node2.example.com : ok= changed= unreachable= failed=

检查

[root@master ansible]# oc get nodes
NAME STATUS AGE VERSION
master.example.com Ready 3h v1.7.6+a08f5eeb62
node1.example.com Ready 3h v1.6.1+5115d708d7
node2.example.com Ready 3h v1.6.1+5115d708d7 [root@master ansible]# oc get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default docker-registry--94zld / Running 6m
default registry-console--lmhgx / Running 6m
default router--8hnmz / Running 6m
default router--g6tlm / Running 5m
kube-service-catalog apiserver-z6nmz / Running 2h
kube-service-catalog controller-manager-d2jgc / CrashLoopBackOff 2h
openshift-infra hawkular-cassandra--gp4n9 / Running 10m
openshift-infra hawkular-metrics-4j828 / Running 2h
openshift-infra heapster-rgwrw / Running 3h [root@master ansible]# oc version
oc v3.7.64
kubernetes v1.7.6+a08f5eeb62
features: Basic-Auth GSSAPI Kerberos SPNEGO Server https://master.example.com:8443
openshift v3.7.64
kubernetes v1.7.6+a08f5eeb62

升级node节点

ansible-playbook -vv /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/upgrades/v3_7/upgrade_nodes.yml -e openshift_upgrade_nodes_serial= | tee /tmp/upgrade_node_to_3_7.log;

升级完成后提示

TASK [include] **********************************************************************************************************************************************************
task path: /usr/share/ansible/openshift-ansible/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml:
skipping: [node2.example.com] => {"changed": false, "skip_reason": "Conditional result was False"}
META: ran handlers PLAY RECAP **************************************************************************************************************************************************************
localhost : ok= changed= unreachable= failed=
master.example.com : ok= changed= unreachable= failed=
nfs.example.com : ok= changed= unreachable= failed=
node1.example.com : ok= changed= unreachable= failed=
node2.example.com : ok= changed= unreachable= failed=

检查

[root@master ansible]# oc get nodes
NAME STATUS AGE VERSION
master.example.com Ready 3h v1.7.6+a08f5eeb62
node1.example.com Ready 3h v1.7.6+a08f5eeb62
node2.example.com Ready 3h v1.7.6+a08f5eeb62 [root@master ansible]# oc get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default docker-registry--x7sqf / Running 4m
default registry-console--mslwb / Running 4m
default router--79qjr / Running 8m
default router--8hnmz / Running 20m
kube-service-catalog apiserver-z6nmz / Running 3h
kube-service-catalog controller-manager-d2jgc / Error 2h
openshift-infra hawkular-cassandra--qg2bj / Running 8m
openshift-infra hawkular-metrics-bqqm8 / Running 4m
openshift-infra heapster-zt87w / Running 8m

OCP升级(3.6->3.7)的更多相关文章

  1. OCP升级(3.7 ->3.9)

    坑多,搞了好多次. 1./etc/ansible/hosts [OSEv3:children] masters nodes etcd nfs [OSEv3:vars] ansible_ssh_user ...

  2. 009.OpenShift管理及监控

    一 资源限制 1.1 pod资源限制 pod可以包括资源请求和资源限制: 资源请求 用于调度,并控制pod不能在计算资源少于指定数量的情况下运行.调度程序试图找到一个具有足够计算资源的节点来满足pod ...

  3. OCP题库升级,iZ0-052新加的考题及答案整理-18

    18.You want to Install Oracle 11g database software and create a database on ASM Immediately after t ...

  4. owncloud7.0.2.1升级8.0.3

    进入更新中心升级,会自动备份下载安装,安装完提示更新数据库,跳转页面后提示需要php5.4以上版本,检查当前环境为php5.3.3.服务器为CentOS6.4,使用yum更新最新版本即5.3.3.   ...

  5. 【设计模式】之开闭原则(OCP)

    开闭原则是面向对象设计的一个重要原则,其定义如下: 开闭原则(Open-Closed Principle, OCP):一个软件实体应当对扩展开放,对修改关闭.即软件实体应尽量在不修改原有代码的情况下进 ...

  6. 【面向对象设计原则】之开闭原则(OCP)

    开闭原则是面向对象设计的一个重要原则,其定义如下: 开闭原则(Open-Closed Principle, OCP):一个软件实体应当对扩展开放,对修改关闭.即软件实体应尽量在不修改原有代码的情况下进 ...

  7. 开发-封闭原则(OCP)

    1.什么是“开放-封闭” 随着软件系统规模的不断增大,软件系统的维护和修改的复杂性不断提高,这种困境促使法国工程院士Bertrand Meyer在1998年提出了“开放-封闭”(Open-Close ...

  8. 【OCP、OCM、高可用等】小麦苗课堂网络班招生简章(从入门到专家)--课程大纲

    [OCP.OCM.高可用等]小麦苗课堂网络班招生简章(从入门到专家)--课程大纲 小麦苗信息 我的个人信息 网名:小麦苗 QQ:646634621 QQ群:618766405 我的博客:http:// ...

  9. 【OCP|OCM】Oracle培训考证系列

     [OCP|OCM]Oracle培训考证系列  我的个人信息 网名:小麦苗 QQ:646634621 QQ群:618766405 我的博客:http://blog.itpub.net/26736162 ...

随机推荐

  1. 前趋图和PV操作

  2. linux下运行jmeter脚本

    1. win下生成测试计划   2. 上传至linux下 3.运行测试计划   sh jmeter.sh -n -t second_login.jmx -l res.jtl 错误1: solution ...

  3. 安装ubuntu-server16.0,设置WiFi

    想装个server版的Linux系统玩玩,下面记录一下遇到的坑. 1:安装语言选英文:可能是因为其他原因,我选中文的时候安装失败了,最后一次选中文的时候成功了. 2:以前装了一个ubuntu的,后面想 ...

  4. 15:django 缓存架构

    动态网站的一个基本权衡就是他们是动态的,每次一个用户请求一个页面,web服务器进行各种各样的计算-从数据库查询到模板渲染到业务逻辑-从而生成站点访问者看到的页面.从处理开销的角度来看,相比标准的从文件 ...

  5. resteasy json

    https://www.cnblogs.com/toSeeMyDream/p/5763725.html

  6. css文件放在头部的原因

    我在博问上发的一个这个问题 然后有人这样回复我的 我感觉很有道理的样子 所以我放上来了 这样会先加载css的样式,在渲染dom的时候已经知道了自己的样式了,所以一次渲染成功 如果css放在底部,那么需 ...

  7. Python 分页功能

    自定义分页组件 """ 自定义分页组件的使用方法: pager_obj = Pagination(request.GET.get('page',1),len(HOST_L ...

  8. session和cookie基本操作

    session的作用同cookie一样: 1.在不同页面使用同一数组 2.实现验证码,用户跟踪(个人觉得这个用到的其实还是1中的作用) session相对于cookie更加的安全 先来说一下cooki ...

  9. ibatis的动态Mapped Statement 标签

    动态Mapped Statement 直接使用JDBC 一个非常普遍的问题是动态SQL.使用参数值.参数本身和数据列都是动态的SQL,通常非常困难.典型的解决方法是,使用一系列if-else 条件语句 ...

  10. C#读取RSS源,并利用Solr索引

    折磨我几天的问题今天终于解决了,分享一下近期solr使用的一些经验. 本来是用nutch在爬取页面,可是客户需要爬取RSS,而且可以识别那些页面是通过RSS源抓取出来的.nutch虽然自带解析RSS的 ...