解决方案
第一步、GitLab agent server
vim /etc/gitlab/gitlab.rb ... gitlab_kas['enable'] = true gitlab-ctl reconfigure
第二步、修改 Nginx 配置
... location /-/kubernetes-agent/ { proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass http://127.0.0.1:8929; } ...
否则,agentk 将产生 expected handshake response status code 101 but got 426 错误信息;
使用方法
在特定的项目中:
1)Infrastructure / Connect a cluter
2)填写名字,来新建 Agent 实例;
3)将输出的部署命令,在集群中运行,并确保 Agent 能够正常连接;
4)在项目中,使用:Using GitLab CI/CD with a Kubernetes cluster
参考文献
build/deployment/gitlab-agent
gitlab.rb.template
Kubernetes agent fails to connect to GitLab with “expected handshake response status code 101 but got 426”