Actions Runner Controller

set github runners on k8s cluster

Repository for better understanding - https://github.com/actions/actions-runner-controller

Using Helm, deploy the GitHub Actions Runner Controller (ARC) on Kubernetes. Set up and operate a workflow in the Kubernetes environment using runner scale settings to optimize parallel job execution and improve workflow speed.

Steps -

  1. install k8's by kubespray

  2. iptables -t nat -A POSTROUTING -s 172.17.0.0/16 -j MASQUERADE

  3. apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev

  4. helm repo update

  5. kubectl create ns actions

  6. kubectl create secret generic controller-manager -n actions --from-literal=github_token=<< github_token>>

  7. helm repo add jetstack https://charts.jetstack.io

  8. kubectl label namespace cert-manager certmanager.k8s.io/disable-validation=true

  9. helm install runner actions-runner-controller/actions-runner-controller --namespace actions --version 0.20.2 --set syncPeriod=1m

  10. kubectl apply -f runner_dockerbuild.yaml --validate=false

Create runner_dockerbuild.yaml file -

---
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
  name: k8s-single-runner
  namespace: actions
spec:
  # replicas: 5
  template:
    spec:
      organization: 0chain
      labels:
        - build
        - docker-builds
        - arc-runner
        - arc-runner3
      # ephemeral: false
---
apiVersion: actions.summerwind.dev/v1alpha1
kind: HorizontalRunnerAutoscaler
metadata:
  name: k8s-single-runner
  namespace: actions
spec:
  # Runners in the targeted RunnerDeployment won't be scaled down
  # for 5 minutes instead of the default 10 minutes now
  scaleDownDelaySecondsAfterScaleOut: 300
  scaleTargetRef:
    type: RunnerDeployment
    # # In case the scale target is RunnerSet:
    # kind: RunnerSet
    name: k8s-single-runner
  minReplicas: 2
  maxReplicas: 4
  metrics:
  - type: PercentageRunnersBusy
    scaleUpThreshold: '0.75'
    scaleDownThreshold: '0.25'
    scaleUpFactor: '2'
    scaleDownFactor: '0.5'

Last updated