
k8s上运行gitlabrunner失败
一、无权限 ERROR: Job failed (system failure): prepare environment: setting up credentials: secrets is forbidden: User “system:serviceaccount:default:default” cannot create resource “secrets” in API group "" in the namespace “default”. Check https://docs.gitlab.com/runner/shells/index.html#shell- profile-loading for more information 原因是这个pod没有create等权限,需要添加权限 kubectl create clusterrolebinding default:default–clusterrole=cluster-admin – group=system:serviceaccounts –namespace=default 二、无法访问 fatal: unable to access ‘http://gitlab.dym.com/douxiaoliang/netty-study.git/' : Failed to connect to gitlab.dym.com port 80 after 130543 ms: Operation timed out 28ERROR: Job failed: command terminated with exit code 1 runner的pod里面通过hostAliases也配置了 hosts域名映射,但是依然报错,没有找到原因,直接将gitlab的地址改为ip 访问
提示runner无法解析域名,对coredns添加dns解析, kubectl edit cm -n kube-system coredns #修改 apiVersion: v1 data: Corefile: | .:53 { errors health { lameduck 5s } ready kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa ttl 30 } hosts { 192.168.30.129 gitlab.lzxlinux.com #添加dns解析 fallthrough } prometheus :9153 forward . /etc/resolv.conf cache 30 loop reload loadbalance } 保存退出,然后重试流水线, 三、无法clone仓库 remote: You are not allowed to download code from this project.
27fatal: unable to access ‘http://192.168.2.110/douxiaoliang/netty-study.git/’: The requested URL returned error: 403 29ERROR: Job failed: command terminated with exit code 1 原因是当前的runner注册用为root,但是这个账号不在这个仓库里面所以无 法clone项目,把当前用户加入项目用户里面,重新运行就可以了。 aaa.yaml


