Add Gitea Runner deployment on K8s

- Deploy act_runner v0.3.0 with DinD sidecar in soo namespace
- Auto-register to Gitea (gitea.inje-private.com)
- Labels: ubuntu-latest, ubuntu-22.04, self-hosted
- Enable Actions on repo via API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Cloud User 2026-02-25 15:00:42 +09:00
parent 03779480c0
commit c139018d07
3 changed files with 142 additions and 10 deletions

View File

@ -23,7 +23,7 @@ https://gitea.inje-private.com/selee/mlops-architecture
| 컴포넌트 | 상태 | 위치 | | 컴포넌트 | 상태 | 위치 |
|----------|------|------| |----------|------|------|
| Gitea | installed | 외부 클러스터 | | Gitea | installed | 외부 클러스터 |
| Gitea Runner | **TODO** | 이 클러스터 (`soo` ns) | | Gitea Runner | **installed** (v0.3.0) | 이 클러스터 (`soo` ns) |
| ArgoCD | installed + **repo 연동 완료** | 이 클러스터 (`argocd` ns) | | ArgoCD | installed + **repo 연동 완료** | 이 클러스터 (`argocd` ns) |
| DVC | **installed** (v3.66.1) | 로컬 + NAS (`/ainas/dvc-storage`) | | DVC | **installed** (v3.66.1) | 로컬 + NAS (`/ainas/dvc-storage`) |
@ -50,12 +50,31 @@ git push -u origin main
--- ---
## 2. Gitea Runner ## 2. Gitea Runner (설치 완료)
> TODO: 설치 후 아래 내용 업데이트 이 클러스터 `soo` 네임스페이스에 배포. Docker-in-Docker(DinD) sidecar 방식.
- Runner 이름: `mlops-runner`
- 이미지: `gitea/act_runner:latest` (v0.3.0)
- Labels: `ubuntu-latest`, `ubuntu-22.04`, `self-hosted`
- Gitea instance: `https://gitea.inje-private.com`
```bash ```bash
# 설치 예정 명령어가 여기에 추가됩니다 # 1. repo에서 Actions 활성화 (API)
curl -sk -X PATCH "https://gitea.inje-private.com/api/v1/repos/selee/mlops-architecture" \
-u "$GITEA_ADMIN_USER:$GITEA_ADMIN_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"has_actions": true}'
# 2. Runner 배포
kubectl apply -f gitea-runner/deployment.yaml
# 3. 상태 확인
kubectl get pods -n soo -l app=gitea-runner
kubectl logs -n soo -l app=gitea-runner -c runner --tail=20
# 4. Gitea에서 Runner 등록 확인
# https://gitea.inje-private.com/selee/mlops-architecture/settings/actions/runners
``` ```
--- ---
@ -127,6 +146,8 @@ mlops_architecture/
├── .dvc/ # DVC 설정 (remote 등) ├── .dvc/ # DVC 설정 (remote 등)
├── argocd/ ├── argocd/
│ └── application.yaml # ArgoCD Application 정의 │ └── application.yaml # ArgoCD Application 정의
├── gitea-runner/
│ └── deployment.yaml # Gitea Runner K8s 배포 (Secret+ConfigMap+Deployment)
└── manifests/ # K8s 배포 manifest (ArgoCD가 감시) └── manifests/ # K8s 배포 manifest (ArgoCD가 감시)
``` ```

View File

@ -23,12 +23,17 @@ components:
installed: true # 외부에서 운영 중 installed: true # 외부에서 운영 중
gitea_runner: gitea_runner:
location: this_cluster # Gitea는 외부지만 Runner는 이 클러스터에 설치 location: this_cluster
namespace: soo # 워크로드와 같은 네임스페이스 namespace: soo
version: "" # 파이프라인 개발 시 설치 예정 version: v0.3.0 # act_runner version
deploy_type: kubernetes image: gitea/act_runner:latest
installed: false deploy_type: kubernetes # Deployment + DinD sidecar
note: "GPU/NAS 접근을 위해 이 클러스터에 설치 예정" runner_name: mlops-runner
labels:
- ubuntu-latest
- ubuntu-22.04
- self-hosted
installed: true
argocd: argocd:
namespace: argocd namespace: argocd

View File

@ -0,0 +1,106 @@
apiVersion: v1
kind: Secret
metadata:
name: gitea-runner-secret
namespace: soo
type: Opaque
stringData:
token: cLwr1iibt23oBSMqcWUJ6vcn3Wj8DQI9huCe2ATK
---
apiVersion: v1
kind: ConfigMap
metadata:
name: gitea-runner-config
namespace: soo
data:
config.yaml: |
log:
level: info
runner:
file: .runner
capacity: 1
timeout: 3h
labels:
- "ubuntu-latest:docker://node:20-bookworm"
- "ubuntu-22.04:docker://ubuntu:22.04"
- "self-hosted:host"
container:
network: ""
privileged: false
options:
valid_volumes: []
host:
workdir_parent: /data/cache
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitea-runner
namespace: soo
labels:
app: gitea-runner
spec:
replicas: 1
selector:
matchLabels:
app: gitea-runner
template:
metadata:
labels:
app: gitea-runner
spec:
containers:
- name: runner
image: gitea/act_runner:latest
command:
- sh
- -c
- |
# Register if not already registered
if [ ! -f /data/.runner ]; then
act_runner register --no-interactive \
--instance https://gitea.inje-private.com \
--token $(cat /secrets/token) \
--name mlops-runner \
--labels "ubuntu-latest:docker://node:20-bookworm,self-hosted:host"
fi
act_runner daemon --config /config/config.yaml
env:
- name: DOCKER_HOST
value: tcp://localhost:2376
- name: DOCKER_TLS_VERIFY
value: "1"
- name: DOCKER_CERT_PATH
value: /certs/client
volumeMounts:
- name: runner-data
mountPath: /data
- name: runner-config
mountPath: /config
- name: runner-secret
mountPath: /secrets
- name: docker-certs
mountPath: /certs
- name: docker-in-docker
image: docker:dind
securityContext:
privileged: true
env:
- name: DOCKER_TLS_CERTDIR
value: /certs
volumeMounts:
- name: docker-certs
mountPath: /certs
- name: runner-data
mountPath: /data
volumes:
- name: runner-data
emptyDir: {}
- name: docker-certs
emptyDir: {}
- name: runner-config
configMap:
name: gitea-runner-config
- name: runner-secret
secret:
secretName: gitea-runner-secret