gitlab-runner
小于 1 分钟
安装
runner 的安装,在打开runner界面时,即可查看相关的手册
在K8S中安装
仓库添加
helm repo add gitlab https://charts.gitlab.io
# 查询对应的版本
helm search repo -l gitlab/gitlab-runner
# 找gitlab版本 对应的版本号
helm pull gitlab/gitlab-runner --version=0.39.1
配置
# 镜像用和自己git版本匹配的
image: gitlab/gitlab-runner:alpine-v14.10.1
imagePullPolicy: IfNotPresent
replicas: 3
gitlabUrl: http://gitlab.zili.work:8888/
# 这个token 来自 runner界面,如果使用runnerToken 则副本数只能为1
runnerRegistrationToken: "p1fDzwhHbyGeK4XSz7RM"
terminationGracePeriodSeconds: 3600
concurrent: 20
checkInterval: 30
sessionServer:
enabled: false
rbac:
create: true
resources: ["pods", "pods/exec", "pods/attach", "secrets", "configmaps"]
verbs: ["get", "list", "watch", "create", "patch", "delete", "update"]
rules: []
clusterWideAccess: true
podSecurityPolicy:
enabled: false
resourceNames:
- gitlab-runner
metrics:
enabled: false
service:
enabled: false
type: ClusterIP
runners:
# 缓存 https://docs.gitlab.com/runner/install/kubernetes.html#s3
config: |
[[runners]]
[runners.kubernetes]
privileged = true
namespace = "{{.Release.Namespace}}"
image = "ubuntu:16.04"
[runners.cache]
Type = "s3"
Path = "caches"
Shared = true
[runners.cache.s3]
ServerAddress = "minio.middleware.svc.cluster.local:9000"
BucketName = "gitlab-runner"
Insecure = true
AccessKey = "admin"
SecretKey = "Password@0101"
executor: kubernetes
tags: "Kubernetes,K8S"
cloneUrl: "http://gitlab.zili.work:8888/"
securityContext:
runAsUser: 100
fsGroup: 65533
安装
helm upgrade --install gitlab-runner . -n gitlab-runner --create-namespace
runner 无法注册
检查自己 gitlabUrl
是否配置正确