Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
GitHub Docs

Authenticating ARC to the GitHub API

Learn how to authenticate Actions Runner Controller to the GitHub API.

You can authenticate Actions Runner Controller (ARC) to the GitHub API by using a GitHub App or by using a personal access token (classic).

Note

You cannot authenticate using a GitHub App for runners at the enterprise level. For more information, seeManaging access to self-hosted runners using groups.

Authenticating ARC with a GitHub App

  1. Create a GitHub App that is owned by an organization. For more information, seeRegistering a GitHub App. Configure the GitHub App as follows.

    1. For "Homepage URL," enterhttps://github.com/actions/actions-runner-controller.

    2. Under "Permissions," clickRepository permissions. Then use the dropdown menus to select the following access permissions.

      • Administration: Read and write

        Note

        Administration: Read and write is only required when configuring Actions Runner Controller to register at the repository scope. It is not required to register at the organization scope.

      • Metadata: Read-only

    3. Under "Permissions," clickOrganization permissions. Then use the dropdown menus to select the following access permissions.

      • Self-hosted runners: Read and write
  2. After creating the GitHub App, on the GitHub App's page, note the value for "App ID". You will use this value later.

  3. Under "Private keys", clickGenerate a private key, and save the.pem file. You will use this key later.

  4. In the menu at the top-left corner of the page, clickInstall app, and next to your organization, clickInstall to install the app on your organization.

  5. After confirming the installation permissions on your organization, note the app installation ID. You will use it later. You can find the app installation ID on the app installation page, which has the following URL format:

    https://github.com/organizations/ORGANIZATION/settings/installations/INSTALLATION_ID

  6. Register the app ID, installation ID, and the downloaded.pem private key file from the previous steps to Kubernetes as a secret.

    To create a Kubernetes secret with the values of your GitHub App, run the following command.

    Note

    Create the secret in the same namespace where thegha-runner-scale-set chart is installed. In this example, the namespace isarc-runners to match the quickstart documentation. For more information, seeQuickstart for Actions Runner Controller.

    Bash
    kubectl create secret generic pre-defined-secret \   --namespace=arc-runners \   --from-literal=github_app_id=123456 \   --from-literal=github_app_installation_id=654321 \   --from-literal=github_app_private_key='-----BEGIN RSA PRIVATE KEY-----********'

    Then using thegithubConfigSecret property in your copy of thevalues.yaml file, pass the secret name as a reference.

    githubConfigSecret:pre-defined-secret

For additional Helm configuration options, seevalues.yaml in the ARC repository.

Authenticating ARC with a personal access token (classic)

ARC can use personal access tokens (classic) to register self-hosted runners.

  1. Create a personal access token (classic) with the required scopes. The required scopes are different depending on whether you are registering runners at the repository or organization level. For more information on how to create a personal access token (classic), seeManaging your personal access tokens.

    The following is the list of required personal access token scopes for ARC runners.

    • Repository runners:repo
    • Organization runners:admin:org
  2. To create a Kubernetes secret with the value of your personal access token (classic), use the following command.

    Note

    Create the secret in the same namespace where thegha-runner-scale-set chart is installed. In this example, the namespace isarc-runners to match the quickstart documentation. For more information, seeQuickstart for Actions Runner Controller.

    Bash
    kubectl create secret generic pre-defined-secret \   --namespace=arc-runners \   --from-literal=github_token='YOUR-PAT'
  3. In your copy of thevalues.yaml file, pass the secret name as a reference.

    githubConfigSecret:pre-defined-secret

    For additional Helm configuration options, seevalues.yaml in the ARC repository.

Authenticating ARC with a fine-grained personal access token

ARC can use fine-grained personal access tokens to register self-hosted runners.

  1. Create a fine-grained personal access token with the required scopes. The required scopes are different depending on whether you are registering runners at the repository or organization level. For more information on how to create a fine-grained personal access token, seeManaging your personal access tokens.

    The following is the list of required personal access token scopes for ARC runners.

    • Repository runners:

      • Administration: Read and write
    • Organization runners:

      • Administration: Read
      • Self-hosted runners: Read and write
  2. To create a Kubernetes secret with the value of your fine-grained personal access token, use the following command.

    Note

    Create the secret in the same namespace where thegha-runner-scale-set chart is installed. In this example, the namespace isarc-runners to match the quickstart documentation. For more information, seeQuickstart for Actions Runner Controller.

    Bash
    kubectl create secret generic pre-defined-secret \   --namespace=arc-runners \   --from-literal=github_token='YOUR-PAT'
  3. In your copy of thevalues.yaml file, pass the secret name as a reference.

    githubConfigSecret:pre-defined-secret

    For additional Helm configuration options, seevalues.yaml in the ARC repository.

Authenticating ARC with vault secrets

Note

Vault integration is currently available in public preview with support for Azure Key Vault.

Starting with gha-runner-scale-set version 0.12.0, ARC supports retrieving GitHub credentials from an external vault. Vault integration is configured per runner scale set. This means you can run some scale sets using Kubernetes secrets while others use vault-based secrets, depending on your security and operational requirements.

Enabling Vault Integration

To enable vault integration for a runner scale set:

  1. Set thegithubConfigSecret field in yourvalues.yaml file to the name of the secret key stored in your vault. This value must be a string.
  2. Uncomment and configure thekeyVault section in yourvalues.yaml file with the appropriate provider and access details.
  3. Provide the required certificate (.pfx) to both the controller and the listener. You can do this by:*Rebuilding the controller image with the certificate included, or*Mounting the certificate as a volume in both the controller and the listener using thelistenerTemplate andcontrollerManager fields.

Secret Format

The secret stored in Azure Key Vault must be in JSON format. The structure depends on the type of authentication you are using:

Example: GitHub Token

{"github_token":"TOKEN"}

Example: GitHub App

{"github_app_id":"APP_ID_OR_CLIENT_ID","github_app_installation_id":"INSTALLATION_ID","github_app_private_key":"PRIVATE_KEY"}

Configuringvalues.yaml for Vault Integration

The certificate is stored as a .pfx file and mounted to the container at /akv/cert.pfx. Below is an example of how to configure the keyVault section to use this certificate for authentication:

keyVault:type:"azure_key_vault"proxy:https:url:"PROXY_URL"credentialSecretRef:"PROXY_CREDENTIALS_SECRET_NAME"http: {}noProxy: []azureKeyVault:clientId:<AZURE_CLIENT_ID>tenantId:<AZURE_TENANT_ID>url:<AZURE_VAULT_URL>certificatePath:"/akv/cert.pfx"

Providing the Certificate to the Controller and Listener

ARC requires a.pfx certificate to authenticate with the vault. This certificate must be made available to both the controller and the listener components during controller installation.You can do this by mounting the certificate as a volume using thecontrollerManager andlistenerTemplate fields in yourvalues.yaml file:

volumes:-name:cert-volumesecret:secretName:my-cert-secretvolumeMounts:-mountPath:/akvname:cert-volumereadOnly:truelistenerTemplate:volumeMounts:-name:cert-volumemountPath:/akv/certsreadOnly:truevolumes:-name:cert-volumesecret:secretName:my-cert-secret

The code below is an example of a scale setvalues.yml file.

listenerTemplate:spec:containers:-name:listenervolumeMounts:-name:cert-volumemountPath:/akvreadOnly:truevolumes:-name:cert-volumesecret:secretName:my-cert-secret

Legal notice

Portions have been adapted fromhttps://github.com/actions/actions-runner-controller/ under the Apache-2.0 license:

Copyright 2019 Moto IshizawaLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at    http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

[8]ページ先頭

©2009-2025 Movatter.jp