# Rancher and GitLab

**URL:** https://forums.suse.com/t/rancher-and-gitlab/16630
**Category:** SUSE Rancher Prime
**Created:** [February 20, 2020, 11:15am UTC](https://forums.suse.com/t/rancher-and-gitlab/16630 "2020-02-20T11:15:19Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![laep](https://avatars.discourse-cdn.com/v4/letter/l/7993a0/32.png) [@laep](https://forums.suse.com/u/laep)
#### Post date: [February 20, 2020, 11:15am UTC](https://forums.suse.com/t/rancher-and-gitlab/16630/1 "2020-02-20T11:15:19Z")

</div>

Im trying to add rancher to gitlab ci/cd. I want to deploy gitlab runners dynamically into the k8s cluster and for that i have to add the cluster in the operations section which i believe its part of the auto devops system.

After following the rancher tutorial: [https://rancher.com/blog/2019/connecting-gitlab-autodevops-authorized-cluster-endpoints/](https://rancher.com/blog/2019/connecting-gitlab-autodevops-authorized-cluster-endpoints/) i reached the point where it fails to install helm.  
I followed the tutorial and the “install-helm” pod gives what i believe to be an api error:

- helm init --tiller-tls --tiller-tls-verify --tls-ca-cert /data/helm/helm/config/ca.pem --tiller-tls-cert /data/helm/helm/config/cert.pem --tiller-tls-key /data/helm/helm/config/key.pem --service-account tiller

Creating /root/.helm  
Creating /root/.helm/repository  
Creating /root/.helm/repository/cache  
Creating /root/.helm/repository/local  
Creating /root/.helm/plugins  
Creating /root/.helm/starters  
Creating /root/.helm/cache/archive  
Creating /root/.helm/repository/repositories.yaml  
Adding stable repo with URL: [https://kubernetes-charts.storage.googleapis.com](https://kubernetes-charts.storage.googleapis.com)  
Adding local repo with URL: [http://127.0.0.1:8879/charts](http://127.0.0.1:8879/charts)  
$HELM\_HOME has been configured at /root/.helm.  
Error: error installing: Post [https://10.43.0.1:443/apis/apps/v1/namespaces/gitlab-managed-apps/deployments:](https://10.43.0.1:443/apis/apps/v1/namespaces/gitlab-managed-apps/deployments:) Service Unavailable

I am using the cluster endpoint, tried with both a FQDN and without.

The rancher version is 2.3.2 and GitLab is running the latest version

---

<div class="post-metadata">

### Author: ![paleozogt](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/paleozogt/32/6102_2.png) [@paleozogt](https://forums.suse.com/u/paleozogt)
#### Post date: [February 21, 2020, 12:09am UTC](https://forums.suse.com/t/rancher-and-gitlab/16630/2 "2020-02-21T00:09:56Z")

</div>

I’m also having trouble getting GitLab to use a Rancher cluster for CI/CD. Installing Tiller seems to work, but then it stalls on installing GitLab Runner.

Where are you seeing your errors? I’m using the GitLab web ui and the feedback is super minimal. I’d love to look at a log or something that can give me some useful information.

---

<div class="post-metadata">

### Author: ![jamrizzi](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jamrizzi/32/2256_2.png) [@jamrizzi](https://forums.suse.com/u/jamrizzi)
#### Post date: [February 23, 2020, 5:31am UTC](https://forums.suse.com/t/rancher-and-gitlab/16630/3 "2020-02-23T05:31:37Z")

</div>

I had trouble when setting it up also. If you look at the screenshot below, there are 2 definitions for the cluster. If you use the first one (`servers`), it fails because for whatever reason, gitlab can’t handle subpaths as the location for the kubernetes api. If you use the second one (`servers-ip-172-31-32-29`), it fails becaue gitlab does not recognize the certificate of the IP address for whatever reason.

![Screenshot from 2020-02-23 10-53-53](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/7/7df033db723c5a9dd1220fa5d3f67d5b6a423855.png)

I was able to get it to work by deploying an nginx reverse proxy to proxy the first one. I proxied it through ingress and used letsencrypt to setup a valid certificate.

I created a git repo and helm chart (rancher 2 compatible) for this at the repo below. It works like a charm.

> **[GitHub - clayrisser/kube-api-proxy: proxy kubernetes api](https://github.com/clayrisser/kube-api-proxy)**
>
> proxy kubernetes api. Contribute to clayrisser/kube-api-proxy development by creating an account on GitHub.

Make sure you specify the correct subpath.

Essentially, it’s removing the subpath because gitlab can’t handle a kubernetes api from a subpath for some silly reason.

---

<div class="post-metadata">

### Author: ![cloudlady911](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/cloudlady911/32/782_2.png) [@cloudlady911](https://forums.suse.com/u/cloudlady911)
#### Post date: [November 19, 2020, 9:01pm UTC](https://forums.suse.com/t/rancher-and-gitlab/16630/4 "2020-11-19T21:01:20Z")

</div>

I am trying to get this same integration working. However, I am using Rancher 2.4.8 and Gitlab 13.5.3. I did not install ingress since it already exists and is working. I installed the GitLab-Runner and I can see it in GitLab, but it does not show up anywhere in my Rancher kubernetes cluster. So that is the first mystery.

I do not want to use auto-devops. So I am trying to find some documentation on how to deploy apps using .gitlab-ci.yml and an application.yml file. Any help on this would be appreciated.

---

<div class="post-metadata">

### Author: ![jamrizzi](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jamrizzi/32/2256_2.png) [@jamrizzi](https://forums.suse.com/u/jamrizzi)
#### Post date: [May 1, 2021, 11:11am UTC](https://forums.suse.com/t/rancher-and-gitlab/16630/5 "2021-05-01T11:11:11Z")

</div>

@cloudlady911 I just saw this. If you still need help setting it up, I could jump on a call and show you.

---

<div class="post-metadata">

### Author: ![cloudlady911](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/cloudlady911/32/782_2.png) [@cloudlady911](https://forums.suse.com/u/cloudlady911)
#### Post date: [May 3, 2021, 1:50pm UTC](https://forums.suse.com/t/rancher-and-gitlab/16630/6 "2021-05-03T13:50:23Z")

</div>

I am able to deploy apps just fine now. Thanks. I am not using the gitlab runners launched from GitLab, but rather using runners create with the gitlab spawner and docker-machine solutions.

---

<div class="post-metadata">

### Author: ![jamrizzi](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jamrizzi/32/2256_2.png) [@jamrizzi](https://forums.suse.com/u/jamrizzi)
#### Post date: [May 6, 2021, 8:02am UTC](https://forums.suse.com/t/rancher-and-gitlab/16630/7 "2021-05-06T08:02:11Z")

</div>

I ended up using the official gitlab helm release.

[https://docs.gitlab.com/charts/](https://docs.gitlab.com/charts/)

You can see my config here.

> <https://github.com/clayrisser/charts/blob/master/beta/gitlab/v0.0.2/templates/releases/gitlab.yaml>
