GitLab+GitLab Runner+K8s CICD Part1

1.集群外安装GitLab

sudo docker run --detach \
    --hostname 10.222.56.51 \
    --publish 443:443 --publish 80:80 --publish 2002:2002 \
    --name gitlab \
    --restart always \
    --volume /data/gitlab/config:/etc/gitlab:Z \
    --volume /data/gitlab/logs:/var/log/gitlab:Z \
    --volume /data/gitlab/data:/var/opt/gitlab:Z \
    gitlab/gitlab-ce:12.10.3-ce.0

获取/修改超级管理员root的密码

a、 切换目录:cd /opt/gitlab/bin

b、执行 :sudo gitlab-rails console 命令 开始初始化密码

c、在irb(main):001:0> 后面通过 u=User.where(id:1).first 来查找与切换账号(User.all 可以查看所有用户)

d、通过u.password='12345678’设置密码为12345678(这里的密码看自己喜欢):

e、通过u.password_confirmation=‘12345678’ 再次确认密码

f、通过 u.save!进行保存(切记切记 后面的 !)

g、如果看到上面截图中的true ,恭喜你已经成功了,执行 exit 退出当前设置流程即可。

h、回到gitlab ,可以通过 root/12345678 这一超级管理员账号登录了

2.安装gitlab runner

参考文档

This chart configures the Runner to:

  • Run using the GitLab Runner Kubernetes executor.
  • For each new job it receives from GitLab CI/CD, it will provision a new pod within the specified namespace to run it.

helm repo add gitlab https://charts.gitlab.io

helm init --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.12.3
重启pod
kubectl get pod tiller-deploy-5f9c6f698-v6l9m -o yaml|kubectl replace --force -f -

安装命令如下:

helm install --namespace --name gitlab-runner -f <CONFIG_VALUES_FILE> gitlab/gitlab-runner
1
更新命令如下:

helm upgrade --namespace -f <CONFIG_VALUES_FILE> gitlab/gitlab-runner
1
删除命令如下:

helm delete --namespace

kubectl create namespace tiller

helm install --namespace tiller --name gitlab-runner -f gitlabrunner.yaml gitlab/gitlab-runner

[root@node1 home]# kubectl get pods -n tiller
NAME                                           READY   STATUS    RESTARTS   AGE
gitlab-runner-gitlab-runner-76b965dc68-lj8qk   1/1     Running   0          6m4s

然后在GitLab=>对应Project=>Setting=>CICD=>Runner=>Expand里就能看到了
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值