jupyterhub + nexus pypi repository

2024. 4. 26. 17:27·CloudNative/Provisioning

k8s cluster에 jupyterhub를 구성하고, 

nexus에 구성한 repository를 통해서 라이브러리를 받도록 해보자.

 

nexus pypi repository

사전에 구성한 nexus에 로그인 하여 톱니바퀴를 눌러 관리자 페이지로 이동한다.

Repository > Blob Stores에서 pypi-group, pypi-hosted, pypi-proxy 저장소를 모두 File type으로 생성한다.

그리고 Repositories 로 이동하여 3개의 리포지토리를 헷갈리지 않도록 동일 이름으로 생성하는데 먼저 생성한 동일 이름의 blob store를 매핑해주자.

pypi-proxy 구성시에는 remote storage를 https://pypi.org 로 등록하고 pypi-group을 맨마지막에 생성할때 pypi-proxy와 pypi-hosted를 member로 지정한다.

 

 

 

jupyterhub

artifacthub에서 jupyterhub를 검색해 최신버전의 압축파일을 받은뒤 압축해제하고 values.yaml을 수정하자.

wget https://jupyterhub.github.io/helm-chart/jupyterhub-4.0.0-0.dev.git.6586.h0a16e5a0.tgz

tar -xvf jupyterhub-4.0.0-0.dev.git.6586.h0a16e5a0.tgz

cd jupyterhub

vi values.yaml

 

# 변경한 내용만 기재

hub:
  service:
    type: ClusterIP
  baseUrl: /jupyter  # context-path설정
  db:
    pvc:
      storageClassName: "nfs-client" #사용할 sc 지정
 
 singleuser:
   storage:
     extravolumes:
     - name: pip-conf-volume
       secret:
         secretName: pip-conf-secret
     extraVolumeMounts:
     - name: pip-conf-volume
       mountPath: /home/jovyan/.config/pip/pip.conf
       subPath: pip.conf
     dynamic:
       storageClass: nfs-client

 

 

pip.conf file에 내용이 다음과 같을때 

 (pypi-group 주소를 적고 마지막에 /simple을 추가하는 부분에 유의)

[global]
index-url = https://<ID>:<password>@domain.com/nexus/repository/pypi-group/simple
trusted-host = domain.com

 

secret yaml을 templates 아래에 생성하여 helm install 시 함께 생성되도록 하자

kubectl create secret generic pip-conf-secret -n jupyter --from-file pip.conf --dry-run=client -o yaml > templates/secret.yaml

 

여기까지 준비가 되었다면 이제 설치한다.

helm upgrade --install jupyterhub -n jupyter -f values.yaml .

 

설치가 완료되면 istio virtualservice에 /jupyter에 대한 route 설정을 해준다. 

spec:
  http:
  - match:
    - uri:
        prefix: /jupyter
    route:
    - destination:
        host: proxy-public.jupyter.svc.cluster.local
        port:
          number: 80

 

이제 브라우저로 접근하여 보자. ex) https://domain.com/jupyter 

여기에 입력하는 username으로 pod 가 jupyter-username 과 같이 각각 생성되는 구조로 username별 jupyterlab이 생성된다

메인화면에서 terminal을 클릭하여 pip install scipy를 실행해본다. nexus에서 잘 가져와 진다.

 

728x90

'CloudNative > Provisioning' 카테고리의 다른 글

trivy  (1) 2024.12.20
vault  (1) 2024.11.23
nexus cli file upload  (0) 2024.10.25
nexus gradle repository  (1) 2024.10.18
nexus docker repository  (0) 2024.04.11
'CloudNative/Provisioning' 카테고리의 다른 글
  • vault
  • nexus cli file upload
  • nexus gradle repository
  • nexus docker repository
yunapapa
yunapapa
working on the cloud
    250x250
  • yunapapa
    supermoon
    yunapapa
  • 전체
    오늘
    어제
    • 분류 전체보기 (94)
      • 개발 (20)
        • java (17)
        • web (2)
        • MSX (1)
        • Go (0)
      • CloudNative (50)
        • App Definition & Developeme.. (17)
        • Orchestration & Management (4)
        • Runtime (3)
        • Provisioning (7)
        • Observability & Analysis (14)
        • event review (5)
      • AWS (7)
      • 환경관련 (17)
      • 취미생활 (0)
        • 맛집 (0)
        • 게임 (0)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • CNCF Past Events
    • Kubernetes Korea Group
  • 공지사항

  • 인기 글

  • 태그

    오블완
    AWS
    kubernetes
    k8s
    devops
    dop-c02
    helm
    Java
    APM
    티스토리챌린지
    Pinpoint
    gitlab
    OpenShift
    istio
    springboot
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
yunapapa
jupyterhub + nexus pypi repository
상단으로

티스토리툴바