kubernetes - 仅具有内部网络的 VM 上的 GitLab Runner

标签 kubernetes google-cloud-platform gitlab google-kubernetes-engine gitlab-ci-runner

我正在从官方 jetstack 运行 GitLab 实例我在 Google Cloud 中的 GKE 集群上的 helm 图表。

我想将一个 Windows 虚拟机添加到我的 VPC 网络中,该网络只能访问内部网络。

通常,您必须针对 GitLab 的 https 地址注册 GitLab 运行器,这在内部网络中是不可能的。有没有办法通过内部网络向 GitLab 实例注册 GitLab 运行器?

GitLab 实例通过 nginx-ingress 发布其 https 资源也在该 GKE 集群上运行的 Controller 。

有没有办法注册 gitlab-unicorn pod,其内部 IP 正在监听端口 8080 ?

提前致谢!

最佳答案

有两种选择:

  • clone_url如果 runner 可以访问 Gitlab实例,但它的名称不同于解析名称
  • ssh-tunnel如果运行者不能直接访问 Gitlab实例
  • clone_url
    如果您的 gitlab可以从内网访问,可以使用clone_url选项

    documentation :

    How clone_url works

    In cases where the GitLab instance is exposed to an URL which can’t be used by the runner, a clone_url can be configured. For example; GitLab is exposed to https://gitlab.example.com, but the runner can’t reach that because of a firewall setup. If the runner can reach the node on 192.168.1.23, the clone_url should be set to "http://192.168.1.23.

    Only if the clone_url is set, the runner will construct a clone URL in the form of http://gitlab-ci-token:s3cr3tt0k3n@192.168.1.23/namespace/project.git


    ssh-tunnel
    如果您的 Gitlab 实例没有任何可用地址,您可以设置 ssh-tunnel给它。

    SSH Tunneling is a method of transporting arbitrary networking data over an encrypted SSH connection. It can be used to add encryption to legacy applications. It can also be used to implement VPNs (Virtual Private Networks) and access intranet services across firewalls.



    ssh -L 8080:gitlab.yourinstance.com:80 gw.yourgateway.com
    

    然后你可以使用 gw.yourgateway.com:8080作为你的clone_url

    关于kubernetes - 仅具有内部网络的 VM 上的 GitLab Runner,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59422571/

    相关文章:

    android - 无法在云控制台中启用 Maps SDK for Android

    java - Firebase 身份验证 - 许多用户使用相同的凭据登录

    python - 在虚拟机(Google Cloud Platform)中使用 Cron 定期运行 Python 脚本

    yaml - Gitlab-Ci:如何在作业之间共享数据

    html - 如何在 Gitlab 中删除 p 标签的 auto ="dir"?

    nginx - Kubernetes 在哪里拉取镜像以及我如何浏览它们/更改它们的拉取源?

    java - 如何使用 k8s java 客户端连接到 pod 内的 k8s api 服务器

    kubernetes - 缩减Kubernetes中的视频 session 软件

    docker - Dockerfile是否可用于Google Container Registry上的Google示例图像?

    Gitlab Pages 守护进程,/home/git 在哪里?