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

179 lines
4.5 KiB
Plaintext
Raw Normal View History

// Module included in the following assemblies:
//
// * updating/updating-cluster-cli.adoc
// * updating/updating-cluster-rhel-compute.adoc
[id="update-upgrading-cli_{context}"]
= Updating a cluster by using the CLI
2019-05-21 12:56:54 -04:00
If updates are available, you can update your cluster by using the
OpenShift CLI (`oc`).
2019-05-21 15:18:26 -04:00
You can find information about available {product-title} advisories and updates
link:https://access.redhat.com/downloads/content/290/ver=4.1/rhel---7/4.1.0/x86_64/product-errata[in the errata section]
2019-05-21 15:18:26 -04:00
of the Customer Portal.
.Prerequisites
2020-09-08 16:34:09 -04:00
* Install the OpenShift CLI (`oc`) that matches the version for your updated version.
2019-05-21 12:56:54 -04:00
* Log in to the cluster as user with `cluster-admin` privileges.
* Install the `jq` package.
.Procedure
. Ensure that your cluster is available:
+
2020-08-10 16:20:47 -04:00
[source,terminal]
----
$ oc get clusterversion
2020-08-10 16:20:47 -04:00
----
+
.Example output
[source,terminal]
----
2019-06-19 16:36:40 -04:00
NAME VERSION AVAILABLE PROGRESSING SINCE STATUS
version 4.5.4 True False 158m Cluster version is 4.5.4
----
2019-05-21 15:54:33 -04:00
. Review the current update channel information and confirm that your channel
is set to `stable-4.6`:
+
2020-08-10 16:20:47 -04:00
[source,terminal]
----
$ oc get clusterversion -o json|jq ".items[0].spec"
2020-08-10 16:20:47 -04:00
----
+
.Example output
[source,terminal]
----
{
"channel": "stable-4.6",
2019-06-19 16:36:40 -04:00
"clusterID": "990f7ab8-109b-4c95-8480-2bd1deec55ff",
"upstream": "https://api.openshift.com/api/upgrades_info/v1/graph"
}
----
2019-06-03 10:10:27 -04:00
+
[IMPORTANT]
====
For production clusters, you must subscribe to a `stable-\*` or `fast-*` channel.
2019-06-03 10:10:27 -04:00
====
. View the available updates and note the version number of the update that
you want to apply:
+
2020-08-10 16:20:47 -04:00
[source,terminal]
----
$ oc adm upgrade
2020-08-10 16:20:47 -04:00
----
+
.Example output
[source,terminal]
----
2019-06-20 08:22:48 -04:00
Cluster version is 4.1.0
2019-05-29 20:07:59 -04:00
Updates:
2019-05-29 20:07:59 -04:00
2019-06-19 16:36:40 -04:00
VERSION IMAGE
2019-06-20 08:22:48 -04:00
4.1.2 quay.io/openshift-release-dev/ocp-release@sha256:9c5f0df8b192a0d7b46cd5f6a4da2289c155fd5302dec7954f8f06c878160b8b
2019-05-21 12:56:54 -04:00
----
. Apply an update:
** To update to the latest version:
+
2020-08-10 16:20:47 -04:00
[source,terminal]
2019-05-21 12:56:54 -04:00
----
$ oc adm upgrade --to-latest=true <1>
----
2019-05-21 12:56:54 -04:00
** To update to a specific version:
+
2020-08-10 16:20:47 -04:00
[source,terminal]
----
$ oc adm upgrade --to=<version> <1>
----
<1> `<version>` is the update version that you obtained from the output of the
previous command.
. Review the status of the Cluster Version Operator:
+
2020-08-10 16:20:47 -04:00
[source,terminal]
----
$ oc get clusterversion -o json|jq ".items[0].spec"
2020-08-10 16:20:47 -04:00
----
+
.Example output
[source,terminal]
----
{
"channel": "stable-4.6",
2019-06-19 16:36:40 -04:00
"clusterID": "990f7ab8-109b-4c95-8480-2bd1deec55ff",
"desiredUpdate": {
2019-06-19 16:36:40 -04:00
"force": false,
"image": "quay.io/openshift-release-dev/ocp-release@sha256:9c5f0df8b192a0d7b46cd5f6a4da2289c155fd5302dec7954f8f06c878160b8b",
"version": "4.6.3" <1>
},
2019-06-19 16:36:40 -04:00
"upstream": "https://api.openshift.com/api/upgrades_info/v1/graph"
}
----
<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.
+
2020-08-10 16:20:47 -04:00
[source,terminal]
----
$ oc get clusterversion -o json|jq ".items[0].status.history"
2020-08-10 16:20:47 -04:00
----
+
.Example output
[source,terminal]
----
[
{
2019-05-29 20:07:59 -04:00
"completionTime": null,
2019-06-19 16:36:40 -04:00
"image": "quay.io/openshift-release-dev/ocp-release@sha256:9c5f0df8b192a0d7b46cd5f6a4da2289c155fd5302dec7954f8f06c878160b8b",
"startedTime": "2020-11-10T20:30:50Z",
2019-05-29 20:07:59 -04:00
"state": "Partial",
2019-06-19 16:36:40 -04:00
"verified": true,
"version": "4.1.2"
},
{
"completionTime": "2020-11-10T20:30:50Z",
2019-06-19 16:36:40 -04:00
"image": "quay.io/openshift-release-dev/ocp-release@sha256:b8307ac0f3ec4ac86c3f3b52846425205022da52c16f56ec31cbe428501001d6",
"startedTime": "2020-11-10T17:38:10Z",
2019-05-21 12:56:54 -04:00
"state": "Completed",
"verified": false,
2019-06-19 16:36:40 -04:00
"version": "4.1.0"
}
]
----
+
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.
+
[IMPORTANT]
====
If an upgrade fails, the Operator stops and reports the status of the failing
component. Rolling your cluster back to a previous version is not supported.
2019-05-21 15:18:26 -04:00
If your upgrade fails, contact Red Hat support.
====
2019-05-21 15:34:48 -04:00
. After the update completes, you can confirm that the cluster version has
updated to the new version:
+
2020-08-10 16:20:47 -04:00
[source,terminal]
----
2019-05-21 15:34:48 -04:00
$ oc get clusterversion
2020-08-10 16:20:47 -04:00
----
+
.Example output
[source,terminal]
----
2019-05-21 15:34:48 -04:00
NAME VERSION AVAILABLE PROGRESSING SINCE STATUS
version 4.6.3 True False 2m Cluster version is 4.6.3
----