How to increase the log level for Calico components in a Rancher Kubernetes Engine (RKE) or Rancher v2.x provisioned Kubernetes cluster

Follow
Table of Contents

Task

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.

Pre-requisites

  • A Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x provisioned Kubernetes cluster with the Calico Network Provider

Resolution

N.B. As these instructions involve editing the Calico DaemonSet directly, the change will not persist cluster update events, i.e. invocations of rke up for RKE CLI provisioned clusters, or changes to the cluster configuration for a Rancher provisioned cluster. 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:

  1. Navigate to the System project of the relevant cluster within the Rancher UI.
  2. Locate the calico DaemonSet workload within the kube-system namespace, click the vertical elipses () and select Edit.
  3. Click to Edit the calico-node container.
  4. Add CALICO_STARTUP_LOGLEVEL = DEBUG ,F​ELIX_LOGSEVERITYSCREEN = Debug, BGP_LOGSEVERITYSCREEN = Debug in Environment Variables section and click Save.

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:

  1. Run kubectl -n kube-system edit daemonset calico-node.
  2. In the env definition for the calico-node container add an environment variable with the name CALICO_STARTUP_LOGLEVEL and value DEBUG,F​ELIX_LOGSEVERITYSCREEN and value Debug and BGP_LOGSEVERITYSCREEN and value Debug, e.g.:
    [...]
          containers:
          - env:
            [...]
            - name: CALICO_STARTUP_LOGLEVEL
              value: DEBUG
            - name: BGP_LOGSEVERITYSCREEN
              value: Debug
            - name: FELIX_LOGSEVERITYSCREEN
              value: Debug
    [...]
  3. Save the file.

Further reading

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.