ラズパイk8sにself-hosted runnersをActions Runner Controllerでインストール
Actions Runner Controller (ARC) は、GitHub Actions の
セルフホステッド ランナー
を
調整およびスケーリングする Kubernetes オペレーターです。
セルフホステッドランナーなら無料でGithub Actionsが実行できるらしいので
こちら
を参考にラズパイk8sにインストールしてみました。
個人アカウントで試しています。
環境
いつものようにラズパイk8sで試しています。
ubuntu@k8s1:~$ k get node -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s1 Ready control-plane,etcd,master 334d v1.28.10+rke2r1 192.168.0.51 <none> Ubuntu 24.04 LTS 6.8.0-1028-raspi containerd://1.7.11-k3s2
k8s2 Ready worker 212d v1.28.10+rke2r1 192.168.0.52 <none> Ubuntu 24.04.1 LTS 6.8.0-1013-raspi containerd://1.7.11-k3s2
k8s3 Ready worker 334d v1.28.10+rke2r1 192.168.0.53 <none> Ubuntu 24.04 LTS 6.8.0-1013-raspi containerd://1.7.11-k3s2
GitHub App で ARC の認証を行う
今回はpersonal access tokens (classic)ではなく、GitHub Appで認証してみます。
こちら
のドキュメントを参考にアプリID、インストールID、秘密鍵ファイルを取得してください。
個人アカウントで発行したのでインストールIDがわかりづらかったですが、
以下のURL形式になっていると思います。
https://github.com/settings/installations/
<インストールID>
この情報を使ってkubernetes secretを作成するのですが、
せっかくvaultとesoをインストールしていますのでそれらを使ってsecretを作成しようと思います。
こちら
を参考にしてもらえればと思います。
以下のコマンドでsecretを作成していますが、変数は事前に設定しておいてください。
ubuntu@k8s1:~$ vault secrets enable -path=arc-runners -description="github app for arc" kv-v2
Success! Enabled the kv-v2 secrets engine at: arc-runners/
ubuntu@k8s1:~$ cat private-key.pem | vault kv put -mount=arc-runners github-config-secret github_app_id=$github_app_id github_app_installation_id=$github_app_installation_id github_app_private_key=-
============ Secret Path ============
arc-runners/data/github-config-secret
======= Metadata =======
Key Value
--- -----
created_time 2025-06-07T08:28:20.666319318Z
custom_metadata <nil>
deletion_time n/a
destroyed false
version 1
後ほどインストールするgha-runner-scale-setと同じnamespaceに
secretとして作成したいので、以下の設定で準備します。
ubuntu@k8s1:~$ vault read auth/my-cluster/role/vault-eso
Key Value
--- -----
alias_name_source serviceaccount_uid
bound_service_account_names [vault-eso]
bound_service_account_namespace_selector n/a
bound_service_account_namespaces [arc-runners]
policies [github-config-secret]
token_bound_cidrs []
token_explicit_max_ttl 0s
token_max_ttl 0s
token_no_default_policy false
token_num_uses 0
token_period 0s
token_policies [github-config-secret]
token_ttl 24h
token_type default
ttl 24h
ubuntu@k8s1:~$ vault policy read github-config-secret
path "arc-runners/data/github-config-secret" {
capabilities = ["read"]
}
eso側のリソースは以下で作成しました。
---
apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
name: vault-backend
namespace: arc-runners
spec:
provider:
vault:
server: "http://vault.tsuchinokometal.com"
path: "arc-runners"
version: "v2"
auth:
kubernetes:
mountPath: "my-cluster"
role: "vault-eso"
serviceAccountRef:
name: "vault-eso"
---
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: eso-secret
namespace: arc-runners
spec:
refreshInterval: "15s"
secretStoreRef:
name: vault-backend
kind: SecretStore
target:
name: pre-defined-secret
data:
- secretKey: github_app_id
remoteRef:
key: github-config-secret
property: github_app_id
- secretKey: github_app_installation_id
remoteRef:
key: github-config-secret
property: github_app_installation_id
- secretKey: github_app_private_key
remoteRef:
key: github-config-secret
property: github_app_private_key
namespaceとservice accountを作成して
secretが作成されたことを確認してください。
ubuntu@k8s1:~$ kubectl get secrets -n arc-runners
NAME TYPE DATA AGE
pre-defined-secret Opaque 3 57s
アクション ランナー コントローラーのインストール
アクションランナーコントローラー をhelmでインストールします。
ubuntu@k8s1:~$ helm install arc --namespace arc-systems --create-namespace --values override-actions-runner-controller.yaml oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller
Pulled: ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller:0.11.0
Digest: sha256:35003eb7db8bba6dbf4f3df1d637959d938f7a8d7fad5640de9b5f5f834e1b0b
NAME: arc
LAST DEPLOYED: Thu Jun 12 18:20:32 2025
NAMESPACE: arc-systems
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Thank you for installing gha-runner-scale-set-controller.
Your release is named arc.
ubuntu@k8s1:~$ helm list -n arc-systems
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
arc arc-systems 1 2025-06-12 18:20:32.298098914 +0900 JST deployed gha-runner-scale-set-controller-0.11.0 0.11.0
override-actions-runner-controller.yamlは以下にしていますが、特になくても動くと思います。
#metrics:
# serviceMonitor:
# enable: true
logFormat: json
actionsMetrics:
serviceMonitor:
enable: true
actionsMetricsServer:
enabled: true
logFormat: json
ランナー スケール セットの構成
ランナー スケール セット
をhelmでインストールします。
GITHUB_CONFIG_URLは自身の環境に合わせて変更してください。
あと、githubConfigSecretに先ほど作成したsecretを指定しています。
ubuntu@k8s1:~$ GITHUB_CONFIG_URL="https://github.com/<username>/<repo_name>"
ubuntu@k8s1:~$ helm install arc-runner-set --namespace arc-runners --create-namespace --set githubConfigUrl="${GITHUB_CONFIG_URL}" --set githubConfigSecret=pre-defined-secret oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set
Pulled: ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set:0.11.0
Digest: sha256:41a4c0e683b6a62fce1e7afd71429b4bc18aaec92b9724afd3ce6a04dd0a014d
NAME: arc-runner-set
LAST DEPLOYED: Thu Jun 12 18:24:09 2025
NAMESPACE: arc-runners
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Thank you for installing gha-runner-scale-set.
Your release is named arc-runner-set.
ubuntu@k8s1:~$ helm list -n arc-runners
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
arc-runner-set arc-runners 1 2025-06-12 18:24:09.048253938 +0900 JST deployed gha-runner-scale-set-0.11.0 0.11.0
Runningになっていることを確認します。
もしlistenerが起動していなかったらGithubとの認証に失敗している可能性があります。
ubuntu@k8s1:~$ k get pod -n arc-systems
NAME READY STATUS RESTARTS AGE
arc-gha-rs-controller-76578ddf4f-hrp5f 1/1 Running 0 6s
arc-runner-set-754b578d-listener 1/1 Running 0 24s
以下のURLにアクセスすると登録されていることが確認できると思います。
https://github.com/<username>/<repo_name>/settings/actions/runners

ランナー スケール セットの使用
こちら を参考にワークフローを実行してみます。
ファイル名はなんでもいいですが、
以下のような感じにrunnerを登録したリポジトリにワークフローを作成します。
.github/workflows/github-actions-demo.yml
内容はドキュメントにあるサンプルのまんまです。
無事実行できました。

Pod側も確認してみます。
やたらプルに時間かかっていますが、無事podが起動してジョブを処理していました。
新規Podが起動しているのでデフォルトだと
kubernetesモード
になっているみたいですね。
ubuntu@k8s1:~$ k get pod -n arc-runners -w
NAME READY STATUS RESTARTS AGE
arc-runner-set-xx4m5-runner-xxdtr 0/1 ContainerCreating 0 2m43s
arc-runner-set-xx4m5-runner-xxdtr 1/1 Running 0 5m18s
arc-runner-set-xx4m5-runner-xxdtr 0/1 Completed 0 6m16s
arc-runner-set-xx4m5-runner-xxdtr 0/1 Terminating 0 6m17s
arc-runner-set-xx4m5-runner-xxdtr 0/1 Terminating 0 6m27s
arc-runner-set-xx4m5-runner-xxdtr 0/1 Terminating 0 6m34s
arc-runner-set-xx4m5-runner-xxdtr 0/1 Terminating 0 6m35s
arc-runner-set-xx4m5-runner-xxdtr 0/1 Terminating 0 6m35s
arc-runner-set-xx4m5-runner-xxdtr 0/1 Terminating 0 6m35s
arm64環境でも使えるのはありがたいですね!