1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 15:46:57 +01:00
Files
openshift-docs/modules/update-upgrading-cli.adoc
2022-06-15 12:53:28 +00:00

208 lines
7.1 KiB
Plaintext

// Module included in the following assemblies:
//
// * updating/updating-cluster-cli.adoc
// * updating/updating-cluster-rhel-compute.adoc
:_content-type: PROCEDURE
[id="update-upgrading-cli_{context}"]
= Updating a cluster by using the CLI
If updates are available, you can update your cluster by using the
OpenShift CLI (`oc`).
You can find information about available {product-title} advisories and updates
link:https://access.redhat.com/downloads/content/290[in the errata section]
of the Customer Portal.
.Prerequisites
* Install the OpenShift CLI (`oc`) that matches the version for your updated version.
* Log in to the cluster as user with `cluster-admin` privileges.
* Install the `jq` package.
* Pause all `MachineHealthCheck` resources.
.Procedure
. Ensure that your cluster is available:
+
[source,terminal]
----
$ oc get clusterversion
----
+
.Example output
[source,terminal]
----
NAME VERSION AVAILABLE PROGRESSING SINCE STATUS
version 4.9.23 True False 158m Cluster version is 4.9.23
----
. View the available updates and note the version number of the update that
you want to apply:
+
[source,terminal]
----
$ oc adm upgrade
----
+
.Example output
[source,terminal]
----
Cluster version is 4.9.23
Upstream is unset, so the cluster will use an appropriate default.
Channel: stable-4.10 (available channels: candidate-4.10, candidate-4.9, fast-4.10, fast-4.9, stable-4.10, stable-4.9)
Recommended updates:
VERSION IMAGE
4.9.24 quay.io/openshift-release-dev/ocp-release@sha256:6a899c54dda6b844bb12a247e324a0f6cde367e880b73ba110c056df6d018032
4.9.25 quay.io/openshift-release-dev/ocp-release@sha256:2eafde815e543b92f70839972f585cc52aa7c37aa72d5f3c8bc886b0fd45707a
4.9.26 quay.io/openshift-release-dev/ocp-release@sha256:3ccd09dd08c303f27a543351f787d09b83979cd31cf0b4c6ff56cd68814ef6c8
4.9.27 quay.io/openshift-release-dev/ocp-release@sha256:1c7db78eec0cf05df2cead44f69c0e4b2c3234d5635c88a41e1b922c3bedae16
4.9.28 quay.io/openshift-release-dev/ocp-release@sha256:4084d94969b186e20189649b5affba7da59f7d1943e4e5bc7ef78b981eafb7a8
4.9.29 quay.io/openshift-release-dev/ocp-release@sha256:b04ca01d116f0134a102a57f86c67e5b1a3b5da1c4a580af91d521b8fa0aa6ec
4.9.31 quay.io/openshift-release-dev/ocp-release@sha256:2a28b8ebb53d67dd80594421c39e36d9896b1e65cb54af81fbb86ea9ac3bf2d7
4.9.32 quay.io/openshift-release-dev/ocp-release@sha256:ecdb6d0df547b857eaf0edb5574ddd64ca6d9aff1fa61fd1ac6fb641203bedfa
4.10.3 quay.io/openshift-release-dev/ocp-release@sha256:7ffe4cd612be27e355a640e5eec5cd8f923c1400d969fd590f806cffdaabcc56
4.10.4 quay.io/openshift-release-dev/ocp-release@sha256:9f9c3aaca64f62af992bae5de1e984571c8b812f598b74c84dc630b064389fb7
4.10.5 quay.io/openshift-release-dev/ocp-release@sha256:ee6a9c7a11f883e90489229f6c6dc78b434af12f5646f4f9411d73a98969f02a
4.10.6 quay.io/openshift-release-dev/ocp-release@sha256:88b394e633e09dc23aa1f1a61ededd8e52478edf34b51a7dbbb21d9abde2511a
4.10.8 quay.io/openshift-release-dev/ocp-release@sha256:0696e249622b4d07d8f4501504b6c568ed6ba92416176a01a12b7f1882707117
4.10.9 quay.io/openshift-release-dev/ocp-release@sha256:39f360002b9b5c730d1167879ad6437352d51e72acc9fe80add3ec2a0d20400d
4.10.10 quay.io/openshift-release-dev/ocp-release@sha256:39efe13ef67cb4449f5e6cdd8a26c83c07c6a2ce5d235dfbc3ba58c64418fcf3
4.10.11 quay.io/openshift-release-dev/ocp-release@sha256:0dc1a4b4d9ea7954987f63e506474a4f0dc55e5f1ea5c1f6f1179e2c09eaffda
4.10.12 quay.io/openshift-release-dev/ocp-release@sha256:f77f4f75c1e1a4ddd0a0355f298a834db3473fd9ca473235013e9419d1df16db
4.10.13 quay.io/openshift-release-dev/ocp-release@sha256:4f516616baed3cf84585e753359f7ef2153ae139c2e80e0191902fbd073c4143
----
. Based on your organization requirements, set the upgrade channel to `stable-4.10`, `fast-4.10`, or `eus-4.10`:
+
[source,terminal]
----
$ oc adm upgrade channel <channel>
----
+
For example, to set the channel to `stable-4.10`:
+
[source,terminal]
----
$ oc adm upgrade channel stable-4.10
----
+
[IMPORTANT]
====
For production clusters, you must subscribe to a `stable-\*`, `eus-*`, or `fast-*` channel.
====
. Apply an update:
** To update to the latest version:
+
[source,terminal]
----
$ oc adm upgrade --to-latest=true <1>
----
** To update to a specific version:
+
[source,terminal]
----
$ oc adm upgrade --to=<version> <1>
----
<1> `<version>` is the update version that you obtained from the output of the
`oc adm upgrade` command.
. Review the status of the Cluster Version Operator:
+
[source,terminal]
----
$ oc get clusterversion -o json|jq ".items[0].spec"
----
+
.Example output
[source,terminal]
----
{
"channel": "stable-4.10",
"clusterID": "990f7ab8-109b-4c95-8480-2bd1deec55ff",
"desiredUpdate": {
"force": false,
"image": "quay.io/openshift-release-dev/ocp-release@sha256:9c5f0df8b192a0d7b46cd5f6a4da2289c155fd5302dec7954f8f06c878160b8b",
"version": "4.10.13" <1>
}
}
----
<1> If the `version` number in the `desiredUpdate` stanza matches the value that
you specified, the update is in progress.
. Review the cluster version status history to monitor the status of the update.
It might take some time for all the objects to finish updating.
+
[source,terminal]
----
$ oc get clusterversion -o json|jq ".items[0].status.history"
----
+
.Example output
[source,terminal]
----
[
{
"completionTime": null,
"image": "quay.io/openshift-release-dev/ocp-release@sha256:b8fa13e09d869089fc5957c32b02b7d3792a0b6f36693432acc0409615ab23b7",
"startedTime": "2021-01-28T20:30:50Z",
"state": "Partial",
"verified": true,
"version": "4.10.13"
},
{
"completionTime": "2021-01-28T20:30:50Z",
"image": "quay.io/openshift-release-dev/ocp-release@sha256:b8fa13e09d869089fc5957c32b02b7d3792a0b6f36693432acc0409615ab23b7",
"startedTime": "2021-01-28T17:38:10Z",
"state": "Completed",
"verified": false,
"version": "4.9.23"
}
]
----
+
The history contains a list of the most recent versions applied to the cluster.
This value is updated when the CVO applies an update. The list is ordered by
date, where the newest update is first in the list. Updates in the history have
state `Completed` if the rollout completed and `Partial` if the update failed
or did not complete.
. After the update completes, you can confirm that the cluster version has
updated to the new version:
+
[source,terminal]
----
$ oc get clusterversion
----
+
.Example output
[source,terminal]
----
NAME VERSION AVAILABLE PROGRESSING SINCE STATUS
version 4.10.13 True False 2m Cluster version is 4.10.13
----
. If you are upgrading your cluster to the next minor version, like version 4.y to 4.(y+1), it is recommended to confirm your nodes are updated before deploying workloads that rely on a new feature:
+
[source,terminal]
----
$ oc get nodes
----
+
.Example output
[source,terminal]
----
NAME STATUS ROLES AGE VERSION
ip-10-0-168-251.ec2.internal Ready master 82m v1.24.0
ip-10-0-170-223.ec2.internal Ready master 82m v1.24.0
ip-10-0-179-95.ec2.internal Ready worker 70m v1.24.0
ip-10-0-182-134.ec2.internal Ready worker 70m v1.24.0
ip-10-0-211-16.ec2.internal Ready master 82m v1.24.0
ip-10-0-250-100.ec2.internal Ready worker 69m v1.24.0
----