更新方法与策略:自动升级方法

更新openshift-ansible的脚本代码

1
2
git pull 
git checkout -b release-3.7

安装需要的包

1
ansible all -m yum -a 'name=pyOpenSSL state=present'

关闭Service Catalog和Template Service Broker。
3.7 以上版本默认会启用 Service Catalog 和 Template Service Broker

1
2
3
4
5
6
# /etc/ansible/hosts
...
openshift_enable_service_catalog=false
template_service_broker_install=false
ansible_service_broker_install=false
...

关闭etcd目录的selinux检查
关闭任务Check selinux label of ‘‘与Make sure the ‘‘ has the proper label

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# roles/etcd/tasks/backup/backup.yml
...
- name: Detecting Atomic Host Operating System
stat:
path: /run/ostree-booted
register: l_ostree_booted

#- name: Check selinux label of '{{ etcd_data_dir }}'
# command: >
# stat -c '%C' {{ etcd_data_dir }}
# register: l_etcd_selinux_labels
#
#- debug:
# msg: "{{ l_etcd_selinux_labels }}"
#
#- name: Make sure the '{{ etcd_data_dir }}' has the proper label
# command: >
# chcon -t svirt_sandbox_file_t "{{ etcd_data_dir }}"
# when:
# - l_etcd_selinux_labels.rc == 0
# - "'svirt_sandbox_file_t' not in l_etcd_selinux_labels.stdout"

- name: Generate etcd backup
command: >
{{ r_etcd_common_etcdctl_command }} backup --data-dir={{ l_etcd_incontainer_data_dir }}
--backup-dir={{ l_etcd_incontainer_backup_dir }}
...

执行更新

1
ansible-playbook -i inventory-hosts playbooks/byo/openshift-cluster/upgrades/v3_7/upgrade.yml

查看当前oc版本及各node版本

1
2
oc version
oc get node

升级后发现的问题

RBD的storageclass异常

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 解决方法,storageclass.parameters中添加 imageFormat: "1"
apiVersion: storage.k8s.io/v1
metadata:
name: ceph-rbd-sc
Parameters:
adminId: admin
adminSecretName: ceph-secret
adminSecretNamespace: kube-system
fsType: ext4
imageFormat: "1"
monitors: 192.168.1.3:6789
pool: rbd
userId: admin
userSecretName: ceph-secret
Provisioner: kubernetes.io/rbd