0

I'm trying to deploy my project on kubernetes using gitlab runner but I keep getting the following error:

but when I check the logs using $ kubectl logs -f runner-gitlab I get the following infos:

WARNING: Job failed: command terminated with exit code 1 duration=51.567457707s job=296652672 project=14223129 runner=NzxLg7uo ERROR: Failed to process runner builds=0 error=command terminated with exit code 1 executor=kubernetes runner=NzxLg7uo

Anyone faced this before?

Kos
  • 4,890
  • 9
  • 38
  • 42
  • 1
    We need more information. Is that the full logs? Can you please post the text and not a screenshot? Can you post the entire `deploy.yml` file? What kind of application is running (provide some information about the application and what the end result should be / what kind of resources it might be using or depend on). – Andy Shinn Sep 17 '19 at 01:37
  • It looks like you are doing some custom `KUBECONFIG` management, which is different than the way GitLab expects that to work; however, the message is as clear as can be: the `gitlab-managed-apps:default` `ServiceAccount` does not have (likely **any**) the correct `RoleBinding` to be able to interact with `Deployments` in that namespace. You'll have to assign it the necessary `Role`, or use a `ServiceAccount` designed to deploy your app – mdaniel Sep 17 '19 at 04:29
  • Possible duplicate: [kubernetes - deployments.apps is forbidden: User "system:serviceaccount:default:default" cannot create deployments.apps in the namespace - Stack Overflow](https://stackoverflow.com/questions/49173838/deployments-apps-is-forbidden-user-systemserviceaccountdefaultdefault-cann) – Yasen Sep 17 '19 at 04:54
  • thank you for clearing the idea to me: that issue was in fact a problem with gitlab-managed-apps, I managed to fix thins by following this [link](https://gitlab.com/gitlab-org/gitlab-foss/issues/55933/designs) – Firas Chbiki Sep 17 '19 at 11:11

1 Answers1

0

As @Firas Chbiki mentioned in the comments the issue has been solved by applying ClusterRoleBinding Kubernetes RBAC assignment , granting the permissions, enclosed in cluster-admin ClusterRole, to the particular gitlab-managed-apps:default service account, as described here.

This solution confirmed by the community members in #56557 and #61116 threads. Thanks @Andy Shinn, @Matthew L Daniel, @Yasen for their efforts and collaboration.

Nick_Kh
  • 5,089
  • 2
  • 10
  • 16