参考:https://blog.stdioa.com/2018/06/gitlab-cicd-deploy/
1. 部署GitLab;
2. 在GiltLab中创建一个群组,然后在群组中的Runner设置中,复制一下token;
3. 在k8s中,添加一个密文,名称为:gitlab-ci-token,键名称为:token,值为刚才的token:
4. 为runner绑定k8s的权限,配置文件在这里:https://github.com/imwower/ubuntu-kubectl-in-docker/tree/master/k8s/deployment/gitlab_runner
1. 创建ServiceAccount:
2. 创建ConfigMap:
3. 创建Role和绑定:
4. 部署runner:
kubectl apply -f /k8s/deployment/gitlab_runner/ServiceAccount.yaml
kubectl apply -f /k8s/deployment/gitlab_runner/ConfigMap.yaml
kubectl apply -f /k8s/deployment/gitlab_runner/Role.yaml
kubectl apply -f /k8s/deployment/gitlab_runner/RoleBinding.yaml
kubectl apply -f /k8s/deployment/gitlab_runner/Deployment.yaml
这里特殊说明一下, 参考链接里写的是 CI_SERVER_TOKEN,但是gitlab runner改了,改成了REGISTRATION_TOKEN,