Gitlab runner on kubernetes

6/2/2017

I would like to use kubernetes for gitlab runner.

I have a gitlab instance on server 1 and kubernetes on server 2 (with gitlab runner) . I installed kubernetes with kubeadm and flannel network pod.

When I launch the build, I can connect with kubernetes. But, the job is not running. I have this error:

Post https://<master_ip>:<master_port>/api/v1/namespaces/gitlab/pods: x509: certificate signed by unknown authority

So I know it is a ssl issue.

Do I must create a ssl certificates? And how and which argument?

Thanks for help

-- Vana
docker
gitlab-ci-runner
kubernetes

1 Answer

6/7/2017

have you tried making a service account on kubernetes and generate a bearer token? Not sure if gitlab works with tokens. If not you'll need the following: The following options are provided, which allow you to connect to the Kubernetes API:

host: Optional Kubernetes apiserver host URL (auto-discovery attempted if not specified)

cert_file: Optional Kubernetes apiserver user auth certificate

key_file: Optional Kubernetes apiserver user auth private key

ca_file: Optional Kubernetes apiserver ca certificate

So in short, you'll have to generate a key-cert combo based on the ca that you kubernetes apiserver uses. The content of your combo can be the following (this is a raw json example config that I use for cfssl):{"CN":"worker","hosts":[],"key":{"algo":"rsa","size":2048},"names":[{"C":"US","L":"OV","OU":"Devops"}]}

-- jonas kint
Source: StackOverflow