How to increase the log level for Calico components
Article Number: 000020063
Environment
Kubernetes cluster with the Calico Network Provider
Situation
During network troubleshooting it may be useful to increase the log level of the Calico components. This article details how to set verbose debug-level Calico component logging, in Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x provisioned Kubernetes clusters.
Resolution
N.B.
As these instructions involve editing the Calico DaemonSet directly, the change
will not persist cluster update events As a result cluster updates should be
avoided whilst collecting the debug level logs for troubleshooting.
Via the Rancher UI
For a Rancher v2.x managed cluster, the Calico component log level can be adjusted via the Rancher UI, per the following process:
- Navigate to the
Systemproject of the relevant cluster within the Rancher UI. - Locate the calico DaemonSet workload within the
kube-systemnamespace, click the vertical elipses (⋮) and select Edit. - Click to Edit the
calico-nodecontainer. - Add
CALICO_STARTUP_LOGLEVEL = DEBUG,FELIX_LOGSEVERITYSCREEN = Debug,BGP_LOGSEVERITYSCREEN = Debugin Environment Variables section and clickSave.
Via kubectl
With a Kube Config file sourced for the relevant cluster, for a user with permission to edit the System project, the Calico component log level can be adjusted via kubectl, per the following process:
- Run
kubectl -n kube-system edit daemonset calico-node. - In the
envdefinition for thecalico-nodecontainer add an environment variable with the nameCALICO_STARTUP_LOGLEVELand valueDEBUG,FELIX_LOGSEVERITYSCREENand valueDebugandBGP_LOGSEVERITYSCREENand valueDebug, e.g.:
[...]
containers:
- env:
[...]
- name: CALICO_STARTUP_LOGLEVEL
value: DEBUG
- name: BGP_LOGSEVERITYSCREEN
value: Debug
- name: FELIX_LOGSEVERITYSCREEN
value: Debug
[...]