Skip to content

Latest commit

 

History

History
78 lines (56 loc) · 2.76 KB

File metadata and controls

78 lines (56 loc) · 2.76 KB

Self Hosted runners on GKE that support Docker Workflows

Overview

This example shows how to deploy runners that support Docker Workflows on GKE.

More examples of Self Hosted Runners on GKE/Anthos.

Steps to deploy this example

  • Step 1: Create terraform.tfvars file with the necessary values.

Access tokens require repo scope for private repos and public_repo scope for public repos. GitHub Apps must have the administration permission to use this API. Authenticated users must have admin access to the repository to use this API.

More info can be found here.

project_id = "your-project-id"
gh_token   = "your-github-token"
repo_url   = "https://github.com/owner/your-repo-name"
repo_name  = "your-repo-name"
repo_owner = "owner"
  • Step 2: Create the infrastructure.
$ terraform init
$ terraform plan
$ terraform apply
  • Step 3: Build the example runner image using Google Cloud Build. Alternatively, you can also use a prebuilt image or build using a local docker daemon.
$ gcloud config set project $PROJECT_ID
$ gcloud services enable cloudbuild.googleapis.com
$ gcloud builds submit --config=cloudbuild.yaml
$ kustomize edit set image gcr.io/PROJECT_ID/runner:latest=gcr.io/$PROJECT_ID/runner:latest
  • Step 5: Generate kubeconfig and apply the manifests for Deployment and HorizontalPodAutoscaler.
$ gcloud container clusters get-credentials your-cluster-name --zone=your-cluster-zone
$ kustomize build . | kubectl apply -f -

Inputs

Name Description Type Default Required
gh_token Github token that is used for generating Self Hosted Runner Token string n/a yes
project_id The project id to deploy Github Runner MIG string n/a yes
repo_name Name of the repo for the Github Action string n/a yes
repo_owner Owner of the repo for the Github Action string n/a yes
repo_url Repo URL for the Github Action string n/a yes

Outputs

Name Description
ca_certificate The cluster ca certificate (base64 encoded)
client_token The bearer token for auth
cluster_name Cluster name
kubernetes_endpoint The cluster endpoint
location Cluster location
service_account The default service account used for running nodes.