Search code examples
gitlabgitlab-cikubernetes-helmamazon-eksgitlab-ci-runner

User "system:serviceaccount:gitlab-runner:default" cannot list resource "events" in API group "" in the namespace "gitlab-runner"


I am trying to setup gitlab runner with my aws eks cluster. I have been able to create the namesapces without any problem. However, when I trigger the gitlab cicd pipeline I get the below error.

ERROR: Error retrieving events list: events is forbidden: User "system:serviceaccount:gitlab-runner:default" cannot list resource "events" in API group "" in the namespace "gitlab-runner".

Here is my gitlab-runner-role.yaml file

piVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: gitlab-runner
  namespace: gitlab-runner
rules:
  - apiGroups: [""]
    resources: ["pods", "pods/exec", "pods/log", "pods/attach", "secrets", "events"]
    verbs: ["list", "get", "watch", "create", "delete", "update"]

Any help on why I am getting this error and how I can fix the issue.


Solution

  • This seems to be something new with GitLab 16.2 - we didn't have this problem before we upgraded the runners to the latest version.

    For our runners, I just added "events" to our helm chart values file (the rbac - rules - resources section) and did a helm upgrade to apply the changes.