gitlab runner 설치 중 error
질문 1) New Runner Registration Workflow (Recommended)
GitLab now uses runner authentication tokens instead of registration tokens. To create these:
glrt-
prefixgitlab-runner register --token $RUNNER_AUTHENTICATION_TOKEN
2) 옛 레거시 버전도 비교해줌The old registration token method is deprecated and planned for removal in GitLab 20.0. If you still need to use it:
gitlab-runner register --registration-token $RUNNER_REGISTRATION_TOKEN <runner configuration arguments>
3) runner 생성 >> token 등록이 시급해 보였음.
You can also create runners programmatically using the REST API:
/runners
endpoint with your registration token1) 참고로 SaaS버전에선 admin area가 없다는걸 알았다
2) 아래는 SaaS내 project 러너 생성하는 방법
On GitLab.com (the SaaS version), you don't have access to the Admin area since you're not an administrator of the entire GitLab.com instance. However, you can still get runner tokens at the project or group level.
Here's how to get a runner token on GitLab.com:
For Project Runners:
1. Go to your project
2. On the left sidebar, select Settings > CI/CD
3. Expand the Runners section
4. You'll find the runner registration information there
For Group Runners:
1. Navigate to your group
2. On the left sidebar, select Settings > CI/CD
3. Expand the Runners section
4. The runner token will be available in this section
Important Note about Runner Registration:
The documentation indicates that in GitLab 17.0, the use of runner registration tokens is disabled by default. The new workflow uses authentication tokens instead of registration tokens. You may need to:
To create an access token for runner creation:
1. Go to your project/group settings
2. Navigate to Access Tokens
3. Create a new token with the create_runner scope
4. Use this token to create and register runners through the API
The Admin area is only available on self-managed GitLab instances, not on GitLab.com where you're using the hosted service.
Runner registered successfully.
Feel free to start it, but if it's running already the config should be automatically reloaded!
Configuration (with the authentication token) was saved
in "/home/gitlab-runner/.gitlab-runner/config.toml"
#인증 토큰이 포함된 설정 파일이 정상적으로 저장되었음을 나타냅니다.
colima start --mount ~/data/docker:/var/lib/docker
Docker는 /var/lib/docker에 ext4와 같은 리눅스 네이티브 파일 시스템을 요구함
macOS 디렉토리는 NFS로 마운트되기 때문에 overlay2 드라이버가 비호환
mkdir -p ~/data/docker-volumes
sudo chown $(whoami) ~/data/docker-volumes
colima start --kubernetes --mount ~/data/docker-volumes:/mnt/docker-data --disk 80
Docker 내부 동작은 그대로 두고, 실제 저장은 외부 마운트에만 위임
구성 요소 | 목적 |
---|---|
Colima | M1 환경에서 Docker & K8s 구동을 위한 가상머신 경량 레이어 |
Docker | GitLab Runner 내부에서 CI 파이프라인 실행 시 사용 |
Kubernetes | GitLab Runner 및 앱 배포 환경 제공 |
Helm | GitLab Runner 등 K8s 앱을 Chart로 구성하여 쉽게 설치 |
GitLab | CI/CD 파이프라인 실행, Runner 등록 대상 |
macOS (M1) | 기본 운영체제 (ARM64 기반) |
기능 | 설명 |
---|---|
템플릿화된 배포 | 복잡한 K8s 리소스를 템플릿으로 묶어 한 번에 배포 |
버전 관리 | Chart version별 관리 가능 |
설정 커스터마이징 | --set key=value 또는 values.yaml 로 쉽게 구성 변경 |
다수 환경 배포 | dev/stage/prod 환경별로 구성값만 바꿔서 재활용 가능 |
Kubernetes에 앱을 배포하려면 Deployment, Service, RBAC, ConfigMap, PVC 등 수많은 yaml 파일을 작성해야 함
이걸 수동으로 하다 보면 반복성, 실수, 유지보수가 어렵고 코드로 관리하기 어려움
helm-cli 참조
Deployment (Runner Pod)
ConfigMap (Runner 설정)
RBAC
ServiceAccount
Secret (Registration Token)
PVC (캐시 저장소)
helm repo add gitlab https://charts.gitlab.io
Project Runner |특정 프로젝트에만 사용 | 프로젝트Maintainer/Owner
Group Runner |그룹 내 모든 프로젝트| 그룹Owner
Instance Runner | 인스턴스 전체(모든 프로젝트) |인스턴스 Admin
customized에 특화된 self-hosted 관련 기획안이 계획에 없어서, 1차로 SaaS 성공 이후 self-hosted 도전하기로 함.
기존의 shared token 은 사용불가
SaaS 에서 기본적으로 ADMIN 권한 없다.
Admin AREA 진짜 없다!
옛 버전 gitlab 에서 클릭으로 customer token 발행도 발행 불가
실패 ::PANIC: The registration-token needs to be entered
NAME CHART VERSION APP VERSION DESCRIPTION
gitlab/gitlab-runner 0.64.0 16.11.0 GitLab Runner
gitlab/gitlab-runner 0.63.0 16.10.0 GitLab Runner
gitlab/gitlab-runner 0.62.1 16.9.1 GitLab Runner
gitlab/gitlab-runner 0.62.0 16.9.0 GitLab Runner
gitlab/gitlab-runner 0.61.3 16.8.1 GitLab Runner
gitlab/gitlab-runner 0.61.2 16.8.0 GitLab Runner
...
#value.yaml
# gitlab-runner-values.yaml
gitlabUrl: "https://gitlab.com/" # 실제 GitLab 인스턴스 URL로 변경
runnerRegistrationToken: "YOUR_RUNNER_REGISTRATION_TOKEN" # 실제 토큰으로 변경
# Kubernetes Executor 설정
runners:
privileged: true # Docker-in-Docker 등을 위해 필요한 경우 true로 설정. 보안상 고려 필요.
tags: "colima,kubernetes,m1" # 러너 태그
config: |
[[runners]]
[runners.kubernetes]
namespace = "default"
# 각 잡이 사용하는 리소스 제한 (M1 메모리 효율을 위해 중요!)
# 이 값은 프로젝트의 CI/CD 요구사항에 따라 조절해야 합니다.
# 너무 낮으면 잡이 실패할 수 있고, 너무 높으면 메모리가 부족해질 수 있습니다.
cpu_limit = "1" # 각 잡은 최대 1 CPU 코어 사용
memory_limit = "1Gi" # 각 잡은 최대 1GB 메모리 사용
cpu_request = "0.5" # 각 잡은 최소 0.5 CPU 코어 요청
memory_request = "512Mi" # 각 잡은 최소 512MB 메모리 요청
# Kubernetes Executor의 Image Pull Policy
image_pull_policy = "IfNotPresent" # 이미지 없으면 pull, 있으면 기존 사용
# CI 잡 컨테이너의 Docker Daemon 동작을 위한 privileged 모드 활성화 (Docker-in-Docker 필요 시)
# privileged: true
# 서비스 컨테이너를 위한 리소스 제한 (필요시 추가)
# [[runners.kubernetes.service_account]]
# name = "gitlab-runner"
# namespace = "default"
# 볼륨 마운트 설정 (옵션, 캐시 등에 활용)
# [[runners.kubernetes.volumes]]
# name = "data"
# mount_path = "/cache"
# type = "emptyDir" # 임시 볼륨, Pod 종료 시 사라짐
# 서비스 계정 권한 설정 (필요 시)
rbac:
create: true
# GitLab Runner의 Pod 리소스 제한 (GitLab Runner 자체 Pod)
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "200m"
memory: "256Mi"
authentication token
cp 필수!# Download the binary for your system
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
# Give it permission to execute
sudo chmod +x /usr/local/bin/gitlab-runner
# Create a GitLab Runner user
sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
# Install and run as a service
sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
sudo gitlab-runner start
echo -n "glrt-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | base64
apiVersion: v1
kind: Secret
metadata:
name: gitlab-runner-secret
namespace: default # Runner가 배포될 네임스페이스와 일치해야 함
type: Opaque
data:
runner-token: <base64-encoded-glrt-token>
runner-registration-token: ""
<base64-encoded-glrt-token> 부분에 위에서 인코딩한 값을 넣으세요.
위 runner token 양식은 redhat참조
3. Secret 생성
직접 Secret을 생성하여 base64 인코딩된 glrt- 토큰을 넣고, values.yaml에서 runners.secret로 지정한 방식이 정상적으로 적용된 것입니다.
이 방식은 Helm Chart 0.77.x 이상, Runner 18.x 환경에서 권장되는 최신 등록 방식입니다.
gitlabrunner in dockd
gitlab runner in helm
helm-value.yaml설정