Kubernetes Community Days Guatemala - Self-hosted GitHub Actions runners using Kubernetes.
-
Create GitHub organization -
kcd-guatemala
. -
Create repo in org as k8s-self-hosted-runners into new organization.
-
Push code to new repo adding new remote.
git remote set-url origin [email protected]:kcd-guatemala/k8s-self-hosted-runners.git git remote set-url --push origin [email protected]:kcd-guatemala/k8s-self-hosted-runners.git git branch -M main git push -u origin main
-
Launch
hello-world
GitHub Action on GitHub cloud manually. -
Create GitHub Personal Access Token with following permissions:
repo
(full access)workflow
(full control)admin:org
(full access)admin:public_key
(read: public_key)admin:repo_hook
(read:repo_hook)admin:org_hook
(full control)notifications
(full control)
-
Clone new repository and open it in VS Code.
-
Create a local kind cluster in your laptop.
kind create cluster
-
Install the cert-manager Helm chart.
helm repo add jetstack https://charts.jetstack.io helm upgrade --install \ cert-manager jetstack/cert-manager \ --namespace cert-manager \ --create-namespace \ --version v1.6.1 \ --set installCRDs=true
-
Install the actions-runner-controller Helm chart.
helm repo add actions-runner-controller \ https://actions-runner-controller.github.io/actions-runner-controller helm upgrade --install \ actions-runner-controller \ actions-runner-controller/actions-runner-controller \ --namespace actions-runner-system \ --create-namespace \ --set authSecret.create=true \ --set authSecret.github_token=<TOKEN>
-
Create the repository runner.
kubectl apply -f runners/repo-runner.yaml
-
Modify the
runs-on
field of thehello-world
GitHub Action toself-hosted
. -
Launch
hello-world
GitHub Action which runs inside kind cluster. -
Delete the repository runner.
-
Trigger the
hello-world
GitHub Action. Will be enqueued and waiting for a runner. -
Create the runner to use in the existing repository again and show how the action is running in the runner again.
-
Create another repository with a README and create and trigger the
hello-world
GitHub Action. Will be enqueued and waiting for a runner. -
Delete the repository runner and create the organization runner.
kubectl apply -f runners/org-runner.yaml
-
Both actions will be running in the organization runner.
-
Comment enterprise runner.
-
Delete organization runner and create the deployment runner for the organization.
kubectl apply -f runners/deployment-runner.yaml
-
Create the HRA - more available options in the docs. Remove replicas from the deployment runner.
kubectl apply -f runners/hra.yaml
-
Comment runner labels.
-
Comment runner groups for enterprise plan.
-
Stateful Runners.
-
Usage limits.
-
Billing minutes.
- https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners
- https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners#usage-limits
- https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
- https://github.com/actions-runner-controller/actions-runner-controller