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
helm install my-label-studio ./lbl-01
Cài đặt với custom values
helm install my-label-studio ./lbl-01 -f my-values.yaml
Gỡ cài đặt Chart
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:
# 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)
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
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
global:
persistence:
enabled: true
type: volume
config:
volume:
storageClass: "standard"
size: 20Gi
accessModes:
- ReadWriteOnce
AWS S3 Storage
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
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
kubectl create namespace label-studio
2. Tạo secrets cho database
kubectl create secret generic postgresql-secret \
--from-literal=password=your-db-password \
-n label-studio
3. Tạo values file
# 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
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:
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 60
periodSeconds: 30
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 30
periodSeconds: 10
Autoscaling
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
Troubleshooting
Kiểm tra pods
kubectl get pods -n label-studio
kubectl logs -f deployment/label-studio -n label-studio
Kiểm tra services
kubectl get svc -n label-studio
kubectl describe svc label-studio -n label-studio
Kiểm tra ingress
kubectl get ingress -n label-studio
kubectl describe ingress label-studio -n label-studio
Tham khảo
Đó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.