guys I want to watch all kubernetes events and I find the source code here: https://github.com/kubernetes/client-go/blob/master/informers/events/v1beta1/event.go
However, I can not find any examples about how to use the functions. Can anyone help me, thanks a lot!
One or several of these could help:
"watches" for (quote) "...efficient change notifications on resources" - see Kubernetes API Concepts as well as the API Reference for a particular version. Example: GET /api/v1/namespaces/test/pods?watch=1&resourceVersion=10245
Event Read Operations.
kubectl get
allows you to specify the -w or --watch flag to start watching updates to a particular object.
I believe the events are for a particular resource or collection of resources, not for all resources.
I’d like to collect the event logs with kubectl
or REST API[2] as JSON, then you can send the logs to fluentd
for centralized monitoring such as Elasticsearch.
Here is a good sample;[0], though it's OpenShift, but if oc
cmd replace with kubectl
cmd, it's same with Kubernetes. (Yeah, OpenShift is Enterprise Kubernetes).
[1] is how to implement the fluentd
- Elasticsearch
stack.
I hope this help you.