11. Update OpenShift Flashcards

1
Q
  1. Update an OpenShift cluster
A

Upgrade Cluster: oc adm upgrade
# prior update add-ons operators
## Be sure to update all operators that are installed through the OLM to the latest version before updating the OpenShift cluster.

# get the current version
oc get clusterversion
NAME VERSION AVAILABLE PROGRESSING SINCE STATUS
version 4.12.0 True False 43d Cluster version is 4.12.0

oc get clusterversion -o jsonpath=’{.items[0].spec.channel}{“\n”}’
stable-4.12
# if needed change the channel in the clusterversion, e.g: stable-4.13

# View the available updates and note the version number of the update to apply.
oc adm upgrade
Cluster version is 4.12.0

Updates:

VERSION IMAGE
4.12.1 quay.io/openshift-release-dev/ocp-release@sha256:…
…output omitted..

# Upgrade
oc adm upgrade –to-latest=true
oc adm upgrade –to=VERSION

# check CVO status
oc get clusterversion

# check cluster operator status
oc get clusteroperators
Failed Update : AdminAckRequired

Got this error when trying to upgrade from 4.12.0 to 4.12.35
To perform the ack for AdminAckRequired, update/patch the configmap admin-acks

AdminAckRequired
# display the configmap content
oc get cm admin-acks -n openshift-config -o yaml

### E.g: acknowledge the upgrade from 4.12 (K8S 1.25) to 4.13 (K8S 1.26)
oc -n openshift-config patch cm admin-acks –patch ‘{“data”:{“ack-4.12-kube-1.26-api-removals-in-4.13”:”true”}}’ –type=merge
Upgrading a cluster using the CLI documentation
OLM upgrading operators documentation
Openshift Container Platform LifeCycle Policy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. Identify deprecated Kubernetes API usage
A

Deprecated Apis
oc get apirequestcounts
# and check column REMOVEINRELEASE

# filter columns with awk
oc get apirequestcounts | awk ‘{if(NF==4){print $0}}’

NAME REMOVEDINRELEASE REQUESTSINCURRENTHOUR REQUESTSINLAST24H
cronjobs.v1beta1.batch
1.25 15 44
horizontalpodautoscalers.v2beta2.autoscaling
1.26 6 30
…output omitted…
Deprecated API Alerts in OpenShift

OpenShift includes two alerts that are triggered when a workload uses a deprecated API version:

APIRemovedInNextReleaseInUse : this alert is triggered for APIs that OpenShift Container Platform will remove in the next release.
APIRemovedInNextEUSReleaseInUse : this alert is triggered for APIs that OpenShift Container Platform Extended Update Support (EUS) will remove in the next release.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. Update OpenShift Operators
A

Subscription - InstallPlan
# get the new version from the operator subscription
oc get sub web-terminal -n openshift-operators -o yaml

...output omitted...
spec:
  channel: fast
  installPlanApproval: Manual
  name: web-terminal
  source: do280-catalog-redhat
  sourceNamespace: openshift-marketplace
  startingCSV: web-terminal.v1.5.1
status:
...output omitted...
  conditions:
...output omitted...
  - lastTransitionTime: "2022-11-24T13:46:21Z"
    reason: RequiresApproval
    status: "True"
    type: InstallPlanPending
  currentCSV: web-terminal.v1.6.0   # the latest available version in the channel.
  installPlanGeneration:
  installPlanRef:
    apiVersion: operators.coreos.com/v1alpha1
    kind: InstallPlan
    name: install-72vnw   # installPlanRef for the latest version
    namespace: openshift-operators
    resourceVersion: "194989"
    uid: 8dc979fe-936f-475a-8977-36d210c4da98
  installedCSV: web-terminal.v1.5.1  # current version
...output omitted...
  state: UpgradePending

# check the installplan content
oc get installplan -n openshift-operators install-72vnw -o yaml

apiVersion: operators.coreos.com/v1alpha1
kind: InstallPlan
...output omitted...
spec:
  approval: Manual
  approved: false
  clusterServiceVersionNames:
  - web-terminal.v1.6.0
  generation: 2
status:
...output omitted...

# Update the operator by patching the installplan
oc patch installplan install-72vnw –type merge \
–patch ‘{“spec”:{“approved”:true}}’

installplan.operators.coreos.com/install-72vnw patched

How well did you know this?
1
Not at all
2
3
4
5
Perfectly