Kubernetes基于helm部署gitlab
gitlab支持多种安装方式,有二进制安装、helm cahrt安装、operator安装、docker安装以及基于源码构建等。本文主要介绍在k8s环境下基于helm包进行安装。
参考文档:
- https://docs.gitlab.com/charts/installation/index.html
- https://docs.gitlab.cn/charts/installation/
gitlab包括通用版本和中文版本(极狐),极狐为中外合资公司发布的版本。
准备工作
-
Kubernetes 集群
-
helm已经安装
-
负载均衡器,为ingress-nginx控制器提供EXTERNAL-IP,本文使用metallb,部署参考https://metallb.io/installation/
-
默认存储类
以下是具体的环境信息:
# k8s环境信息
root@master1:~# kubectl get node -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
master1 Ready control-plane 11d v1.28.2 192.168.0.51 <none> Ubuntu 24.04 LTS 6.8.0-35-generic containerd://1.7.12
master2 Ready control-plane 11d v1.28.2 192.168.0.52 <none> Ubuntu 24.04 LTS 6.8.0-35-generic containerd://1.7.12
master3 Ready control-plane 11d v1.28.2 192.168.0.53 <none> Ubuntu 24.04 LTS 6.8.0-35-generic containerd://1.7.12
worker1 Ready <none> 11d v1.27.1 192.168.0.54 <none> Ubuntu 24.04 LTS 6.8.0-35-generic containerd://1.7.12
# helm版本
root@master1:~# helm version
version.BuildInfo{
Version:"v3.15.2", GitCommit:"1a500d5625419a524fdae4b33de351cc4f58ec35", GitTreeState:"clean", GoVersion:"go1.22.4"}
# 操作系统版本
root@master1:~# cat /etc/issue
Ubuntu 24.04 LTS \n \l
root@master1:~# uname -a
Linux master1 6.8.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
# 存储类
root@master1:~# kubectl get sc -n openebs
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
mayastor-etcd-localpv openebs.io/local Delete WaitForFirstConsumer false 24h
mayastor-loki-localpv openebs.io/local Delete WaitForFirstConsumer false 24h
openebs-hostpath openebs.io/local Delete WaitForFirstConsumer false 24h
openebs-single-replica io.openebs.csi-mayastor Delete Immediate true 24h
# 设置openebs-hostpath为默认的存储类
root@master1:~# kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
storageclass.storage.k8s.io/openebs-hostpath patched
版本说明
gitlab chart版本和gitlab版本号不是一一对应的,有映射关系,可以通过如下命令查看:
# 添加gitlab helm 仓库
# gitlab
helm repo add gitlab https://charts.gitlab.io/
# 极狐gitlab
helm repo add gitlab-jh h