Skip to content

Instantly share code, notes, and snippets.

@tsuzu
Created February 11, 2020 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsuzu/83788e950c82b599f58187a8405b2ee1 to your computer and use it in GitHub Desktop.
Save tsuzu/83788e950c82b599f58187a8405b2ee1 to your computer and use it in GitHub Desktop.
Template for GitHub Actions self-hosted runner on Kubernetes
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: github-actions-runner
spec:
serviceName: "github-actions-runner-svc"
replicas: 1
selector:
matchLabels:
app: github-actions-runner
template:
metadata:
labels:
app: github-actions-runner
spec:
serviceAccountName: deploy-runner
initContainers:
- name: copy-files
imagePullPolicy: Always
image: tcardonne/github-runner
command:
- bash
- "-c"
- "if [ ! -f /mnt/config.sh ]; then cp -r /home/runner/* /mnt/; fi"
volumeMounts:
- mountPath: /mnt/
name: runner-pv
containers:
- name: runner
imagePullPolicy: Always
image: tcardonne/github-runner
env:
- name: DOCKER_HOST
value: 127.0.0.1
- name: RUNNER_REPOSITORY_URL
value: https://github.com/MISW/k8s
- name: AGENT_ALLOW_RUNASROOT
value: "1"
- name: RUNNER_REPLACE_EXISTING
value: "true"
envFrom:
- secretRef: # GITHUB_TOKEN
name: github-actions-token
volumeMounts:
- mountPath: /home/runner
name: runner-pv
- name: docker
image: docker:stable-dind
env:
- name: DOCKER_TLS_CERTDIR
value: ""
securityContext:
privileged: true
volumeClaimTemplates:
- metadata:
name: runner-pv
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: "managed-nfs-storage"
resources:
requests:
storage: 1Gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment