添加helm仓库

helm repo add gitlab https://charts.gitlab.io
helm search repo gitlab/gitlab-runner --version 0.42.0

生成values.yaml文件

helm show values gitlab/gitlab-runner --version 0.42.0 > values.yaml

修改自定义的values.yaml文件内容

gitlabUrl: 'https://gitlab.xxxx.com/'
runnerRegistrationToken: 'xxxxx'
unregisterRunners: true
concurrent: 2
checkInterval: 5


image:
  registry: registry.gitlab.com
  image: gitlab-org/gitlab-runner
  tag: alpine-v15.1.0

rbac:
  create: true
  rules:
    - apiGroups: [ '' ] #"" indicates the core API group
      resources: [ '*' ]
      verbs: [ '*' ]
    - apiGroups: [ 'networking.k8s.io' ]
      resources: [ 'ingresses' ]
      verbs: [ '*' ]
    - apiGroups: [ 'apps' ]
      resources: [ 'deployments' ]
      verbs: [ '*' ]
  clusterWideAccess: true
  serviceAccountName: gitlab-runner

runners:
  config: |
    [[runners]]
      [runners.kubernetes]
        namespace = ""
        image = "ubuntu:18.04"
      [runners.cache]
        Type = "s3"
        Shared = false
        [runners.cache.s3]
          ServerAddress = "minio.xxx.com"
          # AccessKey = "${S3_ACCESS_KEY}"  # 使用环境变量存储密钥
          # SecretKey = "${S3_SECRET_KEY}"  # 使用环境变量存储密钥
          AccessKey = "xxxx"
          SecretKey = "xxxx"
          BucketName = "gitlab-cache"
          # 如果可能,尽量启用 HTTPS
          Insecure = true
  tags: 'k8s-runner'
  helpers:
    cpuLimit: 200m
    memoryLimit: 256Mi
    cpuRequests: 100m
    memoryRequests: 128Mi
    image: 'registry.gitlab.com/gitlab-runner-helper:arm64-76984217'
  serviceAccountName: gitlab-runner

查看模板与自定义配置生成的内容(可选)


# helm template -f values.yaml --namespace gitlab-runner gitlab/gitlab-runner > gitlab-runner.yaml

安装或更新

helm install -f ./values.yaml gitlab-runner gitlab/gitlab-runner -n gitlab-runner --version 0.42.0

helm upgrade -f ./values.yaml gitlab-runner gitlab/gitlab-runner -n gitlab-runner --version 0.42.0

查看部署状态

helm status gitlab-runner -n gitlab-runner

卸载

helm delete gitlab-runner -n gitlab-runner

相关文档