and*_*ich 12 gitlab docker gitlab-ci kubernetes gitlab-ci-runner
目前我面临的问题是:
ERROR: Job failed (system failure):
prepare environment:
setting up credentials:
secrets is forbidden:
User "system:serviceaccount:default:gitlab-runner" cannot create
resource "secrets" in API group "" in the namespace "gitlab"`
after following the official documentation on how to integrate the GitLab Runner.
Run Code Online (Sandbox Code Playgroud)
我正在使用以下内容runner-chart-values.yaml:
# The GitLab Server URL (with protocol) that want to register the runner against
# ref: https://docs.gitlab.com/runner/commands/README.html#gitlab-runner-register
#
gitlabUrl: http://example.domain/
# The Registration Token for adding new runners to the GitLab Server. This must
# be retrieved from your GitLab instance.
# ref: https://docs.gitlab.com/ce/ci/runners/README.html
#
runnerRegistrationToken: "<token>"
# For RBAC support:
rbac:
create: true
rules:
- apiGroups: ["*"]
# Run all containers with the privileged flag enabled
# This will allow the docker:dind image to run if you need to run Docker
# commands. Please read the docs before turning this on:
# ref: https://docs.gitlab.com/runner/executors/kubernetes.html#using-dockerdind
runners:
privileged: true
Run Code Online (Sandbox Code Playgroud)
有什么线索吗?
非常感谢!
小智 14
对我来说,添加所有必要的角色是唯一真正有帮助的解决方案。
这里是相应的 runner-chart-values.yaml 文件:
## GitLab Runner Image
gitlabUrl: http://example.domain/
runnerRegistrationToken: "<token>"
rbac:
create: true
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "get", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get"]
- apiGroups: [""]
resources: ["pods/attach"]
verbs: ["list", "get", "create", "delete", "update"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["list", "get", "create", "delete", "update"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["list", "get", "create", "delete", "update"]
runners:
privileged: true
Run Code Online (Sandbox Code Playgroud)
看起来命名空间不匹配,但是您可以尝试下面的选项
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: gitlab-runner
namespace: gitlab-runner
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "get", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get"]
Run Code Online (Sandbox Code Playgroud)
确保您正在将角色的服务帐户创建到正确的命名空间。
创建角色绑定的命令
kubectl create rolebinding --namespace=gitlab-runner gitlab-runner-binding --role=gitlab-runner --serviceaccount=gitlab-runner:default
Run Code Online (Sandbox Code Playgroud)
这是很好的文档:https://medium.com/@ruben.laguna/installing-a-gitlab-runner-on-kubernetes-ac386c924bc8
| 归档时间: |
|
| 查看次数: |
18193 次 |
| 最近记录: |