Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • values.yaml 수정

Code Block
languagebashyaml
$ vi /opt/gitlab/embedded/service/gitlab-rails/vendor/runner/values.yaml

image: gitlab/gitlab-runner
securityContext:
  fsGroup: 999
  runAsUser: 999

## Configure the maximum number of concurrent jobs
## - Documentation: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-global-section
## - Default value: 10
## - Currently don't support auto-scaling.
concurrent: 4

## Defines in seconds how often to check GitLab for a new builds
## - Documentation: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-global-section
## - Default value: 3
checkInterval: 3
certsSecretName: runner-secret
## For RBAC support
rbac:
  clusterWideAccess: false

## Configuration for the Pods that that the runner launches for each new job
runners:
  image: ubuntu:18.04
  privileged: true
  imagePullSecrets:
     - [local-harbor]
  builds: {}
  services: {}
  helpers: {}
resources: {}

hostAliases:
  - ip: "14.36.48.220"
    hostnames:
     - "gitlab.twoseed.co.kr"
  - ip: "175.197.124.236"
    hostnames:
     - "local.registry.co.kr"

gitlab runner 등록을 위한 이미지 및 권한 부여

Code Block
languagebashyaml
# values.yaml 내용
image: gitlab/gitlab-runner
securityContext:
  fsGroup: 999
  runAsUser: 999

인증을 위한 secret 생성

Code Block
languagebashyaml
$ kubectl --namespace gitlab-managed-apps create secret generic runner-secret --from-file=/etc/docker/certs.d/gitlab.twoseed.co.kr/gitlab.twoseed.co.kr.crt

# values.yaml 내용
certsSecretName: runner-secret

hosts 도메인 등록을 위한 설정

Code Block
languagebashyaml
# values.yaml 내용
hostAliases:
  - ip: "14.36.48.220"
    hostnames:
     - "gitlab.twoseed.co.kr"
  - ip: "175.197.124.236"
    hostnames:
     - "local.registry.co.kr"

Runner 설정

Code Block
languageyaml
# values.yaml 내용
runners:
  image: ubuntu:18.04
  privileged: true
  imagePullSecrets:
     - [local-harbor]
  builds: {}
  services: {}
  helpers: {}

...

  • 마스터 노드 터미널에서 Pod 로그 확인

Code Block
languagebash
$ kubectl logs runner-gitlab-runner-5b9967b65d-blwsk -n gitlab-managed-apps
Registration attempt 1 of 30
Runtime platform                                    arch=amd64 os=linux pid=12 revision=e95f89a0 version=13.4.1
WARNING: Running in user-mode.
WARNING: The user-mode requires you to manually start builds processing:
WARNING: $ gitlab-runner run
WARNING: Use sudo for system-mode:
WARNING: $ sudo gitlab-runner...

Token specified trying to verify runner...
WARNING: If you want to register use the '-r' instead of '-t'.
Verifying runner... is alive                        runner=nn4GoHzY
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
Runtime platform                                    arch=amd64 os=linux pid=1 revision=e95f89a0 version=13.4.1
Starting multi-runner from /home/gitlab-runner/.gitlab-runner/config.toml...  builds=0
WARNING: Running in user-mode.
WARNING: Use sudo for system-mode:
WARNING: $ sudo gitlab-runner...

Configuration loaded                                builds=0
Metrics server listening                            address=:9252 builds=0
[session_server].listen_address not defined, session endpoints disabled  builds=0

...