This tool simply watches Kubernetes Events and logs them to stdout in JSON to be collected and stored by your logging solution, e.g. fluentd or fluent-bit. Other tools exist for persisting Kubernetes Events, such as Sysdig, Datadog or Google's event-exporter but this tool is open and will work with any logging solution.
Events in Kubernetes log very important information. If are trying to understand what happened in the past then these events show clearly what your Kubernetes cluster was thinking and doing. Some examples:
- Pod events like failed probes, crashes, scheduling related information like
TriggeredScaleUp
orFailedScheduling
- HorizontalPodAutoscaler events like scaling up and down
- Deployment events like scaling in and out of ReplicaSets
- Ingress events like create and update
The problem is that these events are simply API objects in Kubernetes and are only stored for about 1 hour. Without some way of storing these events, debugging a problem in the past very tricky.
Example of events:
39m Normal UpdatedLoadBalancer Service Updated load balancer with new hosts
40m Normal SuccessfulDelete DaemonSet Deleted pod: ingress02-nginx-ingress-controller-vqqjp
41m Normal ScaleDown Node node removed by cluster autoscaler
54m Normal Started Pod Started container
55m Normal Starting Node Starting kubelet.
55m Normal Starting Node Starting kube-proxy.
55m Normal NodeAllocatableEnforced Node Updated Node Allocatable limit across pods
55m Normal NodeReady Node Node ip-10-0-23-14.compute.internal status is now: NodeReady
58m Normal SuccessfulCreate DaemonSet Created pod: ingress02-nginx-ingress-controller-bz7xj
58m Normal CREATE ConfigMap ConfigMap default/ingress02-nginx-ingress-controller
Use the Helm chart:
helm install chart/
Or user the docker image maxrocketinternet/k8s-event-logger
Run it:
go run main.go