[Git] EKS ARC 세팅 방법

Alli_Eunbi·2023년 8월 15일
0
post-thumbnail

1. ARC 란?

GitHub Actions의 Action Runner Controller는 GitHub에서 호스팅되는 자동화 서비스의 일부입니다. 이것은 개별적인 GitHub Actions 실행 환경인 "Action Runner"들을 관리하는 서비스입니다.

Action Runner는 GitHub Actions가 작동하는 데 중요한 역할을 합니다. 각각의 Action Runner는 특정 작업을 수행할 수 있는 가상 환경을 제공하며, GitHub Actions 워크플로우가 실행될 때 이러한 Runner들이 이러한 작업들을 처리합니다.

Action Runner Controller는 이러한 Runner들의 등록, 배정, 스케일링 등을 관리합니다. 이를 통해 자동화된 작업들을 효율적으로 분배하고, 워크플로우 실행에 필요한 적절한 환경을 제공합니다. 또한 필요에 따라 새로운 Runner를 동적으로 생성하거나 종료하여 자원 사용을 최적화할 수 있습니다.

Action Runner Controller는 GitHub Actions의 기본적인 작동 방식을 조정하고, GitHub 사용자가 정의한 워크플로우를 실행하는 데 도움을 줍니다. 자동화된 빌드, 테스트, 배포 등의 작업을 효율적이고 안정적으로 처리할 수 있도록 관리되며, GitHub Actions의 핵심 구성 요소 중 하나로서 중요한 역할을 합니다.

2. 필요사항

3. 단계별 INSTALL

참조 : https://github.com/actions/actions-runner-controller/blob/master/docs/quickstart.md

1. 클러스터에 Cert-manager 설치

  • Cert-manager는 Kubernetes 내부에서 HTTPS 통신을 위한 인증서를 생성하고, 또 인증서의 만료 기간이 되면 자동으로 인증서를 갱신해주는 역할을 하는 Certificate manager controller입니다.
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.2/cert-manager.yaml

2. ARC를 Helm으로 설치

  • 저장소 추가

    helm repo add actions-runner-controller https://actions-runner-controller.github.io/actions-runner-controller
  • helm 차트로 설치

    • "REPLACE_YOUR_TOKEN_HERE" ← 이부분에 위에서 발급받은 깃허브 토큰으로 교체

      helm upgrade --install \
        --set=authSecret.create=true\
        --set=authSecret.github_token="REPLACE_YOUR_TOKEN_HERE"\
        --wait actions-runner-controller actions-runner-controller/actions-runner-controller
    • 아래 명령어 실행하면 아래 이미지와 같이 터미널에 뜨는 NOTES: 밑의 command 내용을 실행해서 동작 여부 확인 가능

      • actions-runner-controller를 로컬에서 접근 가능하도록 해줌.

  • Github 자체 호스팅 러너 생성 및 git repo에 연결
    • runnerdeployment.yaml 파일 만들고 아래 붙여넣기
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
  name: github-runnerdeploy
spec:
  replicas: 1
  template:
    spec:
      repository: "깃허브 레포지토리 이름"
      # 개발/운영으로 github action runner를 구분할때 아래 labels 활용
      labels:
      - dev-self-hosted-runner
  • 아래 명령어를 사용하여 위 파일 적용
kubectl apply -f runnerdeployment.yaml

4. 에러 트래킹

  • no endpoints available for service "webhook-service"
$ k apply -f runnerdeployment.yaml
Error from server (InternalError): error when creating "runnerdeployment.yaml"
: Internal error occurred: 
failed calling webhook "mutate.runnerdeployment.actions.summerwind.dev": failed to call webhook: 
Post "https://webhook-service.actions-runner-system.svc:443/mutate-actions-summerwind-dev-v1alpha1-runnerdeployment?timeout=10s"
: no endpoints available for service "webhook-service"
  • 위와 같은 에러 발생시, 아래의 web-hook 관련 정보 삭제 명령어 실행
kubectl delete validatingwebhookconfiguration validating-webhook-configuration
kubectl delete mutatingwebhookconfiguration mutating-webhook-configuration
kubectl delete mutatingwebhookconfiguration actions-runner-controller-mutating-webhook-configuration
kubectl delete validatingwebhookconfiguration actions-runner-controller-validating-webhook-configuration

참조) https://github.com/actions/actions-runner-controller/blob/master/docs/quickstart.md

  • Error: Kubernetes cluster unreachable: the server has asked for the client to provide credentials
    (이 부분은 ARC 보다는 깃허브 파이프라인 에러에 가깝지만 비슷한 에러에 봉착한다면 이 방법으로 해결 가능합니다.)
    • AWS ACCESS KEY 혹은 AWS SECRET ACCESS KEY의 문제이므로 AWS 토큰이 제대로 설정 되어 있는건지 확인 해야함.
profile
BACKEND

0개의 댓글