Search code examples
dockerbuildcertificateopenshiftbuildconfiguration

OpenShift BuildConfiguration Error setting up cluster CA cert


I have an OpenShift Cluster running where I am trying to build a simple nodejs Dockerimage using the Docker BuildConfiguration strategy. Unfortunately, it fails when starting the first init-container (git-clone), as it expects a ca.crt

Error setting up cluster CA cert: open /var/run/secrets/kubernetes.io/serviceaccount/ca.crt: no such file or directory

It is a Docker-Build strategy, so I am not sure why it uses the git-clone init-step to begin with. I assume that the step expects a certificate for the git-repository or something like that.


Solution

  • There actually were two problems.

    1. The cluster policy dictated that automountServiceAccountToken:false must be set for all SAs. Since I cannot edit the build-pods, I had no way to set this value to true. For now I've disabled this check for my test-namespace.
    2. The BuildConfiguration is created with triggers for a (non-existing) git-repository. This causes the git-clone init-container to constantly fail and brick the build. I've removed the triggers by hand and now it starts as expected into the build-process.