How to change openshift-sdn loglevel in OpenShift 4.5+?
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 SDNin OpenShift 4? - As an administrator to debug an issue increasing the
loglevelof thesdnin required
Resolution
-
This article is intended for OpenShift Container Platform 4.5+. To raise the
sdnloglevelin OpenShift Container Platform 4.4 or earlier, please follow article 5311361. -
To raise the
sdnloglevelin OpenShift Container Platform 3, visit this article. -
Create a
ConfigMapnamedenv-overridesinopenshift-sdnnamespace specifying the name(s) of the node(s) you want to set the debugloglevelon and/or_masterin order to change thesdn-controllerlog 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
sdnand/orsdn-controllerpods to pickup the newloglevel:
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-sdnpod may cause a connectivity glitch on the node. In case any sensitive workload is running on the node it is recommended todrainit first anduncordonit afterwards.
Root Cause
- The default
loglevelforopenshift-sdnis2 - The recommended
loglevelif you need todebugtheopenshift-sdnis5
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
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.