前言
gitlab 需要提供的參數(shù) URL+TOKEN
部署相關(guān)
安裝helm
通過helm安裝gitlab-runner
下載gitlab-runner
git clone https://github.com/haoshuwei/ack-gitlab-runner.git
修改文件values.yaml
gitlabUrl: gitlab服務(wù)器上管理頁面上的URL
runnerRegistrationToken: gitlab服務(wù)器管理頁面的token
現(xiàn)在直接打包部署會(huì)出現(xiàn)報(bào)錯(cuò)
- 解決辦法參考
- 修改配置文件
vim templates/deployment.yaml
apiVersion: apps/v1 # 修改
kind: Deployment
metadata:
name: {{ template "gitlab-runner.fullname" . }}
labels:
app: {{ template "gitlab-runner.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: 1
selector: # 新增加
matchLabels: # 新增加
app: gitlab-runner-ack-gitlab-runner # 新增加
如何使用pvc
- 搭建nfs
搭建nfs - 創(chuàng)建pv
vim pv-nfs.conf
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-pv
labels:
spec:
nfs:
path: /mnt/jamestest
server: 192.168.0.252
accessModes: ["ReadWriteMany","ReadWriteOnce"]
capacity:
storage: 100Gi
# 創(chuàng)建pv
kubectl apply -f pv-nfs.conf
- 修改ack-gitlab-runner中的pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: {{ template "gitlab-runner.fullname" . }}
name: gitlab-runner-cache
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
selector:
matchLablel:
app: nfs
- nfs類型pvc使用常見問題
常見問題
打包部
- 打包部署
# helm 打包
helm package .
# 安裝helm打包文件
helm install --namespace gitlab --name gitlab-runner *.tgz
# 查看安裝是否成功
helm list
- helm 刪除
# 刪除已安裝的包
helm del --purge gitlab-runner
檢查
檢查gitlab 管理頁面是否出現(xiàn)該runner