본문 바로가기
Big Data

[KUBEFLOW] 2. Getting started

by 유주원 2022. 2. 14.

https://www.manning.com/books/kubeflow-in-action

 

Kubeflow in Action

Kubeflow simplifies and automates machine learning tasks like interactive analysis, complex pipelines, and model training. Seamlessly push models to production in the containerized and distributed environment and scale your ML infrastructure from your lapt

www.manning.com

 

이 장에서는 kubeflow 설치 방법과 Jupyter Notebooks, Minio, Seldon과 같은 kubeflow 구성 요소에 대해 간략하게 학습해 보도록 한다.

 

2.1 Kubeflow installation introduction and its components

2.1.1 Kfctl and Kustomize

kubernetes에 리소스 또는 애플리케이션을 설치하기 위해서는 리소스나 구성요소를 설명하고 있는 yaml이나 json 파일이 필요하다. 

kustomize는 이러한 yaml 구성 파일들에 대한 customizing을 가능하게 해주는 도구이며, kfctl은 kustomize 파일을 읽고 최종 yaml 파일을 빌드하고, kubernetes 또는 OKD에 적용하는 도구이다.

만약에 kubeflow용 새로운 애플리케이션을 추가하고자 한다면, kustomize에 대한 이해가 충분해야 할 것이다.

 

2.1.2 KfDef and Manifest

그렇다면 설치해야 할 애플리케이션이나 구성요소를 kubeflow에 어떻게 알릴 수가 있을까? kfctl은 아래 그림과 같이 yaml에 설명된 kfDef라는 리소스 정의를 읽는다.

kfDef 리소스에서는 kubeflow와 함께 설치하려는 애플리케이션을 지정한다. 

kfctl에서 kfDef를 읽고 무엇을 설치해야 하는지를 이해했다면, 해당 응용 프로그램을 설치하기 위한 kustomize 및 yaml 파일은 어디서 찾아야 할까? 해답은 kfDef 파일의 uri 필드에서 찾을 수 있다. uri는 git tarball을 가리키고 있으며, kfctl은 tarball을 다운로드 하고 .cache 폴더에 압축을 풀고, 해당 yaml 파일을 빌드하고 실행한다.

 

2.1.3 Choosing your Kubeflow Installation

Launching Kubeflow Dashboard

Kubeflow 대시보드는 istio-ingressgateway 서비스를 통해 액세스 할 수 있다.

 

kubectl port-forward -n istio-system svc/istio-ingressgateway 8080:80

 

위 명령을 입력 한 후 http://localhost:8080으로 접속하면 아래와 같은 화면을 볼 수가 있다.

 

Start Setup 버튼을 클릭하면 아래와 같이 Namespace 명을 입력하는 화면이 나타난다. 해당 Namespace는 notebooks pods 등과 같은 kubeflow의 여러 컴포넌트들이 실행될 때 사용 될 Namespace가 된다.

Finish를 클기하면 아래 그림과 같이 기본 Kubeflow 페이지로 이동한다.

 

아래 명령을 통해 생성된 새로운 namespace를 확인해 볼 수가 있다.
 
kubectl get namespace <the name you entered>

 

Launching Jupyter Notebooks

왼쪽의 Notebook Servers 메뉴를 클릭 후 아래의 화면이 나타나면 +NEW SERVER를 클릭한다.

 

Name 부분에 Jupyter server 이름을 명시해 준 후 Launch를 클릭하면 Jupyter 서버가 구동이 된다.

kubectl get pods -n <namespace> 를 통해 pod 목록을 가져오면, 내가 설정한 이름의 jupyter server 이름의 pod가 구동되어 있는 것을 확인해 볼 수가 있다.

2.2. Our First Example - Supervised Learning on a Synthetic Dataset

 

 

 

 

 

 

 

 

 

 

 

Launching Jupyter Notebooks