Kubeflow v1.6.0 에서 진행
Jupyter notebook 생성 시 [Add Existing Volume] 옵션을 통해 기존에 존재하던 Persistant Volume을 binding 시켰었다.
하지만, pipeline component를 작성 후 pipeline을 run할 시에는 해당 PV를 사용할 수가 없다.
그 이유는 component는 독립적인 container로 관리하기 때문이다.
자세한 내용은 다음 초반 글의 그림을 참고
[MLOps] Kubeflow pipeline handling (1) : pipeline 개념 및 기본 진행 방법
Kubeflow Pipeline Kubeflow pipeline이란, ML workflow를 생성할 수 있는 kubeflow compoenent를 말한다. Pipeline은 아래 그림처럼 workflow의 각각의 component들과 dependency를 포함하여 DAG 형식을 나타내고 있다. 즉, 파이
lg960214.tistory.com
그렇다면, 어떻게 SDK를 활용해서 PV를 mount할 수 있을까?
여러 방법이 있겠지만, 나는 operator 생성 후 pod setting을 operator에 추가할 때 mount를 해주는 방법을 선택했다.
간단한 예제 코드를 추가한다.
# pod setting
def pod_defaults(op):
volume_name = "target PV의 name"
volume_mount_path = "mount시킬 path"
op.set_memory_request('10Mi').set_cpu_request('10m') # Componenet resource 사용량 정의
# Persistent Volume을 나타내는 객체를 생성
volume = k8s.V1Volume(
name=volume_name,
persistent_volume_claim=k8s.V1PersistentVolumeClaimVolumeSource(claim_name=volume_name),
)
# 볼륨이 마운트될 경로와 이름을 설정하는 VolumeMount 객체를 생성
volume_mount = k8s.V1VolumeMount(
mount_path=volume_mount_path,
name=volume_name,
)
# Pod에 생성한 볼륨을 추가
op.add_pvolumes({volume_mount_path: volume})
return op
'IT_Study > Ops' 카테고리의 다른 글
[DevOps] DevOps의 기본적 이해와 철학 (0) | 2023.12.24 |
---|---|
[MLOps] Kubeflow 활용을 위한 Kubernetes에 대한 이해 (0) | 2023.11.21 |
[MLOps] Kubeflow pipeline handling (2) : SDK를 이용한 pipeline 접속 방법 (0) | 2023.11.13 |
[MLOps] Kubeflow pipeline 오류 - kf-resource-quota : must specify cpu/memory (0) | 2023.11.13 |
[MLOps] Kubeflow pipeline handling (1) : pipeline 개념 및 기본 진행 방법 (0) | 2023.11.09 |