| .forgejo/workflows | fix(deps): update ghcr.io/catthehacker/ubuntu:act-latest docker digest to a66bcb4 | |
| build | fix(deps): update docker:dind docker digest to 96789d5 | |
| .checkov.yaml | fix: add some docs as to what we're disabling | |
| .gitignore | chore: Ignore unneeded stuff | |
| CHANGELOG.md | chore(version): v0.19.65 [skip ci] | |
| cog.toml | build: Add a prefix to tags | |
| docker-bake.hcl | ci: GPG-Signierung für Helm-Chart hinzufügen | |
| Dockerfile | fix(deps): update ubuntu:latest docker digest to 4a5ffc0 | |
| Justfile | feat: switch to stateful set for ci so the cache is reused | |
| README.md | docs: remove random upper casing | |
| renovate.json | ci: use app preset | |
K8S Forgejo Runner
With docker in docker available in the container.
Features:
- Comes with an autoscaler
- Graceful shutdowns
- One runner per node
- Network policy with only outbound connectivity
- No API token mounted for the Kubernetes API
- Read only file systems and minimal permissions (yeah, I know, DIND needs admin, not much can be done there)
Mostly I just wish I had this reference when I was trying to setup as the example leaves something to be desired. Combined with a cluster autoscaler in your k8s cluster, and you have autoscaling runners.
The raw resources have comments on motivation behind each of the choices, and how to make the deployment more secure. This isn't done out the box as it would require an alternative container runtime (such as gvisor, kata, sysbox, or similar), which is a bit of a niche setup.
Installing
Kustomize
On the releases page you can download the combined versions of the file. You'll need to create a secret with the token in. Here's an example command to generate a new secret.
All resources are created in the forgejo-runner namespace
To print the resource:
kubectl create \
secret generic \
runner-secret \
"--from-literal=token=$RUNNER_TOKEN" \
--dry-run=client \
--output=yaml \
--namespace forgejo-runner
To create it:
kubectl create \
secret generic \
runner-secret \
"--from-literal=token=$RUNNER_TOKEN" \
--namespace forgejo-runner
Alternatively you could use kustomize
apiVersion:kustomize.config.k8s.io/v1beta1kind:Kustomizationresources:- https://codeberg.org/PurpleBooth/forgejo-runner/releases/download/latest/combined.yamlsecretGenerator:- name:runner-secretnamespace:forgejo-runnerbehavior:mergeliterals:- token=your-actual-token-hereHelm
There's a helm chart, if you're feeling like you would rather not leave the browser to read the values, they're on the releases page.
helm show values oci://codeberg.org/purplebooth/helm-forgejo-runner/forgejo-runner > values.yaml
helm install forgejo-runner oci://codeberg.org/purplebooth/helm-forgejo-runner/forgejo-runner \
--namespace forgejo-runner \
--create-namespace \
--values values.yaml