总目录索引:Helm 从入门到放弃系列

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/

helm3安装gitlab_helm3安装gitlab

2、下载gitlab-ce

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

helm3安装gitlab_helm3安装gitlab_02

3、修改values.yaml文件

helm3安装gitlab_helm3安装gitlab_03

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'

helm3安装gitlab_helm3安装gitlab_04

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

helm3安装gitlab_helm3安装gitlab_05

依次修改配置文件:

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

helm3安装gitlab_helm3安装gitlab_06

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

helm3安装gitlab_helm3安装gitlab_07

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

helm3安装gitlab_helm3安装gitlab_08

在进行安装

helm install gitlab gitlab-ce

helm3安装gitlab_helm3安装gitlab_09

5、查看集群状态

kubectl get pod
helm3安装gitlab_helm3安装gitlab_10

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

helm3安装gitlab_helm3安装gitlab_11

#在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

helm3安装gitlab_helm3安装gitlab_12

helm3安装gitlab_helm3安装gitlab_13

再查看集群状态

helm3安装gitlab_helm3安装gitlab_14

登录界面

helm3安装gitlab_helm3安装gitlab_15