add: kubernetes runner config of 42insight

This commit is contained in:
Haletran 2026-04-04 16:58:42 +02:00
parent 4995a64f05
commit 5e53c3e26d
3 changed files with 106 additions and 0 deletions

32
insight-runners/run Normal file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
# echo 'export KUBECONFIG=/etc/rancher/k3s/k3s.yaml' >> ~/.bashrc && source ~/.bashrc
case "$1" in
install)
curl -sfL https://get.k3s.io | sh -
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml && sudo chmod 644 /etc/rancher/k3s/k3s.yaml
;;
start)
kubectl apply -f k8s/
;;
delete)
kubectl delete -f k8s/
kubectl delete pvc -l app=github-runner
;;
status)
kubectl get pods -l app=github-runner
;;
logs)
kubectl logs "${2:-github-runner-0}" -f
;;
restart)
kubectl rollout restart statefulset github-runner
;;
scale)
kubectl scale statefulset github-runner --replicas="$2"
;;
*)
echo "Usage: $0 {start|delete|status|logs|restart|scale}"
exit 1
esac

View file

@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: github-runner-secret
type: Opaque
stringData:
access-token: "your_access_token"

View file

@ -0,0 +1,67 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: github-runner
spec:
serviceName: github-runner
replicas: 7
selector:
matchLabels:
app: github-runner
template:
metadata:
labels:
app: github-runner
spec:
containers:
- name: runner
image: myoung34/github-runner:latest
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: REPO_URL
value: "your_repo"
- name: RUNNER_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: github-runner-secret
key: access-token
- name: RUNNER_WORKDIR
value: "/tmp/runner/work"
- name: CONFIGURED_ACTIONS_RUNNER_FILES_DIR
value: "/runner/data"
- name: RUNNER_SCOPE
value: "repo"
- name: DISABLE_AUTOMATIC_DEREGISTRATION
value: "true"
- name: LABELS
value: "linux,x64,gpu,$(POD_NAME)"
securityContext:
privileged: true
volumeMounts:
- name: runner-data
mountPath: /runner/data
- name: docker-sock
mountPath: /var/run/docker.sock
- name: tmp-runner
mountPath: /tmp/runner
volumes:
- name: docker-sock
hostPath:
path: /var/run/docker.sock
- name: tmp-runner
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: runner-data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi