How to change openshift-sdn loglevel in OpenShift 4.5+?

Solution Verified - Updated

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4.5+
  • Container Network Interface (CNI)
    • OpenShift SDN

Issue

  • How to increase the log level of the OpenShift SDN in OpenShift 4?
  • As an administrator to debug an issue increasing the loglevel of the sdn in required

Resolution

  • This article is intended for OpenShift Container Platform 4.5+. To raise the sdn loglevel in OpenShift Container Platform 4.4 or earlier, please follow article 5311361.

  • To raise the sdn loglevel in OpenShift Container Platform 3, visit this article.

  • Create a ConfigMap named env-overrides in openshift-sdn namespace specifying the name(s) of the node(s) you want to set the debug loglevel on and/or _master in order to change the sdn-controller log level:

   kind: ConfigMap
   apiVersion: v1
   metadata:
     name: env-overrides
     namespace: openshift-sdn
   data:
     _master: |
       OPENSHIFT_SDN_LOG_LEVEL=5
     ip-10-0-135-96.us-east-2.compute.internal: |
       OPENSHIFT_SDN_LOG_LEVEL=5
     ip-10-0-101-42.us-east-2.compute.internal: |
       OPENSHIFT_SDN_LOG_LEVEL=5
  • Restart the sdn and/or sdn-controller pods to pickup the new loglevel:
   oc delete pod -n openshift-sdn -l app=sdn --field-selector spec.nodeName=ip-10-0-135-96.us-east-2.compute.internal 
   oc delete pod -n openshift-sdn -l app=sdn --field-selector spec.nodeName=ip-10-0-101-42.us-east-2.compute.internal 
   oc delete pod -n openshift-sdn -l app=sdn-controller
  • Note that restarting an openshift-sdn pod may cause a connectivity glitch on the node. In case any sensitive workload is running on the node it is recommended to drain it first and uncordon it afterwards.

Root Cause

  • The default loglevel for openshift-sdn is 2
  • The recommended loglevel if you need to debug the openshift-sdn is 5

Diagnostic Steps

Check if there is any custom log level by checking on the config map:

oc -n openshift-sdn get cm/env-overrides -o yaml
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.