一、添加helm源node
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/
git
二、下載gitlab-ceredis
helm pull stable/gitlab-ce
tar -zxvf gitlab-ce-0.2.2.tgzsql
三、修改values.yaml文件vim
四、安裝api
helm install gitlab gitlab-cebash
備註:因爲我是最新16.3的集羣,因此這裏會報錯。若是你是16如下的版本這裏不會報錯app
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'
ide
#在進行安裝,錯誤緣由是現有 k8s不支持gitlab-ce的deployment spec
helm install gitlab gitlab-ce
grep -irl "apps/v1" gitlab-ce | grep deployment
gitlab
依次修改配置文件:
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
五、查看集羣狀態
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
再查看集羣狀態
登陸界面