<p>I am trying to follow this short doc about how to use Gitlab CI with a Kubernetes Cluster that I am creating with Openstack: <a href="https://docs.gitlab.com/runner/install/kubernetes.html" rel="nofollow noreferrer">https://docs.gitlab.com/runner/install/kubernetes.html</a>  </p>

<p>I manage to create it but any time I create the ConfigMap and Deployment as specified in the previous link the pods it creates are stuck in a CrashLoopBackOff like this:</p>

<pre><code>NAMESPACE     NAME                                            READY     STATUS             RESTARTS   AGE
gitlab        gitlab-runner-3998042981-f8dlh                  0/1       CrashLoopBackOff   36         2h
gitlab        gitlab-runner-3998042981-g9m5g                  0/1       CrashLoopBackOff   36         2h
gitlab        gitlab-runner-3998042981-q0bth                  0/1       CrashLoopBackOff   36         2h
gitlab        gitlab-runner-3998042981-rjztk                  0/1       CrashLoopBackOff   36         2h
kube-system   coredns-1977636023-1q47s                        1/1       Running            0          21h
kube-system   grafana-1173934969-vw49f                        1/1       Running            0          21h
kube-system   node-exporter-gitlab-ci-hc6k3ffax54o-minion-0   1/1       Running            0          21h
kube-system   node-exporter-gitlab-ci-hc6k3ffax54o-minion-1   1/1       Running            0          21h
kube-system   prometheus-873144915-s9m6j                      1/1       Running            0          21h
</code></pre>

<p>My problem is that I am not able to know why this happens since pod logs are not available when they are not created. </p>

<p>Apart from that I just do not know what to do with the specified volumes since I just think this has some relation with the crashloops.</p>

<p>Deployment specifies:</p>

<pre><code>- configMap:
      name: gitlab-runner
    name: config
  - hostPath:
      path: /usr/share/ca-certificates/mozilla
    name: cacerts
</code></pre>

<p>I have found that:</p>

<blockquote>
  <p>A hostPath volume mounts a file or directory from the host node’s
  filesystem into your pod</p>
</blockquote>

<p>After running the pods without the cacerts volume everything is created but afterwards no job will be executed.</p>

<p>Log from any pod:</p>

<pre><code>Starting multi-runner from /etc/gitlab-runner/config.toml ...  builds=0
Running in system-mode.

Configuration loaded                                builds=0
Metrics server disabled
ERROR: Checking for jobs... forbidden               runner=&lt;PARTOFTHETOKEN&gt;
ERROR: Checking for jobs... forbidden               runner=&lt;PARTOFTHETOKEN&gt;
ERROR: Checking for jobs... forbidden               runner=&lt;PARTOFTHETOKEN&gt;
ERROR: Runner https://URL/ci&lt;TOKEN&gt; is not healthy and will be disabled!
</code></pre>

<p>Actual docs about having Gitlab CI running on a kubernetes cluster are not clear enough. </p>

<p>You need to run somewhere gitlab-runner register with the token you get from the Runner's admin page of your Gitlab instance and grab another token from resulting config (cat /etc/gitlab-runner/config.toml | grep token) and paste it into your deployment config so it can now receive jobs from CI.</p>

<blockquote>
  <p>UPDATE 2019: gitlab.com docs now make it clear:
  <a href="https://docs.gitlab.com/runner/register/#gnulinux" rel="nofollow noreferrer">https://docs.gitlab.com/runner/register/#gnulinux</a></p>
</blockquote>
