How do I change the ovn-kubernetes loglevel in OpenShift 4?

Solution Verified - Updated

Environment

  • Red Hat OpenShift Container Platform 4 using ovn-kubernetes

Issue

  • How do I increase the log level of OVN Kubernetes sdn in OpenShift 4?
  • As an administrator I need to increase the loglevel of the ovn-kubernetes sdn in order to debug an issue?

Resolution

This article is intended for OpenShift 4 using ovn-kubernetes, if you want to raise the sdn loglevel in OpenShift 4 for openshift-sdn, see this article How do I change openshift-sdn loglevel in OpenShift 4.5+? or How do I change openshift-sdn loglevel in OpenShift 4.4 and below? . If you want to raise the sdn loglevel in OpenShift 3, please visit this article.

Create a ConfigMap named env-overrides in the openshift-ovn-kubernetes namespace specifying the name(s) of the node(s) you want to set the debug loglevel on. You can also use _master to set the log levels of ovnkube-master components:

kind: ConfigMap
apiVersion: v1
metadata:
  name: env-overrides
  namespace: openshift-ovn-kubernetes
data:
  ip-10-0-135-96.us-east-2.compute.internal: |
    # This sets the log level for the ovn-kubernetes node process:
    OVN_KUBE_LOG_LEVEL=5
    # You might also/instead want to enable debug logging for ovn-controller:
    OVN_LOG_LEVEL=dbg
  ip-10-0-135-99.us-east-2.compute.internal: |
    # This sets the log level for the ovn-kubernetes node process:
    OVN_KUBE_LOG_LEVEL=5
    # You might also/instead want to enable debug logging for ovn-controller:
    OVN_LOG_LEVEL=dbg
  _master: |
    # This sets the log level for the ovn-kubernetes master process as well as the ovn-dbchecker:
    OVN_KUBE_LOG_LEVEL=5
    # You might also/instead want to enable debug logging for northd, nbdb and sbdb on all masters:
    OVN_LOG_LEVEL=dbg

Restart the ovnkube pods to pickup the new loglevel:

oc delete pod -n openshift-ovn-kubernetes --field-selector spec.nodeName=ip-10-0-135-96.us-east-2.compute.internal -l app=ovnkube-node
oc delete pod -n openshift-ovn-kubernetes --field-selector spec.nodeName=ip-10-0-135-99.us-east-2.compute.internal -l app=ovnkube-node
oc delete pod -n openshift-ovn-kubernetes -l app=ovnkube-master

Root Cause

  • The default loglevel for ovn-kubernetes is 4
  • The recommended loglevel if you need to debug ovn-kubernetes is 5
SBR
Components
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.