291 lines
5.6 KiB
Markdown
291 lines
5.6 KiB
Markdown
|
|
# Label Studio Helm Chart
|
||
|
|
|
||
|
|
Helm chart để triển khai Label Studio - công cụ gán nhãn dữ liệu mã nguồn mở cho Machine Learning trên Kubernetes.
|
||
|
|
|
||
|
|
## Giới thiệu
|
||
|
|
|
||
|
|
Label Studio là một công cụ gán nhãn dữ liệu mã nguồn mở được thiết kế để giúp bạn chuẩn bị dữ liệu huấn luyện cho các mô hình machine learning. Helm chart này giúp bạn triển khai Label Studio một cách dễ dàng trên Kubernetes cluster.
|
||
|
|
|
||
|
|
## Yêu cầu
|
||
|
|
|
||
|
|
- Kubernetes 1.19+
|
||
|
|
- Helm 3.2.0+
|
||
|
|
- PV provisioner hỗ trợ trong underlying infrastructure (nếu sử dụng persistence)
|
||
|
|
|
||
|
|
## Cài đặt Chart
|
||
|
|
|
||
|
|
### Cài đặt cơ bản
|
||
|
|
|
||
|
|
```bash
|
||
|
|
helm install my-label-studio ./lbl-01
|
||
|
|
```
|
||
|
|
|
||
|
|
### Cài đặt với custom values
|
||
|
|
|
||
|
|
```bash
|
||
|
|
helm install my-label-studio ./lbl-01 -f my-values.yaml
|
||
|
|
```
|
||
|
|
|
||
|
|
## Gỡ cài đặt Chart
|
||
|
|
|
||
|
|
```bash
|
||
|
|
helm uninstall my-label-studio
|
||
|
|
```
|
||
|
|
|
||
|
|
## Cấu hình
|
||
|
|
|
||
|
|
### Cấu hình cơ bản
|
||
|
|
|
||
|
|
Dưới đây là một số cấu hình cơ bản trong `values.yaml`:
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
# Cấu hình image
|
||
|
|
global:
|
||
|
|
image:
|
||
|
|
repository: heartexlabs/label-studio
|
||
|
|
tag: "develop"
|
||
|
|
pullPolicy: IfNotPresent
|
||
|
|
|
||
|
|
# Cấu hình service
|
||
|
|
service:
|
||
|
|
type: ClusterIP
|
||
|
|
port: 8080
|
||
|
|
targetPort: 8080
|
||
|
|
|
||
|
|
# Cấu hình ingress
|
||
|
|
ingress:
|
||
|
|
enabled: true
|
||
|
|
className: "nginx"
|
||
|
|
annotations:
|
||
|
|
nginx.ingress.kubernetes.io/proxy-body-size: "200m"
|
||
|
|
hosts:
|
||
|
|
- host: label-studio.local
|
||
|
|
paths:
|
||
|
|
- path: /
|
||
|
|
pathType: ImplementationSpecific
|
||
|
|
```
|
||
|
|
|
||
|
|
### Cấu hình Database (PostgreSQL)
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
global:
|
||
|
|
pgConfig:
|
||
|
|
host: "postgresql.default.svc.cluster.local"
|
||
|
|
port: 5432
|
||
|
|
dbName: "labelstudio"
|
||
|
|
userName: "labelstudio"
|
||
|
|
password:
|
||
|
|
secretName: "postgresql-secret"
|
||
|
|
secretKey: "password"
|
||
|
|
```
|
||
|
|
|
||
|
|
### Cấu hình Redis
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
global:
|
||
|
|
redisConfig:
|
||
|
|
host: "redis://redis.default.svc.cluster.local:6379/1"
|
||
|
|
password:
|
||
|
|
secretName: "redis-secret"
|
||
|
|
secretKey: "password"
|
||
|
|
```
|
||
|
|
|
||
|
|
### Cấu hình Storage
|
||
|
|
|
||
|
|
#### Local Volume Storage
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
global:
|
||
|
|
persistence:
|
||
|
|
enabled: true
|
||
|
|
type: volume
|
||
|
|
config:
|
||
|
|
volume:
|
||
|
|
storageClass: "standard"
|
||
|
|
size: 20Gi
|
||
|
|
accessModes:
|
||
|
|
- ReadWriteOnce
|
||
|
|
```
|
||
|
|
|
||
|
|
#### AWS S3 Storage
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
global:
|
||
|
|
persistence:
|
||
|
|
enabled: true
|
||
|
|
type: s3
|
||
|
|
config:
|
||
|
|
s3:
|
||
|
|
accessKey: "your-access-key"
|
||
|
|
secretKey: "your-secret-key"
|
||
|
|
region: "us-west-2"
|
||
|
|
bucket: "label-studio-data"
|
||
|
|
folder: "media"
|
||
|
|
```
|
||
|
|
|
||
|
|
### Cấu hình Environment Variables
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
env:
|
||
|
|
LABEL_STUDIO_HOST: "https://label-studio.yourdomain.com"
|
||
|
|
LABEL_STUDIO_USERNAME: "admin@example.com"
|
||
|
|
LABEL_STUDIO_PASSWORD: "your-secure-password"
|
||
|
|
ENABLE_LOCAL_FILES_ACCESS: "true"
|
||
|
|
LOCAL_FILES_SERVING_ENABLED: "true"
|
||
|
|
SSRF_PROTECTION_ENABLED: "true"
|
||
|
|
|
||
|
|
global:
|
||
|
|
extraEnvironmentVars:
|
||
|
|
PYTHONUNBUFFERED: "1"
|
||
|
|
DEBUG: "false"
|
||
|
|
```
|
||
|
|
|
||
|
|
## Ví dụ triển khai hoàn chỉnh
|
||
|
|
|
||
|
|
### 1. Tạo namespace
|
||
|
|
|
||
|
|
```bash
|
||
|
|
kubectl create namespace label-studio
|
||
|
|
```
|
||
|
|
|
||
|
|
### 2. Tạo secrets cho database
|
||
|
|
|
||
|
|
```bash
|
||
|
|
kubectl create secret generic postgresql-secret \
|
||
|
|
--from-literal=password=your-db-password \
|
||
|
|
-n label-studio
|
||
|
|
```
|
||
|
|
|
||
|
|
### 3. Tạo values file
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
# my-values.yaml
|
||
|
|
global:
|
||
|
|
image:
|
||
|
|
tag: "latest"
|
||
|
|
|
||
|
|
pgConfig:
|
||
|
|
host: "postgresql.label-studio.svc.cluster.local"
|
||
|
|
port: 5432
|
||
|
|
dbName: "labelstudio"
|
||
|
|
userName: "labelstudio"
|
||
|
|
password:
|
||
|
|
secretName: "postgresql-secret"
|
||
|
|
secretKey: "password"
|
||
|
|
|
||
|
|
persistence:
|
||
|
|
enabled: true
|
||
|
|
type: volume
|
||
|
|
config:
|
||
|
|
volume:
|
||
|
|
storageClass: "gp2"
|
||
|
|
size: 50Gi
|
||
|
|
|
||
|
|
ingress:
|
||
|
|
enabled: true
|
||
|
|
className: "nginx"
|
||
|
|
annotations:
|
||
|
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||
|
|
nginx.ingress.kubernetes.io/proxy-body-size: "200m"
|
||
|
|
hosts:
|
||
|
|
- host: label-studio.yourdomain.com
|
||
|
|
paths:
|
||
|
|
- path: /
|
||
|
|
pathType: ImplementationSpecific
|
||
|
|
tls:
|
||
|
|
- secretName: label-studio-tls
|
||
|
|
hosts:
|
||
|
|
- label-studio.yourdomain.com
|
||
|
|
|
||
|
|
resources:
|
||
|
|
limits:
|
||
|
|
cpu: 2000m
|
||
|
|
memory: 4Gi
|
||
|
|
requests:
|
||
|
|
cpu: 1000m
|
||
|
|
memory: 2Gi
|
||
|
|
|
||
|
|
env:
|
||
|
|
LABEL_STUDIO_HOST: "https://label-studio.yourdomain.com"
|
||
|
|
LABEL_STUDIO_USERNAME: "admin@yourdomain.com"
|
||
|
|
LABEL_STUDIO_PASSWORD: "your-secure-password"
|
||
|
|
```
|
||
|
|
|
||
|
|
### 4. Cài đặt chart
|
||
|
|
|
||
|
|
```bash
|
||
|
|
helm install label-studio ./lbl-01 \
|
||
|
|
-f my-values.yaml \
|
||
|
|
-n label-studio
|
||
|
|
```
|
||
|
|
|
||
|
|
## Monitoring và Logging
|
||
|
|
|
||
|
|
### Health Checks
|
||
|
|
|
||
|
|
Chart đã được cấu hình với health checks:
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
livenessProbe:
|
||
|
|
httpGet:
|
||
|
|
path: /health
|
||
|
|
port: http
|
||
|
|
initialDelaySeconds: 60
|
||
|
|
periodSeconds: 30
|
||
|
|
|
||
|
|
readinessProbe:
|
||
|
|
httpGet:
|
||
|
|
path: /health
|
||
|
|
port: http
|
||
|
|
initialDelaySeconds: 30
|
||
|
|
periodSeconds: 10
|
||
|
|
```
|
||
|
|
|
||
|
|
### Autoscaling
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
autoscaling:
|
||
|
|
enabled: true
|
||
|
|
minReplicas: 2
|
||
|
|
maxReplicas: 10
|
||
|
|
targetCPUUtilizationPercentage: 80
|
||
|
|
targetMemoryUtilizationPercentage: 80
|
||
|
|
```
|
||
|
|
|
||
|
|
## Troubleshooting
|
||
|
|
|
||
|
|
### Kiểm tra pods
|
||
|
|
|
||
|
|
```bash
|
||
|
|
kubectl get pods -n label-studio
|
||
|
|
kubectl logs -f deployment/label-studio -n label-studio
|
||
|
|
```
|
||
|
|
|
||
|
|
### Kiểm tra services
|
||
|
|
|
||
|
|
```bash
|
||
|
|
kubectl get svc -n label-studio
|
||
|
|
kubectl describe svc label-studio -n label-studio
|
||
|
|
```
|
||
|
|
|
||
|
|
### Kiểm tra ingress
|
||
|
|
|
||
|
|
```bash
|
||
|
|
kubectl get ingress -n label-studio
|
||
|
|
kubectl describe ingress label-studio -n label-studio
|
||
|
|
```
|
||
|
|
|
||
|
|
## Tham khảo
|
||
|
|
|
||
|
|
- [Label Studio Documentation](https://labelstud.io/guide/)
|
||
|
|
- [Label Studio Helm Values](https://labelstud.io/guide/helm_values)
|
||
|
|
- [Kubernetes Documentation](https://kubernetes.io/docs/)
|
||
|
|
- [Helm Documentation](https://helm.sh/docs/)
|
||
|
|
|
||
|
|
## Đóng góp
|
||
|
|
|
||
|
|
Nếu bạn muốn đóng góp cho chart này, vui lòng tạo pull request hoặc issue trên repository.
|
||
|
|
|
||
|
|
## License
|
||
|
|
|
||
|
|
Chart này được phân phối dưới giấy phép MIT. Xem file LICENSE để biết thêm chi tiết.
|