Task
During network troubleshooting it may be useful to increase the log level of the Canal components. This article details how to set verbose debug-level Canal 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 Canal Network Provider
Resolution
N.B. As these instructions involve editing the Canal 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 Canal component log level can be adjusted via the Rancher UI, per the following process:
- Navigate to the
System
project of the relevant cluster within the Rancher UI. - Locate the canal DaemonSet workload within the
kube-system
namespace, click the vertical elipses (⋮
) and select Edit. - Click to Edit the
calico-node
container. - Add
CALICO_STARTUP_LOGLEVEL = DEBUG
in the Environment Variables section and clickSave
. - Click Edit for the canal DaemonSet again.
- This time click to Edit the
kube-flannel
container. - Click
Show advanced options
. - In the Command section add
--v=10
to theEntrypoint
e.g.:/opt/bin/flanneld --ip-masq --kube-subnet-mgr --v=10
, 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 Canal component log level can be adjusted via kubectl, per the following process:
- Run
kubectl -n kube-system edit daemonset canal
. - In the
env
definition for thecalico-node
container add an environment variable with the nameCALICO_STARTUP_LOGLEVEL
and valueDEBUG
, e.g.:[...] containers: - env: [...] - name: CALICO_STARTUP_LOGLEVEL value: DEBUG [...]
- In the
command
definition for thekube-flannel
container add--v=10
to the command, e.g.:[...] - commmand: - /opt/bin/flanneld - --ip-masq - --kube-subnet-mgr - --v=10 [...]
- Save the file.
Comments
Please sign in to leave a comment.