This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 5. Downgrading OpenShift
5.1. Overview Copia collegamentoCollegamento copiato negli appunti!
Following an OpenShift Container Platform upgrade, it may be desirable in extreme cases to downgrade your cluster to a previous version. The following sections outline the required steps for each system in a cluster to perform such a downgrade for the OpenShift Container Platform 3.10 to 3.9 downgrade path.
These steps are currently only supported for RPM-based installations of OpenShift Container Platform and assumes downtime of the entire cluster.
5.2. Verifying Backups Copia collegamentoCollegamento copiato negli appunti!
The Ansible playbook used during the upgrade process should have created a backup of the master-config.yaml file. Ensure this and the scheduler.json file exist on your masters:
/etc/origin/master/master-config.yaml.<timestamp> /etc/origin/master/scheduler.json
/etc/origin/master/master-config.yaml.<timestamp> /etc/origin/master/scheduler.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The procedure in Preparing for an Automated Upgrade instructed you to back up the following files before proceeding with an upgrade from OpenShift Container Platform 3.9 to 3.10; ensure that you still have these files available.
On master hosts:
/usr/lib/systemd/system/atomic-openshift-master-api.service /usr/lib/systemd/system/atomic-openshift-master-controllers.service /etc/sysconfig/atomic-openshift-master-api /etc/sysconfig/atomic-openshift-master-controllers
/usr/lib/systemd/system/atomic-openshift-master-api.service /usr/lib/systemd/system/atomic-openshift-master-controllers.service /etc/sysconfig/atomic-openshift-master-api /etc/sysconfig/atomic-openshift-master-controllers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On node and master hosts:
/usr/lib/systemd/system/atomic-openshift-*.service /etc/origin/node/node-config.yaml
/usr/lib/systemd/system/atomic-openshift-*.service /etc/origin/node/node-config.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On etcd hosts, including masters that have etcd co-located on them:
/etc/etcd/etcd.conf /backup/etcd-xxxxxx/backup.db
/etc/etcd/etcd.conf /backup/etcd-xxxxxx/backup.db
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.3. Shutting Down the Cluster Copia collegamentoCollegamento copiato negli appunti!
On all master and node hosts, stop the master and node services by removing the pod definition and rebooting the host:
mkdir -p /etc/origin/node/pods-stopped mv /etc/origin/node/pods/* /etc/origin/node/pods-stopped/ reboot
# mkdir -p /etc/origin/node/pods-stopped # mv /etc/origin/node/pods/* /etc/origin/node/pods-stopped/ # reboot
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4. Removing RPMs and Static Pods Copia collegamentoCollegamento copiato negli appunti!
The *-excluder packages add entries to the exclude directive in the host’s /etc/yum.conf file when installed.
On all masters, nodes, and etcd members (if using a dedicated etcd cluster), remove the following packages:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the packages were removed successfully:
rpm -qa | grep atomic-openshift
# rpm -qa | grep atomic-openshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On control plane hosts (master and etcd hosts), move the static pod definitions:
mkdir /etc/origin/node/pods-backup mv /etc/origin/node/pods/* /etc/origin/node/pods-backup/
# mkdir /etc/origin/node/pods-backup # mv /etc/origin/node/pods/* /etc/origin/node/pods-backup/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reboot each host:
reboot
# reboot
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.5. Downgrading Docker Copia collegamentoCollegamento copiato negli appunti!
Both OpenShift Container Platform 3.9 and 3.10 require Docker 1.13, so Docker does not need to be downgraded.
5.6. Reinstalling RPMs Copia collegamentoCollegamento copiato negli appunti!
Disable the OpenShift Container Platform 3.10 repositories, and re-enable the 3.9 repositories:
subscription-manager repos \ --disable=rhel-7-server-ose-3.10-rpms \ --enable=rhel-7-server-ose-3.9-rpms
# subscription-manager repos \ --disable=rhel-7-server-ose-3.10-rpms \ --enable=rhel-7-server-ose-3.9-rpms
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On each master, install the following packages:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On each node, install the following packages:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On each host, verify the packages were installed successfully:
rpm -qa | grep atomic-openshift rpm -q openvswitch
# rpm -qa | grep atomic-openshift # rpm -q openvswitch
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.7. Restoring etcd Copia collegamentoCollegamento copiato negli appunti!
The restore procedure for etcd configuration files replaces the appropriate files, then restarts the service or static pod.
If an etcd host has become corrupted and the /etc/etcd/etcd.conf
file is lost, restore it using:
ssh master-0 cp /backup/yesterday/master-0-files/etcd.conf /etc/etcd/etcd.conf restorecon -Rv /etc/etcd/etcd.conf
$ ssh master-0
# cp /backup/yesterday/master-0-files/etcd.conf /etc/etcd/etcd.conf
# restorecon -Rv /etc/etcd/etcd.conf
In this example, the backup file is stored in the /backup/yesterday/master-0-files/etcd.conf
path where it can be used as an external NFS share, S3 bucket, or other storage solution.
If you run etcd as a static pod, follow only the steps in that section. If you run etcd as a separate service on either master or standalone nodes, follow the steps to restore v2 or v3 data as required.
5.7.1. Restoring etcd v3 snapshot Copia collegamentoCollegamento copiato negli appunti!
Snapshot integrity may be optionally verified at restore time. If the snapshot is taken with etcdctl snapshot save
, it will have an integrity hash that is checked by etcdctl snapshot restore
. If the snapshot is copied from the data directory, there is no integrity hash and it will only restore by using --skip-hash-check
.
The procedure to restore the data must be performed on a single etcd host. You can then add the rest of the nodes to the cluster.
Procedure
Unmask the etcd service:
systemctl unmask etcd
# systemctl unmask etcd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Stop all etcd services by removing the etcd pod definition and rebooting the host:
mkdir -p /etc/origin/node/pods-stopped mv /etc/origin/node/pods/* /etc/origin/node/pods-stopped/ reboot
# mkdir -p /etc/origin/node/pods-stopped # mv /etc/origin/node/pods/* /etc/origin/node/pods-stopped/ # reboot
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Clear all old data, because
etcdctl
recreates it in the node where the restore procedure is going to be performed:rm -Rf /var/lib/etcd
# rm -Rf /var/lib/etcd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
snapshot restore
command, substituting the values from the/etc/etcd/etcd.conf
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restore permissions and
selinux
context to the restored files:restorecon -Rv /var/lib/etcd
# restorecon -Rv /var/lib/etcd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start the etcd service:
systemctl start etcd
# systemctl start etcd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check for any error messages:
journalctl -fu etcd.service
# journalctl -fu etcd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.7.2. Restoring etcd on a static pod Copia collegamentoCollegamento copiato negli appunti!
Before restoring etcd on a static pod:
etcdctl
binaries must be available or, in containerized installations, therhel7/etcd
container must be available.You can obtain etcd by running the following commands:
git clone https://github.com/coreos/etcd.git cd etcd ./build
$ git clone https://github.com/coreos/etcd.git $ cd etcd $ ./build
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
To restore etcd on a static pod:
If the pod is running, stop the etcd pod by moving the pod manifest YAML file to another directory:
mv /etc/origin/node/pods/etcd.yaml .
$ mv /etc/origin/node/pods/etcd.yaml .
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Clear all old data:
rm -rf /var/lib/etcd
$ rm -rf /var/lib/etcd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You use the etcdctl to recreate the data in the node where you restore the pod.
Restore the etcd snapshot to the mount path for the etcd pod:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Obtain the values for your cluster from the $/backup_files/etcd.conf file.
Set required permissions and selinux context on the data directory:
restorecon -Rv /var/lib/etcd/
$ restorecon -Rv /var/lib/etcd/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the etcd pod by moving the pod manifest YAML file to the required directory:
mv etcd.yaml /etc/origin/node/pods/.
$ mv etcd.yaml /etc/origin/node/pods/.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.7.3. Adding etcd nodes after restoring Copia collegamentoCollegamento copiato negli appunti!
After the first instance is running, you can add multiple etcd servers to your cluster.
Procedure
Get the etcd name for the instance in the
ETCD_NAME
variable:grep ETCD_NAME /etc/etcd/etcd.conf
# grep ETCD_NAME /etc/etcd/etcd.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get the IP address where etcd listens for peer communication:
grep ETCD_INITIAL_ADVERTISE_PEER_URLS /etc/etcd/etcd.conf
# grep ETCD_INITIAL_ADVERTISE_PEER_URLS /etc/etcd/etcd.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the node was previously part of a etcd cluster, delete the previous etcd data:
rm -Rf /var/lib/etcd/*
# rm -Rf /var/lib/etcd/*
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the etcd host where etcd is properly running, add the new member:
etcdctl3 member add *<name>* \ --peer-urls="*<advertise_peer_urls>*"
# etcdctl3 member add *<name>* \ --peer-urls="*<advertise_peer_urls>*"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The command outputs some variables. For example:
ETCD_NAME="master2" ETCD_INITIAL_CLUSTER="master-0.example.com=https://192.168.55.8:2380" ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_NAME="master2" ETCD_INITIAL_CLUSTER="master-0.example.com=https://192.168.55.8:2380" ETCD_INITIAL_CLUSTER_STATE="existing"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the values from the previous command to the
/etc/etcd/etcd.conf
file of the new host:vi /etc/etcd/etcd.conf
# vi /etc/etcd/etcd.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start the etcd service in the node joining the cluster:
systemctl start etcd.service
# systemctl start etcd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check for error messages:
journalctl -fu etcd.service
# journalctl -fu etcd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Repeat the previous steps for every etcd node to be added.
Once you add all the nodes, verify the cluster status and cluster health:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.8. Bringing OpenShift Container Platform services back online Copia collegamentoCollegamento copiato negli appunti!
After you finish your changes, bring OpenShift Container Platform back online.
Procedure
On each OpenShift Container Platform master, restore your master and node configuration from backup and enable and restart all relevant services:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On each OpenShift Container Platform node, update the node configuration maps as needed, and enable and restart the atomic-openshift-node service:
cp /etc/origin/node/node-config.yaml.<timestamp> /etc/origin/node/node-config.yaml rm /etc/systemd/system/atomic-openshift-node.service systemctl daemon-reload systemctl enable atomic-openshift-node systemctl start atomic-openshift-node
# cp /etc/origin/node/node-config.yaml.<timestamp> /etc/origin/node/node-config.yaml # rm /etc/systemd/system/atomic-openshift-node.service # systemctl daemon-reload # systemctl enable atomic-openshift-node # systemctl start atomic-openshift-node
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.9. Verifying the Downgrade Copia collegamentoCollegamento copiato negli appunti!
To verify the downgrade, first check that all nodes are marked as Ready:
oc get nodes
# oc get nodes NAME STATUS AGE master.example.com Ready,SchedulingDisabled 165d node1.example.com Ready 165d node2.example.com Ready 165d
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the successful downgrade of the registry and router, if deployed:
Verify you are running the
v3.9
versions of the docker-registry and router images:oc get -n default dc/docker-registry -o json | grep \"image\" oc get -n default dc/router -o json | grep \"image\"
# oc get -n default dc/docker-registry -o json | grep \"image\" "image": "openshift3/ose-docker-registry:v3.9", # oc get -n default dc/router -o json | grep \"image\" "image": "openshift3/ose-haproxy-router:v3.9",
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that docker-registry and router pods are running and in ready state:
oc get pods -n default
# oc get pods -n default NAME READY STATUS RESTARTS AGE docker-registry-2-b7xbn 1/1 Running 0 18m router-2-mvq6p 1/1 Running 0 6m
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Use the diagnostics tool on the master to look for common issues and provide suggestions:
oc adm diagnostics
# oc adm diagnostics ... [Note] Summary of diagnostics execution: [Note] Completed with no errors or warnings seen.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow