Compare commits

...

2 Commits

Author SHA1 Message Date
Cloud User 55849432ca Add detailed VM runner setup guide with Gitea integration steps
CI - Lint & Test / lint-and-test (push) Successful in 41s Details
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:18:22 +09:00
Cloud User 5e54e2f24b Revert "Revert "Replace K8s pod runner with VM runner (soo-runner)""
This reverts commit 749173a9d5.
2026-03-11 13:17:49 +09:00
3 changed files with 96 additions and 143 deletions

109
README.md
View File

@ -23,7 +23,7 @@ https://gitea.inje-private.com/selee/mlops-architecture
| 컴포넌트 | 상태 | 위치 |
|----------|------|------|
| Gitea | installed | 외부 클러스터 |
| Gitea Runner | **installed** (v0.3.0) | 이 클러스터 (`soo` ns) |
| Gitea Runner | **installed** (v0.3.0) | VM (`soo-runner`) |
| ArgoCD | installed + **repo 연동 완료** | 이 클러스터 (`argocd` ns) |
| DVC | **installed** (v3.66.1) | 로컬 + NAS (`/ainas/dvc-storage`) |
@ -78,30 +78,101 @@ git push -u origin main
---
## 2. Gitea Runner (설치 완료)
## 2. Gitea Runner (설치 완료 — VM 방식)
이 클러스터 `soo` 네임스페이스에 배포. Docker-in-Docker(DinD) sidecar 방식.
전용 VM(`soo-runner`)에 act_runner를 직접 설치하여 systemd 서비스로 운영.
기존 K8s 파드(DinD sidecar) 방식에서 VM 직접 설치로 전환.
- 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`
| 항목 | 값 |
|------|-----|
| 호스트 | `ssh ubuntu@runner` (호스트명: `soo-runner`) |
| OS | Ubuntu 22.04.5 LTS |
| IP | `10.0.0.67` |
| Runner 이름 | `soo-runner` |
| act_runner | v0.3.0 (`/usr/local/bin/act_runner`) |
| Docker | v29.3.0 |
| 작업 디렉토리 | `/opt/act_runner/` |
| 서비스 | `/etc/systemd/system/act_runner.service` |
| Labels | `ubuntu-latest`, `ubuntu-22.04` (Docker), `self-hosted` (Host) |
### 2-1. VM 설치 과정
```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}'
# 1. Docker 설치
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker ubuntu
# 2. Runner 배포
kubectl apply -f gitea-runner/deployment.yaml
# 2. act_runner 바이너리 설치
curl -sL https://gitea.com/gitea/act_runner/releases/download/v0.3.0/act_runner-0.3.0-linux-amd64 -o act_runner
chmod +x act_runner
sudo mv act_runner /usr/local/bin/
# 3. 상태 확인
kubectl get pods -n soo -l app=gitea-runner
kubectl logs -n soo -l app=gitea-runner -c runner --tail=20
# 3. 작업 디렉토리 생성
sudo mkdir -p /opt/act_runner
sudo chown ubuntu:ubuntu /opt/act_runner
```
# 4. Gitea에서 Runner 등록 확인
### 2-2. Gitea 연동 (Runner 등록)
```bash
# 1. Gitea에서 Runner 등록 토큰 발급
# Gitea > 저장소 Settings > Actions > Runners > "Create new Runner" 에서 토큰 복사
# 또는 사이트 전역: Site Administration > Actions > Runners
# 2. Runner 등록
cd /opt/act_runner
act_runner register --no-interactive \
--instance https://gitea.inje-private.com \
--token <REGISTRATION_TOKEN> \
--name soo-runner \
--labels "ubuntu-latest:docker://catthehacker/ubuntu:act-22.04,ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04,self-hosted:host"
# → /opt/act_runner/.runner 파일 생성됨
```
### 2-3. systemd 서비스 등록
```bash
# 서비스 파일 생성
sudo tee /etc/systemd/system/act_runner.service > /dev/null <<'EOF'
[Unit]
Description=Gitea Act Runner
After=docker.service
Requires=docker.service
[Service]
User=ubuntu
WorkingDirectory=/opt/act_runner
ExecStart=/usr/local/bin/act_runner daemon
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
# 서비스 시작 및 자동 시작 등록
sudo systemctl daemon-reload
sudo systemctl enable --now act_runner
```
### 2-4. 운영 명령어
```bash
# 상태 확인
ssh ubuntu@runner "sudo systemctl status act_runner"
# 로그 확인
ssh ubuntu@runner "journalctl -u act_runner -f"
# 재시작
ssh ubuntu@runner "sudo systemctl restart act_runner"
# Gitea에서 Runner 등록 확인
# https://gitea.inje-private.com/selee/mlops-architecture/settings/actions/runners
```
@ -210,8 +281,6 @@ mlops_architecture/
├── argocd/
│ └── application.yaml # ArgoCD Application 정의
├── config.yaml # 인프라 구성 정보
├── gitea-runner/
│ └── deployment.yaml # Gitea Runner K8s 배포
├── manifests/ # K8s 배포 manifest (ArgoCD 감시)
│ └── deployment.yaml # 서빙 Deployment + Service
└── README.md # 설치 가이드 (이 파일)

View File

@ -34,14 +34,14 @@ components:
installed: true # 외부에서 운영 중
gitea_runner:
location: this_cluster
namespace: soo
location: vm # 전용 VM에 직접 설치
host: soo-runner # ssh ubuntu@runner
version: v0.3.0 # act_runner version
image: gitea/act_runner:latest
deploy_type: kubernetes # Deployment + DinD sidecar
runner_name: mlops-runner
node_selector:
nodegroup: nd
deploy_type: systemd # systemd service on VM
runner_name: soo-runner
binary: /usr/local/bin/act_runner
workdir: /opt/act_runner
service_file: /etc/systemd/system/act_runner.service
labels:
- ubuntu-latest
- ubuntu-22.04

View File

@ -1,116 +0,0 @@
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://catthehacker/ubuntu:act-22.04"
- "ubuntu-22.04:docker://catthehacker/ubuntu:act-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:
nodeSelector:
nodegroup: nd
containers:
- name: runner
image: gitea/act_runner:latest
command:
- sh
- -c
- |
# Wait for DinD TLS certs to be ready
echo "Waiting for Docker daemon..."
while [ ! -f /certs/client/ca.pem ]; do sleep 1; done
sleep 2
echo "Docker daemon is ready"
# 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://catthehacker/ubuntu:act-22.04,ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04,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
args:
- --mtu=1340
- --default-network-opt=bridge=com.docker.network.driver.mtu=1340
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