Using Gitlab's generic K8s connection until Gitlab is added to v2.x Pipeline


#1

The ability to use Gitlab in the v2.x Pipeline seems like a fairly common request. There’s a feature request under Ability to use GitLab in Pipeline #12608, so hopefully that will happen at some point. Until that fine day, what about the other way around? On Gitlab’s end there’s also an option for connecting GitLab with a Kubernetes cluster.

I’ve messed around with it a little bit, but keep getting 404s on the Gitlab end when trying to connect. It seems to be connecting to Rancher when I make a key in https://rancher.example.com/apikeys. I have a feeling I’m not using the right endpoint in API URL. It probably needs to come from the cluster or the project namespace rather than Global, but I’m not sure which to grab, and none I’ve tried yet have worked.

Anyone able to get this working and willing to help map the Rancher 2.0 UI to this info to Gitlab?


#2

I would also be super interested to hear what other people are doing for this as well.


#3

In will be useful to have both ways for connecting with GitLab, because:

GitLab’s integration with generic Kubernetes means it will use it as a target for it’s own CI, including Auto DevOps. (for CI you will use .gitlab-ci.yml)

Rancher’s integration with repositories means only that it’s Jenkins can connect with repository. (for CI configurations you will configure Jenkins)


#4

I haven’t gotten very far with this yet. My use-case was to try to get Discourse into a pipeline. They (Discourse devs) recommend building the image in Ubuntu, then pushing. Unfortunately, deploying Ubuntu in the Gitlab pipeline with the Ubuntu Docker image limits the Docker storage driver to VFS, and AUFS or Overlay2 are needed for the Discourse build.

I’m considering adding Terraform to the mix (there’s a .gitlab-ci.yml for Terraform template in Gitlab, and a Deploying Discourse with Terraform example) to spin up a Digital Ocean Ubuntu droplet to do the build, then pushing the image back to Gitlab. But all of this is somewhat specific to Discourse so I haven’t been reporting details to this thread. That said, there does seem to be some interest in the general concept, and I hope others will add what they learn. I’ll report back if I get something working.


#5

I’ve tried my best to get this working. Did someone else managed to get this working?


#6

I also got this 404 message when I tried to install “Helm Tiller”. If I use the /v3 ending in the API URL, i get a new error however:

Something went wrong while installing Helm Tiller

Kubernetes error: failed to find schema api

The overall communication seems to work, since I get an authentication error when I use a wrong API key.

I am using GitLab 11.0.1-ee (b0260b1) and Rancher 2.0.2.

So this is not working yet?


#7

I don’t have much to add here except that I’m seeing the same thing. I’m brand new to Rancher and just set up a 2.0.4 server, and I’m trying to integrate a project on my GitLab 10.8.4 server with it, and I get the same “Kubernetes error: failed to find schema api” error.


#8