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里就能看到了
在这里插入图片描述

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐