Install Gitlab Runner in Kubernetes

bayu nugraha
2 min readOct 8, 2020

--

##1 Create namespace where we want to Deploy our Runner,kubectl create namespace gitlab-runner##2 Create Secret for ssl gitops-local.uii.ac.id, copy .crt file into our local notebook/create .crt file.kubectl --namespace gitlab-runner create secret generic gitlab-ssl --from-file=gitops-local.uii.ac.id.crt##3 Clone repo gitlab using Helm, helm repo add gitlab https://charts.gitlab.ioHelm repo update##4 Create config file, vi value.yml
runnerRegistrationToken, we can get token from here https://gitops.uii.ac.id/admin/runners
certsSecretName is a secret name ssl that we set earlierKUBE_CONFIG is a kube config k8s cluster, with format multiple cluster and encode to base64 format, I’ts like config below before encode base64, or you can refer to this link https://medium.com/capital-one-tech/managing-kubernetes-contexts-for-multiple-clusters-eed174288efeapiVersion: v1clusters:- cluster:certificate-authority-data: ""server: "your ip kubernetes:6443"name: "coba"contexts:- context:cluster: "coba"user: "coba"name: "coba"current-context: "coba"kind: Configpreferences: {}users:- name: "coba"user:token: ""
tags is for tag for runner that would triggered when we declare it in gitlab-ci.yml, look at the image in the left
##4 Run Helm install, helm install --namespace gitlab-runner gitlab-runner -f value.yml gitlab/gitlab-runner
Go to https://gitops.uii.ac.id/admin/runners to see our runner
Run this command below to see in kubectl or helmhelm ls -n gitlab-runnerkubectl get pod -o wide -n gitlab-runnerFor Remove run this command, helm uninstall gitlab-runner -n gitlab-runner

--

--

bayu nugraha
bayu nugraha

Written by bayu nugraha

Linux Administrator, Network Administrator, Cloud Engineer, DevOps Enthusiast, Docker, Jenkins, Git, Gitlab, Kubernetes, Ansible.

No responses yet