DevOps / 10.CI_GithubARC
프로젝트: astro-sub1
원본 경로: operateguide/DevOps/10.CI_GithubARC.md
Github ARC
GitHub ARC (Actions Runner Controller)
1. 개요
Github ARC는 Github Action Workflow 수행을 위한 Runner를 Github 가 아닌 Private AKS에 구성할 수 있는 Helm 배포 방식. (Self-Hosted Runner)
2. Runner Scale Set 설치
하나의 Runner Scale Set는 하나의 Organization만 연결 가능하다.
GitHub ARC 자체가 GitHub Actions API를 통해 Organization Token으로 연결되기 때문에, runner가 어느 ORG에 등록될지 초기에 고정된다.
그러므로 Organization 별로 Runner Scale Set 설치 해야 함
- arc-rs-org1
- arc-rs-org2
- arc-rs-org3
# ORG 이름으로 구분
ORG_NAME=atportal
RS_NAME="arc-rs-${ORG_NAME}"
GITHUB_CONFIG_URL="https://ktds.ghe.com/${ORG_NAME}"
Installation_ID="ORG의 Github App 페이지 URL 마지막 숫자 4자리"
private-key=gh-app-ktds.2025-05-15.private-key.pem
# Private-key 는 Space의 민감정보 참고
#------------------------------------
# Runner Scale Set은 Repository 직접 연결로는 동작하지 않는다.
# 반드시 “Organization” 레벨로 연결해야 함
#------------------------------------
# ORG 별 secret 생성
$ kubectl create secret generic ${ORG_NAME}-secret \
-n arc-runners \
--from-literal=github_app_id=331 \
--from-literal=github_app_installation_id=${Installation_ID} \
--from-file=github_app_private_key=./${private-key}
$ helm -n arc-runners install ${RS_NAME} \
--set githubConfigUrl="https://ktds.ghe.com/${ORG_NAME}" \
--set githubConfigSecret=${ORG_NAME}-secret \
--set minRunners=1 \
--set maxRunners=5 \
--set scaleDownDelaySeconds=300 \
--set containerMode.type=dind \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set --version 0.11.0
$ helm -n arc-runners list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
arc-rs-cloudbiz-atportal arc-runners 1 2025-04-26 10:52:40.202160112 +0000 UTC deployed gha-runner-scale-set-0.11.0 0.11.0
$ helm -n arc-runners get values ${RS_NAME}
# 삭제시...
$ helm -n arc-runners delete ${RS_NAME}
- dind (Docker IN Docker) 모드
- Runner 컨테이너 내부에서 아래 항목들이 설치된다.
- GitHub Actions Runner
- Docker CLI
- Docker Daemon (dind)
- 주의사항
- dind는 Pod 안에서 별도 데몬을 돌리므로 약간의 리소스 추가 사용
- Runner 컨테이너 내부에서 아래 항목들이 설치된다.
- 참고링크
※ 참고
- 하나의 Runner Scale Set으로 여러 Org를 지원하는 기능은 현재 Github 에서 개발진행중
- PoC 진행중 실패함. 알고 보니 기능 개발 미비 -- 2025.04.26
추가 확인
# Pod 상태 확인:
$ kubectl -n arc-runners get pod
NAME READY STATUS RESTARTS AGE
arc-runner-set-4m7n4-runner-6h7zr 2/2 Running 0 18s
# 성공적으로 설치되면 arc-systems 에 listener pod 가 생긴다.
$ kubectl -n arc-systems get pod
NAME READY STATUS RESTARTS AGE
arc-gha-rs-controller-7cd5d69f6f-jljdf 1/1 Running 0 109m
arc-runner-set-754b578d-listener 1/1 Running 0 59s
# <-- listener 가 생겼다.
# autoscalingrunnersets
$ kubectl -n arc-runners get autoscalingrunnersets
NAME MINIMUM RUNNERS MAXIMUM RUNNERS CURRENT RUNNERS STATE PENDING RUNNERS RUNNING RUNNERS FINISHED RUNNERS DELETING RUNNERS
arc-runner-set 1 5 1 1
autoscalingrunnersets 에서 min / max 값을 조정할 수 있다.
Runner Scale Set의 Min/Max 는 1/5 를 기본 설정하며, Min 의 기준은 Idle Runner Pod 이다. (최소 1대 이상 Idle Pod 실행)
$ kubectl -n arc-runners edit autoscalingrunnersets arc-rs-atportal- 리소스 측면에서 Min : 0 설정을 하고 테스트 시, Github Action 시작 ~ Runner Pod 생성 ~ Workflow 실행 까지의 Delay가 있으므로 Min : 1 으로 설정