Kubernetes Event Tailer
Kubernetes events are objects that provide insight into what is happening inside a cluster, such as what decisions were made by the scheduler or why some pods were evicted from the node. Event tailer listens for Kubernetes events and transmits their changes to stdout, so the Logging operator can process them.
The operator handles this CR and generates the following required resources:
- ServiceAccount: new account for
event-tailer
- ClusterRole: sets the
event-tailer's
roles - ClusterRoleBinding: links the account with the roles
- ConfigMap: contains the configuration for the
event-tailer
pod - StatefulSet: manages the lifecycle of the
event-tailer
pod, which uses thebanzaicloud/eventrouter:v0.1.0
image to tail events
Create event tailer
-
The simplest way to init an
event-tailer
is to create a newevent-tailer
resource with aname
andcontrolNamespace
field specified. The following command creates an event tailer calledsample
: -
Check that the new object has been created by running:
Expected output:
-
You can see the events in JSON format by checking the log of the
event-tailer
pod. This way Logging operator can collect the events, and handle them as any other log. Run:The output should be similar to:
-
Once you have an
event-tailer
, you can bind your events to a specific logging flow. The following example configures a flow to route the previously createdsample-eventtailer
to thesample-output
.
Delete event tailer
To remove an unwanted tailer, delete the related event-tailer
custom resource. This terminates the event-tailer
pod. For example, run the following command to delete the event tailer called sample
:
Expected output:
Persist event logs
Event-tailer supports persist mode. In this case, the logs generated from events are stored on a persistent volume. Add the following configuration to your event-tailer spec. In this example, the event tailer is called sample
:
Logging operator manages the persistent volume of event-tailer automatically, you don’t have any further task with it. To check that the persistent volume has been created, run:
The output should be similar to:
Configuration options
For the detailed list of configuration options, see the EventTailer CRD reference.