How to increase the log level of the Cluster Version Operator in OpenShift 4

Solution Unverified - Updated

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4
  • Cluster Version Operator

Issue

  • To better troubleshoot the Cluster Version Operator, how can the log level of the Cluster Version Operator be increased?
  • Can the verbosity of the Cluster Version Operator be changed in OpenShift 4?

Resolution

Red Hat is aware of the desire to persistently configure the ClusterVersion Operator loglevel and feature ticket This content is not included.OTA-209 was opened to request this enhancement. Note that when or whether this feature may be implemented is subject to change.

Workaround


>**Disclaimer:** This procedure implies marking components as `unmanaged`, which is **not supported**. Please follow it only as per Red Hat Support or Red Hat Engineering instructions.

First, mark the the cluster-version-operator deployment within the openshift-cluster-version namespace as unmanaged by the cluster version operator. Otherwise, cluster version operator will reconcile its own deployment, reverting the log level back to default. The way to do so is:

$ oc patch clusterversion/version --type json -p '[{"op":"add","path":"/spec/overrides","value":[{"kind":"Deployment","group":"apps","name":"cluster-version-operator","namespace":"openshift-cluster-version","unmanaged": true}]}]'

Then, edit the cluster-version-operator deployment within the openshift-cluster-version namespace to change the --v= argument to a higher value. The verbosity levels range from 1 to 10.

  • One possible way to do so is with oc edit, like in the below example:

    $ oc edit -n openshift-cluster-version deploy/cluster-version-operator
    spec:
      template:
        spec:
          containers:
          - args:
            [...]
            - --v=8
    
  • Another way to do so is with this command:

    $ oc get -n openshift-cluster-version deploy/cluster-version-operator -o yaml | sed "s/   - --v=[[:digit:]]*/   - --v=8/gi" | oc apply -f -
    

Either way, you need to replace 8 with the desired log level.

Once the higher log level is no longer required, the override must be removed so that cluster version operator deployment becomes managed again. It can be done like this:

$ oc patch clusterversion/version --type json -p '[{"op":"remove","path":"/spec/overrides"}]'

Note: the command above will remove all the overrides.

Root Cause

Currently it is not possible to change the log verbosity of the Cluster Version Operator without setting it to unmanaged.

Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.