To filter Kubernetes events by user, you can use the --field-selector option with the user field. However, it's important to note that the user field is not directly available in the standard event output. Instead, you can filter by the user field in the context of the involvedObject if the event is related to a specific action taken by a user.
For example, if you want to filter events based on the user who triggered them, you can use the following command:
kubectl get events --field-selector user=<username>
Replace <username> with the actual username you want to filter by.
However, if you want to see events related to a specific user action, you may need to look for events that include the user's actions in the message or reason fields, as user information may not always be explicitly included in the event metadata.
If you are looking for more detailed audit logs that include user actions, you might want to enable and query Kubernetes audit logs instead, as they provide comprehensive information about user interactions with the cluster.
