この投稿は、以下の更新版です。
Red Hat OpenShift Container Platform (OCP) では製品の Life Cycle Policy が明確に定義されており、これに従って定期的に Update Release が提供されます。
Red Hat OpenShift Container Platform Life Cycle Policy
https://access.redhat.com/support/policy/updates/openshift
また、OCP の Update には Upgrade Path (または Update Path) が設定されており、Update Path を確認した上で目的の Release (Cluster Version) に Update する必要があります。Update Path は以下から確認することができます。
OpenShift Container Platform (OCP) 4 upgrade paths
https://access.redhat.com/solutions/4583231
Red Hat OpenShift Container Platform Update Graph
https://access.redhat.com/labs/ocpupgradegraph/update_channel
ここでは、oc
コマンドと、上記 Link 先に記載されている curl
コマンドを併用した Update Path の確認方法をご紹介します。
現在の Release (Cluster Version) の確認
以下のコマンドで現在の Release を確認します。
$ oc get clusterversion
NAME VERSION AVAILABLE PROGRESSING SINCE STATUS
version 4.17.15 True False 96d Cluster version is 4.17.15
Update Path の確認
OCP Console
現在の Release からの Update Path は、OCP Console で確認することができます。
+More
をクリックすると、全ての Update Path が確認できます。
Channel
の箇所にあるペンシルアイコンをクリックすることで Update Channel を変更することができます。
ここでは、4.17.15
を 4.18.11
に Update するため、stable-4.18
を設定します。Update Path の表示が、先程は Gray Out されていた stalbe-4.18 channel
のみに変更されます。
Red Hat OpenShift Container Platform Update Graph
以下で提供されている Update Path を視覚的に確認できるツールを使用してみます。
Red Hat OpenShift Container Platform Update Graph
https://access.redhat.com/labs/ocpupgradegraph/update_channel
Update Path
でそれぞれの項目で先程の情報を選択して Generate
ボタンを押すと、両者間の Update が可能であること、4.18.11
に2つの Known Issue
があることが分かります。
Update Graph
では、同様の情報を樹形図形式で確認することができます。
図上では 4.17.15
と 4.18.11
が線で結ばれておらず、右側のリストで 4.18.11
が赤字で表示され Known Issue
があることが分かります。このような場合、oc adm upgrade
実行時に --allow-not-recommended
を追加する必要があります。
$ oc adm upgrade --to=4.18.11 --allow-not-recommended
以下のような場合は --allow-not-recommended
は不要です。
なお、複数回の Update が必要な場合は、以下のように表示されます。例として 4.16.10
から 4.18.13
への Update Path
を表示してみます。
Update Graph
では、To
の一覧に 4.18.13
が存在しないことが分かります。
上記は、以下で提供される graph.sh
と curl
コマンドの組み合わせでも取得できます。
oc コマンド
OCP Console で確認した内容は、oc
コマンドでも確認可能です。
なお、下記の情報は最新 Release が 4.18.11
の時点で取得したものです。
現在の Release からの Update Path は clusterversion.status.availableUpdates
に記載されています。なお、.channels
は、現在の Version ではなく Update 後の Version で選択可能な Update Channel になります。
$ oc -o json get clusterversion | jq -r '.items[].status.availableUpdates | sort_by(.version)'
[
{
"channels": [
"candidate-4.17",
"candidate-4.18",
"eus-4.18",
"fast-4.17",
"fast-4.18",
"stable-4.17",
"stable-4.18"
],
"image": "quay.io/openshift-release-dev/ocp-release@sha256:7e8b4557c0a15765440c543ab50cd591bb94f0745c20564e5f15d57bf5f76a82",
"url": "https://access.redhat.com/errata/RHSA-2025:3297",
"version": "4.17.23"
},
{
"channels": [
"candidate-4.17",
"candidate-4.18",
"eus-4.18",
"fast-4.17",
"fast-4.18",
"stable-4.17",
"stable-4.18"
],
"image": "quay.io/openshift-release-dev/ocp-release@sha256:65fbb79f801b621121793d347e4405d52edf114d7eea4f4b8c11115db57e5aa4",
"url": "https://access.redhat.com/errata/RHSA-2025:3565",
"version": "4.17.24"
},
{
"channels": [
"candidate-4.17",
"candidate-4.18",
"eus-4.18",
"fast-4.17",
"fast-4.18",
"stable-4.17",
"stable-4.18"
],
"image": "quay.io/openshift-release-dev/ocp-release@sha256:61b5415f1395d5b1266621031ff0d57969f7d086d1da5847e60b6ef549d692f6",
"url": "https://access.redhat.com/errata/RHSA-2025:3798",
"version": "4.17.25"
},
{
"channels": [
"candidate-4.17",
"candidate-4.18",
"eus-4.18",
"fast-4.17",
"fast-4.18",
"stable-4.17",
"stable-4.18"
],
"image": "quay.io/openshift-release-dev/ocp-release@sha256:a659df5d19dcdbc7fd9ede710b213cf5b269c31612d1b5ae3d01a8e5e5619bfc",
"url": "https://access.redhat.com/errata/RHSA-2025:4012",
"version": "4.17.26"
},
{
"channels": [
"candidate-4.17",
"candidate-4.18",
"eus-4.18",
"fast-4.17",
"fast-4.18",
"stable-4.17",
"stable-4.18"
],
"image": "quay.io/openshift-release-dev/ocp-release@sha256:f225d0f0fd7d4509ed00e82f11c871731ee04aecff7d924f820ac6dba7c7b346",
"url": "https://access.redhat.com/errata/RHSA-2025:4204",
"version": "4.17.27"
}
]
また、oc adm upgrade
コマンド(オプション指定なし)でも確認可能です。
$ oc adm upgrade
Cluster version is 4.17.15
Upstream is unset, so the cluster will use an appropriate default.
Channel: stable-4.18 (available channels: candidate-4.17, candidate-4.18, eus-4.18, fast-4.17, fast-4.18, stable-4.17, stable-4.18)
Recommended updates:
VERSION IMAGE
4.17.27 quay.io/openshift-release-dev/ocp-release@sha256:f225d0f0fd7d4509ed00e82f11c871731ee04aecff7d924f820ac6dba7c7b346
4.17.26 quay.io/openshift-release-dev/ocp-release@sha256:a659df5d19dcdbc7fd9ede710b213cf5b269c31612d1b5ae3d01a8e5e5619bfc
4.17.25 quay.io/openshift-release-dev/ocp-release@sha256:61b5415f1395d5b1266621031ff0d57969f7d086d1da5847e60b6ef549d692f6
4.17.24 quay.io/openshift-release-dev/ocp-release@sha256:65fbb79f801b621121793d347e4405d52edf114d7eea4f4b8c11115db57e5aa4
4.17.23 quay.io/openshift-release-dev/ocp-release@sha256:7e8b4557c0a15765440c543ab50cd591bb94f0745c20564e5f15d57bf5f76a82
Additional updates which are not recommended for your cluster configuration are available, to view those re-run the command with --include-not-recommended.
現在の Update Channel は clusterversion.spec.channel
に記載されています。
$ oc get clusterversion -o jsonpath='{.items[].spec.channel}{"\n"}'
stable-4.18
選択可能な Update Channel は clusterversion.status.desired.channels
に記載されています。
$ oc get clusterversions -o json | jq -r '.items[].status.desired'
{
"channels": [
"candidate-4.17",
"candidate-4.18",
"eus-4.18",
"fast-4.17",
"fast-4.18",
"stable-4.17",
"stable-4.18"
],
"image": "quay.io/openshift-release-dev/ocp-release@sha256:68ffa083a5ab473d9fd87cedcb01c6f27740aad92de0ee39a7ac408da9a65857",
"url": "https://access.redhat.com/errata/RHSA-2025:0876",
"version": "4.17.15"
}
前述の OCP Console の代わりに、oc patch
コマンドでも Update Channel の変更が可能です。
$ oc get clusterversion -o jsonpath='{.items[].spec.channel}{"\n"}'
stable-4.17
$ oc patch clusterversion version --type json -p '[{"op": "add", "path": "/spec/channel", "value": "stable-4.18" }]'
clusterversion.config.openshift.io/version patched
$ oc get clusterversion -o jsonpath='{.items[].spec.channel}{"\n"}'
stable-4.18
curl コマンドによる Update Path の確認
先述の Link 先には、以下のような Update Path の確認方法が記載されています。
$ export CURRENT_VERSION=4.2.18;
$ export CHANNEL_NAME=fast-4.3;
$
$ curl -sH 'Accept:application/json' "https://api.openshift.com/api/upgrades_info/v1/graph?channel=${CHANNEL_NAME}" | jq -r --arg CURRENT_VERSION "${CURRENT_VERSION}" '. as $graph | $graph.nodes | map(.version=='\"$CURRENT_VERSION\"') | index(true) as $orig | $graph.edges | map(select(.[0] == $orig)[1]) | map($graph.nodes[.].version) | sort_by(.)'
[
"4.2.19",
"4.3.1"
]
$
簡単な Bash Script を作成して、Update Path を確認してみます。
$ cat chkpath.sh
#!/bin/bash
[[ $# < 2 ]] && { echo "Usage: $(basename $0) CURRENT_VERSION CHANNEL_NAME"; exit 0; }
CURRENT_VERSION=$1
CHANNEL_NAME=$2
curl -sH 'Accept:application/json' "https://api.openshift.com/api/upgrades_info/v1/graph?channel=${CHANNEL_NAME}" |
jq -r --arg CURRENT_VERSION "${CURRENT_VERSION}" '. as $graph | $graph.nodes | map(.version=='\"$CURRENT_VERSION\"') |
index(true) as $orig | $graph.edges | map(select(.[0] == $orig)[1]) | map($graph.nodes[.].version) | sort_by(.)'
$ chkpath.sh 4.17.15 stable-4.18
[
"4.17.23",
"4.17.24",
"4.17.25",
"4.17.26",
"4.17.27"
]
先程確認した clusterversion.status.availableUpdates
の Update Path を確認してみます。
$ for V in $(oc -o json get clusterversion | jq -r '[.items[].status.availableUpdates[].version] | sort_by(.) | .[]')
do
echo -e "\n=== VER: $V ==="
for C in $(oc -o json get clusterversion | jq -r --arg V $V '.items[].status.availableUpdates[] | select(.version == $V) | .channels[]')
do
printf %20s "$C : "
chkpath.sh $V $C | jq -rc .
done
done
=== VER: 4.17.23 ===
candidate-4.17 : ["4.17.24","4.17.25","4.17.26","4.17.27","4.17.28","4.17.29"]
candidate-4.18 : ["4.17.24","4.17.25","4.17.26","4.17.27","4.17.28","4.17.29","4.18.13"]
eus-4.18 : ["4.17.24","4.17.25","4.17.26","4.17.27"]
fast-4.17 : ["4.17.24","4.17.25","4.17.26","4.17.27","4.17.28","4.17.29"]
fast-4.18 : ["4.17.24","4.17.25","4.17.26","4.17.27","4.17.28","4.17.29","4.18.13"]
stable-4.17 : ["4.17.24","4.17.25","4.17.26","4.17.27","4.17.28"]
stable-4.18 : ["4.17.24","4.17.25","4.17.26","4.17.27"]
=== VER: 4.17.24 ===
candidate-4.17 : ["4.17.25","4.17.26","4.17.27","4.17.28","4.17.29"]
candidate-4.18 : ["4.17.25","4.17.26","4.17.27","4.17.28","4.17.29","4.18.13"]
eus-4.18 : ["4.17.25","4.17.26","4.17.27"]
fast-4.17 : ["4.17.25","4.17.26","4.17.27","4.17.28","4.17.29"]
fast-4.18 : ["4.17.25","4.17.26","4.17.27","4.17.28","4.17.29","4.18.13"]
stable-4.17 : ["4.17.25","4.17.26","4.17.27","4.17.28"]
stable-4.18 : ["4.17.25","4.17.26","4.17.27"]
=== VER: 4.17.25 ===
candidate-4.17 : ["4.17.26","4.17.27","4.17.28","4.17.29"]
candidate-4.18 : ["4.17.26","4.17.27","4.17.28","4.17.29","4.18.13"]
eus-4.18 : ["4.17.26","4.17.27"]
fast-4.17 : ["4.17.26","4.17.27","4.17.28","4.17.29"]
fast-4.18 : ["4.17.26","4.17.27","4.17.28","4.17.29","4.18.13"]
stable-4.17 : ["4.17.26","4.17.27","4.17.28"]
stable-4.18 : ["4.17.26","4.17.27"]
=== VER: 4.17.26 ===
candidate-4.17 : ["4.17.27","4.17.28","4.17.29"]
candidate-4.18 : ["4.17.27","4.17.28","4.17.29","4.18.13"]
eus-4.18 : ["4.17.27"]
fast-4.17 : ["4.17.27","4.17.28","4.17.29"]
fast-4.18 : ["4.17.27","4.17.28","4.17.29","4.18.13"]
stable-4.17 : ["4.17.27","4.17.28"]
stable-4.18 : ["4.17.27"]
=== VER: 4.17.27 ===
candidate-4.17 : ["4.17.28","4.17.29"]
candidate-4.18 : ["4.17.28","4.17.29","4.18.13"]
eus-4.18 : []
fast-4.17 : ["4.17.28","4.17.29"]
fast-4.18 : ["4.17.28","4.17.29","4.18.13"]
stable-4.17 : ["4.17.28"]
stable-4.18 : []
これによって、Update 後の Release における Update Path を確認することが可能です。