Azure-Samples / github-runner-on-aks

Deploy GitHub Action runner on AKS
MIT License
12 stars 60 forks source link

page_type: sample description: Learn how to deploy self-hosted GitHub Actions Runners on AKS (Azure Kubernetes Service) languages:

Self-Hosted GitHub Actions Runner On AKS (Azure Kubernetes Service) with auto-scale option

This repo will demo shortly how you can connect to your github account a self-hosted runner which deployed on Azure Kubernetes Service (AKS) with auto-scale option - which provide an ability to handle successfully many github action job requests in parallel. This project include the following:

Simple Diagram of End State

After deployment, the outcome will be: alt text

Features

This project framework provides the following features:

Getting Started

Prerequisites

Installation

Follow this instructions:

Using images from private registry

When using private images, the RunnerDeployment will not be able to pull your image.
To use a private registry (e.g ghcr.io with visibility set to private) add the following:

# When using private registry, we need to create a secret for that as well
kubectl create secret docker-registry runnersecret \
  --docker-server=https://${{ env.REGISTRY }}/ \
  --docker-username=${{ github.repository }} \
  --docker-password=${{ secrets.RUNNER_TOKEN }}
    spec:
      repository: yaronpri/GithubRunnerOnAKS
      #organization: <YOUR ORG NAME IF WANT TO WORK AT ORG LEVEL> 
      image: ghcr.io/yaronpri/GithubRunnerOnAKS:<tag>
      imagePullSecrets:
      - name: runnersecret

Demo

In order to test the auto-scale of the runners, execute several times the GitHub Action - Deploy Sample App You will notice that after a while, a new runners are being added and able to pull the newly created jobs and process all of them in parallel

Resources