GitLab触发webhook时报错,以下为报错信息:
{
"apiVersion": "v1",
"code": 403,
"details": {
"group": "devops.kubesphere.io",
"kind": "webhook",
"name": "git"
},
"kind": "Status",
"message": "webhook.devops.kubesphere.io \"git\" is forbidden: User \"system:anonymous\" cannot create resource \"webhook\" in API group \"devops.kubesphere.io\" at the cluster scope",
"metadata": {},
"reason": "Forbidden",
"status": "Failure"
}
原因:anonymous匿名用户没有webhook的权限,需要给匿名用户加上对应的角色
执行以下命令:
kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/refs/heads/master/roles/ks-core/prepare/files/ks-init/role-templates.yaml
评论区