728x90
일반 인스턴스에 Runner를 배포하게되면 하나의 Deamon에서 queue로 들어오는 Job을 처리하게 된다. Github에는 ARC(Actions Runner Controller)라고 On-Demand하게 Scaling되는 Runner type이 있는데, 이와 유사한게 Gitlab Runner에서는 kubernetes type Executor이다.
설치방법
1. Gitlab Helm 용 Repo 등록
$ helm repo add gitlab https://charts.gitlab.io
2, 필요한 경우 Helm init을 수행한다.
3. Gitlab Runner 버전을 확인한다.
$ helm search repo -l gitlab/gitlab-runner
4. 만약 최신 Gitlab 버전을 접근할 수 없다면 업데이트를 수행한다.
$ helm repo update gitlab
5. helm 배포를 할때 사용할 values.yaml 파일을 생성합니다.
이때 아래 문서를 참고하여 배포할 Executor를 설정할 수 있습니다.
https://docs.gitlab.com/runner/executors/kubernetes/#configuration-settings
Kubernetes executor | GitLab
GitLab product documentation.
docs.gitlab.com
필자의 경우 아래의 Configuration만 수정하여서 배포하였습니다.
gitlabUrl: "http://gitlab.armyost.com"
runnerRegistrationToken: "XXXXXXASS23y9"
rbac:
create: true
resources:
limits:
memory: 1024Mi
cpu: 500m
ephemeral-storage: 512Mi
requests:
memory: 128Mi
cpu: 100m
ephemeral-storage: 256Mi
6. Helm install을 통하여 배포합니다.
# For Helm 2
$ helm install --namespace <NAMESPACE> --name gitlab-runner -f <CONFIG_VALUES_FILE> gitlab/gitlab-runner
# For Helm 3
$ helm install --namespace <NAMESPACE> gitlab-runner -f <CONFIG_VALUES_FILE> gitlab/gitlab-runner
참고
만약 아래와 같은 에러를 마주친다면
ERROR: Job failed (system failure): prepare environment: setting up credentials: secrets is forbidden: User "system:serviceaccount:runners:default" cannot create resource "secrets" in API group "" in the namespace "runners". Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
Helm configure할때 사용하는 values.yaml 파일에 아래 내용을 꼭 넣어주세요.
rbac:
create: true
...
runners:
config: |
[[runners]]
environment = [
"DOCKER_HOST=tcp://docker:2376",
"DOCKER_TLS_CERTDIR=/certs",
"DOCKER_TLS_VERIFY=1",
"DOCKER_CERT_PATH=$DOCKER_TLS_CERTDIR/client"
]
[runners.kubernetes]
namespace = "{{.Release.Namespace}}"
image = "docker:24.0.5"
privileged = true
[[runners.kubernetes.volumes.empty_dir]]
name = "certs"
mount_path = "/certs/client"
medium = "Memory"
'PaaS > CI CD' 카테고리의 다른 글
Kustomization) Kustomize build 시 참조되는 파일 경로 유효성 평가 생략하기 (0) | 2024.12.27 |
---|---|
Gitlab Runner ) kubernetes Executor Error 'Is the docker daemon running?' (0) | 2024.12.15 |
DockerHub Rate Limit 정책 그리고 이슈 (0) | 2024.08.03 |
Gitlab-CI) AWS CLI 사용을 위한 인증 방법 (0) | 2024.03.11 |
Github Actions) 나의 Github 계정에서 수행된 Actions History를 모두 수집해보자 (1) | 2024.03.03 |