Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

gitlab - Bind docker socket with a Kubernetes runner and share volume

I'm using gitlab runner install with Helm and running on Google Cloud Kubernetes engine.

Here my runner configuration inside my values.yaml file :

runners:
  config: |
    [[runners]]
      [runners.kubernetes]
        image = "ubuntu:16.04"
        [[runners.kubernetes.volumes.host_path]]
          name = "docker-sock"
          mount_path = "/var/run/docker.sock"
          host_path = "/var/run/docker.sock"

When i launch a build where i share volume with the host, i receive this error :

ERROR: for c2abac41f403_******_haproxy_1  Cannot start service haproxy: error while creating mount source path '/builds/****/****/docker/test/haproxy.cfg': mkdir /builds: read-only file system

So i decide to add a volume pvc to my runner configuration

...
        [[runners.kubernetes.volumes.pvc]]
          name = "runner-claim"
          mount_path = "/builds"
...

But i receive this error :

Pod "runner-7vyyjqpv-project-8275433-concurrent-0dhn9h" is invalid: [spec.containers[0].volumeMounts[2].mountPath: Invalid value: "/builds": must be unique, spec.containers[1].volumeMounts[2].mountPath: Invalid value: "/builds": must be unique]

My goal is to use docker socket instead of docker in docker to have better performance.

Could you help me.

Best regards

question from:https://stackoverflow.com/questions/66067632/bind-docker-socket-with-a-kubernetes-runner-and-share-volume

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I would give a try with the solution from @viniciusxyz that was posted here. Seems that he was facing the same issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...