无法为kubernetes配置gitlab代理
我在项目1
中有gitlab kubernetes集成,并且能够在该项目的管道中访问 kube-context
,而没有任何问题。
我还有另一个项目,项目2
我想使用与项目1
集成的相同集群。
这是我我的代理配置文件:
# .gitlab/agents/my-agent/config.yaml
ci_access:
projects:
- id: group/project-2
当我尝试在项目2
中添加kubernetes群集时,我希望在In In In In Project 1
的群集名称中下拉级,但我看不到:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
gitlab 15.7 (2022年12月)提出了一种替代方法,该方法没有每个项目都涉及创建新代理
这意味着从单个代理商那里,您应该能够从多个项目(是否个人名称空间)访问代理连接。
GitLab 15.7 (December 2022) suggests an alternative approach, which does not involve creating a new agent per project
That means from a single agent, you should be able to access an agent connection from multiple projects (personal namespace or not).
您是否确保代理配置文件
config.yaml
在您的project2
中存在指定目录?如果有的话,您应该能够从列表中选择代理,并使用它设置GitLab。两个项目中都有配置文件为必要的当您配置多个项目以使用相同的K8S群集时。
Have you ensured that the agent configuration file
config.yaml
is present in yourproject2
at the specified directory?If you have, you should be able to choose the agent from the list and setup Gitlab with it. Having the configuration file in both projects is necessary when you configure multiple projects to use the same k8s cluster.
因此,由于假定的基于证书的Kubernetes集成在2022年11月刚刚延迟到2023年2月,我一直在工作的公司面临同样的问题
。在配置项目的注册代理列表中,但对于授权的项目或组,它可以按广告宣传工作。
我建议建立一个组变量,该变量包含相应的
< group/subgroup:agent_name>
值,以便您可以在整个.gitlab-ci.yml
文件中引用它。小组的项目。ZER0的提议解决方案是误导性的,因为它使您每个项目创建一个新的代理,并且会导致群集中的代理过载。
So I've been facing the same problem at the company I'm working on due to the supposed deprecation of certificate-based Kubernetes integration in November 2022 that just got delayed to February 2023.
As far as I could gather, the agent only appears in the registered agents list of the configuration project, but to the authorized projects or groups, it works as advertised.
I would recommend setting up a group variable that holds the respective
<group/subgroup:agent_name>
value so that you can reference it throughout the.gitlab-ci.yml
files of the projects of the group.zer0's proposed solution is missleading as it makes you create a new agent per project and can cause an overload of agents in your cluster.