콘텐츠로 이동

Jupyter 분석 환경: Server, Hub, Proxy의 역할

Interactive Diagram

새 탭 ↗

이 문서는 Jupyter Notebook을 사용자마다 독립 실행하던 환경에서, Jupyter Server로 실행 API를 분리하고 JupyterHub로 multi-user 환경을 관리하며 Jupyter Server Proxy로 browser-based 개발 도구를 함께 제공하려 했던 2021년 운영 기록의 진입점이다.

현재 플랫폼의 JupyterHub 배포 구조, 인증, storage, user server spawning은 JupyterHub 플랫폼 정리를 우선 참고한다. 이 문서와 하위 글은 최신 운영 표준이 아니라, shared compute와 interactive development 환경을 설계할 때 어떤 문제를 해결하려 했는지 이해하는 historical reference다.

  • Notebook instance가 GPU나 compute resource를 사용자별로 오래 점유할 때, shared environment를 어떻게 구성할 수 있는가
  • Jupyter Server, JupyterHub, single-user notebook server는 각각 어떤 책임을 가지는가
  • VS Code, code-server, RStudio처럼 Jupyter 외 web application을 사용자 session 아래에 어떻게 노출할 수 있는가
  • JupyterHub의 profile, image, resource, persistent volume, idle culling은 어떤 운영 문제를 해결하는가
  • 오래된 Jupyter deployment 예시를 현재 환경에 적용하기 전에 무엇을 다시 검증해야 하는가

Kubernetes 위에 interactive Python 개발 환경을 제공하려는 platform engineer, data engineer, ML engineer를 대상으로 한다. Container image, Kubernetes Pod·Service·PersistentVolumeClaim, Jupyter Notebook 또는 JupyterLab의 기본 사용 경험이 있으면 각 하위 기록을 이해하기 쉽다.

  • Jupyter Server는 Notebook·Lab 등 Jupyter web application이 사용하는 backend API와 kernel execution endpoint를 제공한다. remote server에 VS Code 같은 client를 연결하는 방식의 배경을 설명한다.
  • JupyterHub는 사용자 login, proxy, spawn, profile 선택을 관리한다. multi-user 환경에서 사용자별 server와 resource를 어떤 단위로 분리하는지 다룬다.
  • Jupyter Server Proxy는 사용자의 Jupyter session과 함께 실행되는 code-server, RStudio 같은 web application을 Hub의 인증·URL 구조 아래에서 접근하게 하는 extension이다.

세 구성 요소는 같은 제품의 대체재가 아니다. Server는 실행 backend, Hub는 multi-user control plane, Proxy는 user server 안의 추가 web tool을 노출하는 연결 계층이다.

remote notebook execution 구조부터 이해하는 경우

섹션 제목: “remote notebook execution 구조부터 이해하는 경우”

Jupyter Server를 먼저 읽는다. Jupyter Server가 제공하는 API, container image와 config, Kubernetes Deployment 및 remote client 연결 방식을 확인한다. standalone Server가 어떤 경우에 적합하고, multi-user lifecycle을 직접 해결하지 않는 이유를 함께 본다.

여러 사용자와 shared compute를 운영하는 경우

섹션 제목: “여러 사용자와 shared compute를 운영하는 경우”

JupyterHub를 읽는다. Hub, proxy, spawner, authentication class의 역할과 profile별 image·resource·volume 선택, idle culling, custom image 실행 조건을 확인한다. 최신 JupyterHub 구성은 반드시 JupyterHub 플랫폼 정리과 현재 공식 chart 문서를 함께 확인한다.

Jupyter session 안에서 개발 도구를 추가로 제공하는 경우

섹션 제목: “Jupyter session 안에서 개발 도구를 추가로 제공하는 경우”

Jupyter Server Proxy를 읽는다. user server의 port에서 실행되는 code-server나 RStudio 같은 web application을 proxy URL로 연결하고, JupyterHub login과 redirection을 재사용하는 방식을 확인한다.

  • 제품과 version: JupyterHub chart, Jupyter Server configuration, extension API는 2021년 예시와 달라졌을 수 있다.
  • authentication: token을 비우거나 XSRF protection을 끄는 설정을 일반적인 production 기본값으로 사용하지 않는다. 조직의 OIDC, session, authorization model을 먼저 정한다.
  • image와 privilege: root 실행, latest image tag, 오래된 Python runtime을 그대로 재사용하지 않는다. image provenance, patch cadence, non-root security context를 확인한다.
  • resource lifecycle: GPU/CPU/memory request와 limit, idle culling 기준, spawn timeout, user storage retention을 사용자 experience와 비용 기준으로 함께 정한다.
  • tool exposure: Jupyter Server Proxy로 추가 web tool을 노출할 때, URL isolation, user identity, network policy, extension update compatibility를 확인한다.

현재 Kubeflow tenant notebook과 standalone JupyterHub의 역할 차이는 Kubeflow Notebooks와 JupyterHub 플랫폼 정리에서 비교할 수 있다. ML platform 전체 흐름은 AI / ML 허브에서 이어서 본다.