-f $DEPLOYMENT_FILE_NAME
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "/v1, Resource=namespaces", GroupVersionKind: "/v1, Kind=Namespace"
Name: "shared-ngw-network", Namespace: ""
from server for: "deployment.yml": namespaces "shared-ngw-network" is forbidden: User "system:serviceaccount:default:default" cannot get resource "namespaces" in API group "" in the namespace "shared-ngw-network"
rbac для раннера настроил:
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab-admin
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: gitlab-admin
rules:
- apiGroups: [""]
resources: ["*"]
verbs: ["*"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: gitlab-admin
subjects:
- kind: ServiceAccount
name: gitlab-admin
roleRef:
kind: Role
name: gitlab-admin
apiGroup: rbac.authorization.k8s.io
svc acc прописал в деплойменте:
spec:
serviceAccountName: gitlab-admin
containers:
- args:
- run
image: gitlab/gitlab-runner:latest
imagePullPolicy: Always
name: gitlab-runner
под видит svc acc:
$ kubectl get pods --all-namespaces -o jsonpath='{range .items[?(@.spec.serviceAccountName == "gitlab-admin")]}{.metadata.namespace} {.metadata.name}{"\n"}{end}' 2>/dev/null
default gitlab-runner-7bc8575f9f-dcqxq
как мне ему разрешить деплоить в другие нс?
Дать кластерную роль админа и кластерный роль биндинг
Обсуждают сегодня