I have a container cluster in Google Container Engine with Stackdriver logging agent enabled. It is correctly pulling stdout logs from my containers. Now I would like to change the fluentd config to specify a log parser so that the logs shown in the GCP Logging view will have the correct severity and component.
Following this Stackdriver logging guide from kubernetes.io, I have attempted to:
- Get the fluentd
ConfigMap
as a yml file - Added a new
<filter>
according to my log4js log format - Created a new
ConfigMap
named fluentd-cm-2 inkube-system
namespace - Edited the
DaemonSet
for fluentd and set itsConfigMap
to fluentd-cm-2. I did this usingkubectl edit ds
instead ofkubectl replace -f
because the latter failed with an error message: "the object has been modified", even after getting a fresh copy of theDaemonSet
yaml.
Unexpected result: The DaemonSet
is restarted, but its configuration is reverted back to the original ConfigMap
, so my changes did not take effect.
I have also tried editing the ConfigMap
directly (kubectl edit cm fluentd-gcp-config-v1.1 --namespace kube-system
) and saved it, but it was also reverted.
I noticed that the DaemonSet
and ConfigMap
for fluentd are tagged with addonmanager.kubernetes.io/mode: Reconcile
. I would conclude that GKE has overwritten my settings because of this "reconcile" mode.
So, my question is: how can I change the fluentd configuration in a Google Container Engine cluster, when the logging agent was installed by GKE on cluster provisioning?