无法为kubernetes配置gitlab代理

发布于 2025-02-13 19:13:45 字数 580 浏览 3 评论 0 原文

我在项目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 的群集名称中下拉级,但我看不到:

“

I have Gitlab Kubernetes integration in my Project 1 and I am able to access the kube-context within that project's pipelines without any issues.

I have another project, Project 2 where I want to use the same cluster that I integrated in my Project 1.

This i my agent config file:

# .gitlab/agents/my-agent/config.yaml

ci_access:
  projects:
    - id: group/project-2

When I try to add a Kubernetes cluster in my Project 2, I am expecting to see the cluster name that I set up for Project 1 in the dropdown, but I don't see it:

gitlab-agent

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

自由如风 2025-02-20 19:13:45

gitlab 15.7 (2022年12月)提出了一种替代方法,该方法没有每个项目都涉及创建新代理

在个人名称空间中共享CI/CD访问代理

Kubernetes的GitLab代理提供了一种更安全的解决方案,用于使用Gitlab CI/CD管理簇。
您可以通过共享访问权限将单个代理与多个项目和组一起使用
到代理连接。在以前的版本中,您无法与个人共享访问权限
名称空间。此版本为个人名称空间增加了对CI/CD连接共享的支持。
您现在可以使用个人名称空间下任何项目的单个代理。

“

请参阅 evarese 。。

这意味着从单个代理商那里,您应该能够从多个项目(是否个人名称空间)访问代理连接。

GitLab 15.7 (December 2022) suggests an alternative approach, which does not involve creating a new agent per project

Share CI/CD access to the agent within a personal namespace

The GitLab agent for Kubernetes provides a more secure solution for managing your clusters with GitLab CI/CD.
You can use a single agent with multiple projects and groups by sharing access
to the agent connection. In previous releases, you could not share access with personal
namespaces. This release adds support for CI/CD connection sharing to personal namespaces.
You can now use a single agent from any of the projects under your personal namespace.

https://about.gitlab.com/images/15_7/configure-allow-agent-cicd-access-sharing-within-a-personal-namesp.png -- Share CI/CD access to the agent within a personal namespace

See Documentation and Issue.

That means from a single agent, you should be able to access an agent connection from multiple projects (personal namespace or not).

肥爪爪 2025-02-20 19:13:45

您是否确保代理配置文件 config.yaml 在您的 project2 中存在指定目录?

如果有的话,您应该能够从列表中选择代理,并使用它设置GitLab。两个项目中都有配置文件为必要的当您配置多个项目以使用相同的K8S群集时。

Have you ensured that the agent configuration file config.yaml is present in your project2 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.

唔猫 2025-02-20 19:13:45

因此,由于假定的基于证书的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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文