Я хочу использовать execute helm на gitlab-runner на моих kubernetes в конвейерах gitlab.
Мой gitlab.ci.yaml:
# Deployment step
deploy:
stage: deploy
image: alpine/helm:latest
script:
- helm --namespace gitlab upgrade initial ./iot/
tags:
- k8s
- dev
Что я сделал до сих пор:
- Установил gitlab-runner на мои kubernetes с рулем (https://docs.gitlab.com/runner/install/kubernetes.html)
Мои значения.yaml:
image: gitlab/gitlab-runner:alpine-v11.6.0
imagePullPolicy: IfNotPresent
gitlabUrl: https://gitlab.com/
runnerRegistrationToken: "mytoken"
unregisterRunners: true
terminationGracePeriodSeconds: 3600
concurrent: 10
checkInterval: 30
## For RBAC support:
rbac:
create: true
## Define specific rbac permissions.
# resources: ["pods", "pods/exec", "secrets"]
# verbs: ["get", "list", "watch", "create", "patch", "delete"]
## Run the gitlab-bastion container with the ability to deploy/manage containers of jobs cluster-wide or only within namespace
clusterWideAccess: false
metrics:
enabled: true
## Configuration for the Pods that that the runner launches for each new job
##
runners:
## Default container image to use for builds when none is specified
##
image: ubuntu:16.04
locked: false
tags: "k8s,dev"
privileged: true
namespace: gitlab
pollTimeout: 180
outputLimit: 4096
cache: {}
## Build Container specific configuration
##
builds: {}
# cpuLimit: 200m memoryLimit: 256Mi cpuRequests: 100m memoryRequests: 128Mi
## Service Container specific configuration
##
services: {}
# cpuLimit: 200m memoryLimit: 256Mi cpuRequests: 100m memoryRequests: 128Mi
## Helper Container specific configuration
##
helpers: {}
securityContext:
fsGroup: 65533
runAsUser: 100
## Configure resource requests and limits ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources: {}
affinity: {}
nodeSelector: {}
tolerations: []
envVars:
name: RUNNER_EXECUTOR
value: kubernetes
## list of hosts and IPs that will be injected into the pod's hosts file
hostAliases: []
podAnnotations: {}
podLabels: {}
gitlab-runner успешно связан с gitlab.com
Но я получаю следующее сообщение о gitlab при выполнении шага развертывания:
Error: UPGRADE FAILED: query: failed to query with labels: secrets is forbidden: User "system:serviceaccount:gitlab:default" cannot list resource "secrets" in API group "" in the namespace "gitlab"
Я проверил мой RBA C ClusterRules и все они по умолчанию настроены на подстановочный знак для глаголов и ресурсов, но я также попытался установить необходимые права:
resources: ["pods", "pods/exec", "secrets"]
verbs: ["get", "list", "watch", "create", "patch", "delete"]
Ничего не сработало :-( Когда я поступил неправильно?