Skip to content

bramdehart/github-runner-on-aks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

page_type description languages products
sample
Learn how to deploy self-hosted GitHub Actions Runners on AKS (Azure Kubernetes Service)
bicep
dockerfile
azure-kubernetes-service
github

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:

  • Bicep deployment, which responsible to following tasks:
  • Deploying sample app using the installed self-hosted runner to AKS cluster without keeping Azure password in Github account

Simple Diagram of End State

After deployment, the outcome will be: alt text

Features

This project framework provides the following features:

  • Self-Hosted GitHub Action Runner over AKS
  • Auto-Scale Github Action runner based on 'waiting number of jobs in the queue' metric

Getting Started

Prerequisites

  • Fork this repo to your github account
  • In the forked repo Configure OpenID Connect in Azure. After completing the instructions, the following secrets should be created in your repo secrets: AZURE_CLIENT_ID, AZURE_SUBSCRIPTION_ID, AZURE_TENANT_ID
  • Create additional GitHub Secrets in the repo:
    • name: SSH_PUBLIC_KEY, value: [public key of ssh key which will be used during AKS creation]
    • name: RUNNER_TOKEN, value: Create a new personal access token by login with a GitHub account that has admin privileges for your repo, and create a PAT with the appropriate scopes - for this sample:
    • repo (Full Control)
    • write:packages

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

  • Read more about GitHub Actions Runner Controller (ARC) here
  • Read more how to change runner default image in this great blog

About

Deploy GitHub Action runner on AKS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Bicep 71.3%
  • Dockerfile 28.7%