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에서 잘 가져와 진다.

'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 |