k3s/cluster/addons/fluentd-gcp
Kubernetes Submit Queue f105ae3e6d
Merge pull request #63918 from cezarygerard/sd-event-exporter
Automatic merge from submit-queue (batch tested with PRs 63569, 63918, 63980, 63295, 63989). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

New event exporter config with support for new stackdriver resources

New event exporter, with support for use new and old stackdriver resource model.

This should also be cherry-picked to release-1.10 branch, as all  fluentd-gcp components support new and stackdriver resource model.

```release-note
Update event-exporter to version v0.2.0  that supports old (gke_container/gce_instance) and new (k8s_container/k8s_node/k8s_pod) stackdriver resources.
```
2018-05-18 09:54:16 -07:00
..
fluentd-gcp-image Update docs for user-guide 2017-06-27 12:21:49 +08:00
podsecuritypolicies Use runtime/default as default seccomp profile for unprivileged PodSecurityPolicy 2018-05-15 09:39:37 -07:00
OWNERS Remove crassirostris from owners and reviewers 2018-04-04 18:36:44 +02:00
README.md Review #1 2018-02-22 09:59:16 +01:00
event-exporter.yaml new event exporter config with support for new stackdriver resource types 2018-05-18 10:37:47 +02:00
fluentd-gcp-configmap-old.yaml Add support to ingest log entries to Stackdriver against new "k8s_container" and "k8s_node" resources. 2018-04-06 08:47:19 -04:00
fluentd-gcp-configmap.yaml Add support to ingest log entries to Stackdriver against new "k8s_container" and "k8s_node" resources. 2018-04-06 08:47:19 -04:00
fluentd-gcp-ds-sa.yaml Fix setting resources in fluentd-gcp plugin 2017-11-22 12:40:50 +01:00
fluentd-gcp-ds.yaml Use the logging agent's node name as the metadata agent URL. 2018-05-02 10:12:35 +02:00
scaler-deployment.yaml Increase CPU limit to 1000 millicores to support 100kb/s throughput. 2018-04-11 18:08:53 -04:00
scaler-policy.yaml Enable scaling fluentd-gcp resources using ScalingPolicy. 2018-02-09 14:33:33 +01:00
scaler-rbac.yaml Enable scaling fluentd-gcp resources using ScalingPolicy. 2018-02-09 14:33:33 +01:00

README.md

Stackdriver Logging Agent

==============

Stackdriver Logging Agent is a DaemonSet which spawns a pod on each node that reads logs, generated by kubelet, container runtime and containers and sends them to the Stackdriver. When logs are exported to the Stackdriver, they can be searched, viewed, and analyzed.

Learn more at: https://kubernetes.io/docs/tasks/debug-application-cluster/logging-stackdriver

Troubleshooting

In Kubernetes clusters in version 1.10.0 or later, fluentd-gcp DaemonSet can be manually scaled. This is useful e.g. when applications running in the cluster are sending a large volume of logs (i.e. over 100kB/s), causing fluentd-gcp to fail with OutOfMemory errors. Conversely, if the applications aren't generating a lot of logs, it may be useful to reduce the amount of resources consumed by fluentd-gcp, making these resources available to other applications. To learn more about Kubernetes resource requests and limits, see the official documentation (CPU, memory). The amount of resources requested by fluentd-gcp on every node in the cluster can be fetched by running following command:

$ kubectl get ds -n kube-system -l k8s-app=fluentd-gcp \
-o custom-columns=NAME:.metadata.name,\
CPU_REQUEST:.spec.template.spec.containers[].resources.requests.cpu,\
MEMORY_REQUEST:.spec.template.spec.containers[].resources.requests.memory,\
MEMORY_LIMIT:.spec.template.spec.containers[].resources.limits.memory

This will display an output similar to the following:

NAME                  CPU_REQUEST   MEMORY_REQUEST   MEMORY_LIMIT
fluentd-gcp-v2.0.15   100m          200Mi            300Mi

In order to change those values, a ScalingPolicy needs to be defined. Currently, only base values are supported (no automatic scaling). The ScalingPolicy can be created using kubectl. E.g. to set cpu request to 101m, memory request to 150Mi and memory limit to 400Mi:

$ cat <<EOF | kubectl apply -f -
apiVersion: scalingpolicy.kope.io/v1alpha1
kind: ScalingPolicy
metadata:
  name: fluentd-gcp-scaling-policy
  namespace: kube-system
spec:
  containers:
  - name: fluentd-gcp
    resources:
      requests:
      - resource: cpu
        base: 101m
      - resource: memory
        base: 150Mi
      limits:
      - resource: memory
        base: 400Mi
EOF

To remove the override and go back to GKE-provided defaults, it is enough to just remove the ScalingPolicy:

$ kubectl delete -n kube-system scalingpolicies.scalingpolicy.kope.io/fluentd-gcp-scaling-policy

Analytics