- K8s机器上下载gitlab-runner配置文件
helm repo add gitlab https://charts.gitlab.io
helm repo list
helm search repo -l gitlab/gitlab-runner
helm fetch gitlab/gitlab-runner --version=0.15.0
- 解压修改gitlab-runner配置文件 #more values.yml
[root@master gitlab-runner]# more values.yaml |grep -v "#"
image: gitlab/gitlab-runner:alpine-v11.6.0
imagePullPolicy: IfNotPresent
gitlabUrl: http://172.16.128.177/
runnerRegistrationToken: "Qg6sQUGnwYmb3Y7hEu-N"
unregisterRunners: true
terminationGracePeriodSeconds: 3600
rbac:
create: true
clusterWideAccess: false
3.k8s上部署gitlab-runner
kubectl create ns gitlab-runner
helm install k8s_runner --namespace gitlab-runner ./gitlab-runner
4. 查看gitlab-runner是否安装成功
- 测试
stages:
- testing
- build
- deploy_qa
- test_qa
- deploy_stagging
run_test:
stage: testing
image: maven
tags:
- k8s
script:
- echo "hello,k8"
- echo "maven"
- sleep 100
6. 注意:gitlab-CI/CD任务完成后,会把pod删除