Updated:

2 minute read

개요

  • 사이트
  • Kubernetes용 머신 러닝 툴킷
  • Kubernetes에서 기계 학습(ML) 워크플로를 간단하고 이식 가능하며 확장 가능하게 배포
  • 목표는 ML용 최고의 오픈 소스 시스템을 다양한 인프라에 배포할 수 있는 간단한 방법을 제공하는 것
  • ML 파이프라인을 구축하고 실험하려는 데이터 과학자를 위한 플랫폼
  • 개발, 테스트, 프로덕션 수준 서비스를 위해 다양한 환경에 ML 시스템을 배포하려는 ML 엔지니어 및 운영팀에게도 적합


아키텍처

  • 워크플로우


구성요소

  • 대시보드
  • 노트북
    • Kubeflow Notebooks
      • Pod 내에서 웹 기반 개발 환경을 실행하여 Kubernetes 클러스터 내에서 웹 기반 개발 환경을 실행하는 방법을 제공
  • 파이프라인
    • Kubeflow Pipelines(KFP)
      • Kubernetes를 사용하여 이식 가능하고 확장 가능한 기계 학습 워크플로를 구축한 후 배포하기 위한 플랫폼
  • AutoML
    • Katib
      • 자동화된 기계 학습(AutoML)을 위한 Kubernetes 기반 프로젝트
      • 초매개변수 조정, 조기 중지 및 신경 아키텍처 검색을 지원
      • 하이퍼파라미터 조정, 조기 중지 및 신경 아키텍처 검색(NAS)을 지원
  • 모델 훈련
    • Kubeflow Training Operator
      • 다양한 ML 프레임워크를 사용하여 생성된 기계 학습(ML) 모델의 미세 조정 및 확장 가능한 분산 교육을 위한 Kubernetes 기반 프로젝트
  • 모델 서빙
    • KServe
      • 신뢰할 수 있는 AI를 위한 Kubernetes의 확장성이 뛰어난 표준 기반 모델 추론 플랫폼
      • 프로덕션 모델 제공 사용 사례를 해결하는 것을 목표
        • 표준화된 데이터 플레인 프로토콜을 사용
        • Tensorflow, XGBoost, ScikitLearn, PyTorch, Huggingface Transformer/LLM 모델에 대한 높은 추상화 인터페이스를 제공


설치

  1. longhorn
    • helm repo add longhorn https://charts.longhorn.io
      helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --values ~/install/longhorn/values.yaml
      
  2. kustomize
    • curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"  | bash
      mv kustomize /usr/local/bin/.
      
  3. kubeflow
    • git clone https://github.com/kubeflow/manifests.git
      cd manifests/
      git checkout v1.9.1
      while ! kustomize build example | kubectl apply -f -; do echo "Retrying to apply resources"; sleep 10; done
      


문제 해결

  • 노드 포트 설정
    • kubectl patch service -n istio-system istio-ingressgateway --type='json' --patch='[{"op": "replace", "path": "/spec/type", "value":"NodePort"}]'
      kubectl patch service -n istio-system istio-ingressgateway --type='json' --patch='[{"op": "replace", "path": "/spec/ports/1/nodePort", "value":30010}]'
      kubectl patch service -n istio-system istio-ingressgateway --type='json' --patch='[{"op": "replace", "path": "/spec/ports/2/nodePort", "value":30011}]'
      
  • 노트북 생성 실패
    • 문제
      • [403] Could not find CSRF cookie XSRF-TOKEN in the request.
    • 해결
      • kubeflow-ingressgateway-certs Certificate 생성
        • kubectl apply -n istio-system -f https://raw.githubusercontent.com/heaven-chp/kubeflow/main/manifests/fix-notebook-creation-failed/certificate.yaml
      • kubeflow-gateway Gateway에 https 추가 후 https로 접속
        • kubectl patch gateways -n kubeflow kubeflow-gateway --type='json' --patch='[{"op": "add", "path": "/spec/servers/-", "value":{"hosts":["*"],"port":{"name":"https","number":443,"protocol":"HTTPS"},"tls":{"mode":"SIMPLE","credentialName":"kubeflow-ingressgateway-certs"}}}]'
  • 파이프라인 생성 실패
    • 문제
      • kfp.Client() 호출 시 인증 관련 에러
    • 해결
      • access-ml-pipeline PodDefault 생성
        • kubectl apply -n kubeflow-user-example-com -f https://raw.githubusercontent.com/heaven-chp/kubeflow/main/manifests/fix-pipeline-creation-failed/pod-default.yaml
      • ml-pipeline AuthorizationPolicy 수정
        • kubectl patch authorizationpolicies -n kubeflow ml-pipeline --type='json' --patch='[{"op": "add", "path": "/spec/rules/0/from/0/source/principals/-", "value":"cluster.local/ns/kubeflow-user-example-com/sa/default-editor"}]'
        • kubectl patch authorizationpolicies -n kubeflow ml-pipeline --type='json' --patch='[{"op": "add", "path": "/spec/rules/0/from/0/source/principals/-", "value":"cluster.local/ns/kubeflow-user-example-com/sa/default-admin"}]'
      • 노트북 생성 시 Advanced Options > Configurations에서 Allow access to Kubeflow Pipelines 선택


설치 확인

  • kubeflow
    • https://{ip}:30011
      • Email Address
        • user@example.com
      • Password
        • 12341234


삭제

  • cd ~/kubeflow/manifests/ && kustomize build example | kubectl delete -f -
  • inferenceservices.serving.kserve.io CustomResourceDefinition 삭제가 안되는 경우
    • kubectl patch customresourcedefinitions.apiextensions.k8s.io/inferenceservices.serving.kserve.io -p '{"metadata":{"finalizers":[]}}' --type=merge
  • profiles.kubeflow.org CustomResourceDefinition 삭제가 안되는 경우
    • kubectl patch customresourcedefinitions.apiextensions.k8s.io/profiles.kubeflow.org -p '{"metadata":{"finalizers":[]}}' --type=merge