Skip to content

Latest commit

 

History

History
104 lines (65 loc) · 2.03 KB

Gitlab.md

File metadata and controls

104 lines (65 loc) · 2.03 KB

Instructions fro standing up Gitlab on a Kubernetes cluster

3-4 years old:

https://github.com/adavarski/k3s-GitLab-development

2023:

https://dev.to/glasskube/gitlab-on-kubernetes-the-ultimate-deployment-guide-188b

Prerequisites

  1. A Kubernetes cluster
  2. Helm
  3. kubectl
  4. A domain name
  5. An SSL certificate for the domain name (from Ryan)

Steps

helm repo add gitlab https://charts.gitlab.io/
helm install gitlab gitlab/gitlab \
  --set global.hosts.domain=10.1.10.33.nip.io \
  --set certmanager-issuer.email=me@example.com
  1. Obtain cert from Ryan
kubectl create secret tls gitlab-cert --cert=<path/to-full-chain.crt> --key=<path/to.key>

or generate a self-signed cert

openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout tls.key -out tls.crt -subj "/CN=10.1.10.33.nip.io"
kubectl create secret tls gitlab-cert --cert=tls.crt --key=tls.key
  1. Enable stuff

k3s

1. Add the Gitlab Helm repository

```bash
helm repo add gitlab https://charts.gitlab.io/
  1. Install the Gitlab chart
kubectl create namespace gitlab
helm install gitlab gitlab/gitlab --namespace gitlab -f gitlab.yaml
  1. Wait for the pods to be ready
kubectl get pods -n gitlab
  1. Get the root password
kubectl get secret gitlab-gitlab-initial-root-password -n gitlab -ojsonpath='{.data.password}' | base64 --decode ; echo

Then open a browser and go to http://localhost:8080 and log in with the root password.

Patch metrics-server

kubectl patch deployment metrics-server -n kube-system --type json -p '[
  { "op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls" },
  { "op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-preferred-address-types=InternalIP,ExternalIP" }
]'

Edit specific service

kubectl edit deployment/gitlab-gitlab-runner -n gitlab

Destroy gitlab

helm uninstall gitlab
kubectl delete pvc -l release=gitlab
kubectl delete pv -l release=gitlab