Enhance K8s Executor Logs to Include Special Event Details in GitLab UI

Description

One of our users encountered an issue with the Kubernetes (K8s) executor involving the image used in a job. Unfortunately, the GitLab runner logs did not provide the necessary details for the user to troubleshoot the issue effectively.

We would like to request that the special type of events generated by K8s be included in the runner log outputs displayed in the GitLab UI. This enhancement will improve the troubleshooting experience by providing more comprehensive information directly within the GitLab interface.

Proposal:

Modify the GitLab runner to capture and include detailed K8s event information in the log outputs. Ensure these logs are accessible via the GitLab UI for easy troubleshooting.

Benefits:

Improved troubleshooting efficiency for users encountering issues with the K8s executor. Enhanced visibility into the specific errors and warnings generated by K8s. Reduction in time and effort required to diagnose and resolve issues related to K8s job execution.

Example Event:

7m23s Warning Failed pod/test Error: failed to create containerd container: mount callback failed on /var/lib/containerd/tmpmounts/containerd-mount384482177: no users found

Raw Event Data:

apiVersion: v1 kind: Event firstTimestamp: "2024-06-19T17:54:55Z" involvedObject: apiVersion: v1 fieldPath: spec.containers{test} kind: Pod name: test namespace: default resourceVersion: "126207229" uid: 47941f0c-6373-4820-a9a1-b9524615bcbe lastTimestamp: "2024-06-19T17:55:17Z" message: '(combined from similar events): Error: failed to create containerd container: mount callback failed on /var/lib/containerd/tmpmounts/containerd-mount276345642: no users found' metadata: name: test.17da7967f024104b namespace: default reason: Failed reportingComponent: "" reportingInstance: "" type: Warning source: component: kubelet host: ip-10-12-8-170.us-east-2.compute.internal

Additional Information:

If more details or examples are required, please let me know.