title: What is the correct way to mount a hostpah volume with gitlab runner?
body: <p>I need to create a volume to expose the maven .m2 folder to be reused in all my projects but I can't do that at all.</p>
  
  <p>My gitlab runner is running inside my kuberentes cluster as a container.</p>
  
  <p>Follows Deployment and configmap</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: gitlab-runner
    namespace: default
  spec:
    template:
      metadata:
        labels:
          name: gitlab-runner
      spec:
        serviceAccountName: gitlab-sa
        nodeName: 140.6.254.244
        containers:
          - name: gitlab-runner
            image: gitlab/gitlab-runner
            securityContext:
              privileged: true
            command: ["/bin/bash", "/scripts/entrypoint"]
            env:
              - name: KUBERNETES_NAMESPACE
                value: default 
              - name: KUBERNETES_SERVICE_ACCOUNT
                value: gitlab-sa
            # This references the previously specified configmap and mounts it as a file
            volumeMounts:
              - mountPath: /scripts
                name: configmap
            livenessProbe:
              exec:
                command: ["/usr/bin/pgrep","gitlab.*runner"]
              initialDelaySeconds: 60
              timeoutSeconds: 1
              periodSeconds: 10
              successThreshold: 1
              failureThreshold: 3
            readinessProbe:
              exec:
                command: ["/usr/bin/pgrep","gitlab.*runner"]
              initialDelaySeconds: 10
              timeoutSeconds: 1
              periodSeconds: 10
              successThreshold: 1
              failureThreshold: 3
  
        volumes:
        - configMap:
            name: gitlab-runner-cm
          name: configmap
  
  </code></pre>
  
  <p>ConfigMap:</p>
  
  <pre><code>---
  apiVersion: v1
  kind: ConfigMap
  metadata:
    name: gitlab-runner-cm
    namespace: default 
  data:
    entrypoint: |
      #!/bin/bash
  
      set -xe
  
      cp /scripts/config.toml /etc/gitlab-runner/
  
      # Register the runner
      /entrypoint register --non-interactive --registration-token ###### --url http://gitlab.######.net --clone-url http://gitlab.######.net --executor "kubernetes" --name "Kubernetes Runner" --config "/etc/gitlab-runner/config.toml"
  
      # Start the runner
      /entrypoint run --user=gitlab-runner \
        --working-directory=/home/gitlab-runner \
        --config "/etc/gitlab-runner/config.toml"
    config.toml: |
      concurrent = 50 
      check_interval = 10
      [[runners]]
        name            = "PC-CVO"
        url             = "http://gitlab.######.net"
        token           = "######"
        executor = "kubernetes"
        cache_dir = "/tmp/gitlab/cache"
        [runners.kubernetes]
          [runners.kubernetes.volumes]
            [[runners.kubernetes.volumes.host_path]]
              name = "maven"
              mount_path = "/.m2/"
              host_path = "/mnt/dados/volumes/maven-gitlab-ci"
              read_only = false
  
            [[runners.kubernetes.volumes.host_path]]
              name = "gitlab-cache"
              mount_path = "/tmp/gitlab/cache"
              host_path = "/mnt/dados/volumes/maven-gitlab-ci-cache"
              read_only = false
  
  
  
  </code></pre>
  
  <p>But even putting [[runners.kubernetes.volumes.host_path]] as informed in the documentation my volume is not mounted on the host, I tried to use a pv and pvc, but nothing worked, anyone has a light on how to expose this .m2 folder on the host so all my jobs can share it without caching?</p>