Gitlab CICD DAY 31 - K8S

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gitlab CICD DAY 31 - K8S相关的知识,希望对你有一定的参考价值。

  1. 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

  1. 解压修改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是否安装成功

Gitlab

  1. 测试

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

Gitlab

Gitlab

6. 注意:gitlab-CI/CD任务完成后,会把pod删除


以上是关于Gitlab CICD DAY 31 - K8S的主要内容,如果未能解决你的问题,请参考以下文章

CICD实现方法之二--Gitlab+Jenkins+K8S

CICD实现方法之二--Gitlab+Jenkins+K8S

GitLab CICD Day 10 - Runner 与 Executor

GitLab CICD Day 13 - Group Runner

GitLab CICD Day 04 - 新增 Pipeline Job

第四十四章 微服务CICD- gitlab + jenkins + docker + k8s