helm3安装gitlab
更新:HHH   时间:2023-1-7


1、添加helm源

helm repo add stable https://kubernetes-charts.storage.googleapis.com
helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm repo add  apphub https://apphub.aliyuncs.com/

2、下载gitlab-ce

helm pull stable/gitlab-ce
tar  -zxvf  gitlab-ce-0.2.2.tgz

3、修改values.yaml文件

4、安装

helm install gitlab gitlab-ce

备注:由于我是最新16.3的集群,所以这里会报错。如果你是16以下的版本这里不会报错


grep -irl "extensions/v1beta1" gitlab-ce | grep deployment
grep -irl "extensions/v1beta1" gitlab-ce | grep deploy | xargs sed -i 's#extensions/v1beta1#apps/v1#g'

#在进行安装,错误原因是现有 k8s不支持gitlab-ce的deployment spec
helm install gitlab gitlab-ce
grep -irl "apps/v1" gitlab-ce | grep deployment

依次修改配置文件:

vim gitlab-ce/templates/deployment.yaml
添加:
  replicas: 1
  selector:
    matchLabels:
      app: {{ template "gitlab-ce.fullname" . }}

vim gitlab-ce/charts/postgresql/templates/deployment.yaml
添加:
  selector:
    matchLabels:
      app: {{ template "postgresql.fullname" . }}

vim gitlab-ce/charts/redis/templates/deployment.yaml
添加:
  selector:
    matchLabels:
      app: {{ template "redis.fullname" . }}

在进行安装

helm install gitlab gitlab-ce

5、查看集群状态

kubectl get pod

#由于资源需要请求pv,所以我们还需要创建pv
kubectl get pv
kubectl get pvc

#在worker节点创建hostpath挂在目录
mkdir  -p  /data/gitlab/pv{1..4}

在master节点创建pv文件

[root@node1 pv]# cat pv1.yaml 
apiVersion: v1
kind: PersistentVolume
metadata:
  name: gitlab-pv1
spec:
  capacity:
    storage: 10Gi
  volumeMode: Filesystem
  accessModes:
  -  ReadWriteOnce
     persistentVolumeReclaimPolicy: Retain
       hostPath:
     path: /data/gitlab/pv1

再查看集群状态

登录界面

返回云计算教程...