본문 바로가기
Kubeflow/Management

Kubeflow Jupyter Custom Image 추가

by 여행을 떠나자! 2021. 9. 24.

2021.06.29 

 

1. 개요

- kubeflow Notebook Server 생성을 위하여 Custom Image를 추가

- References

  https://www.kangwoo.kr/tag/jupyter/

  https://github.com/kubeflow/kubeflow/tree/v1.2.0/components/tensorflow-notebook-image

  https://towardsdatascience.com/make-kubeflow-into-your-own-data-science-workspace-cc8162969e29

- Custom Image spec

   ✓ Base image: tensorflow/tensorflow:2.5.0-gpu-jupyter (cuda 11.2, cuDNN 8.1.0), tensorflow/tensorflow:2.5.0-jupyter

   ✓ Install package: tensorflow-datasets 4.3.0

   ✓ Upgrade package:  tensorflow-estimator 2.5.0, kubeflow-fairing 1.0.2

- Default Image

   ✓ TensorFlow-2.1.0-notebook-gpu:1.0.0

       Tensorflow 2.1.0 (cuda 10.1, cuDNN 7.6.4), python 3.6.9

 

 

2. Environments

- kubeflow 1.2 / kubernetes 1.16.15

 

 

3. Custom Image 추가

a. Custom image build 및 push

yoosungjeon@ysjeon-Dev kf_deployments % git clone -b v1.2.0 https://github.com/kubeflow/kubeflow.git
Cloning into 'kubeflow'...
..
yoosungjeon@ysjeon-Dev kf_deployments % mv kubeflow/components/tensorflow-notebook-image .
yoosungjeon@ysjeon-Dev kf_deployments % rm -rf kubeflow
yoosungjeon@ysjeon-Dev kf_deployments % cd tensorflow-notebook-image
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % vi Dockerfile
...
COPY --chown=jovyan:users requirements.txt /tmp
RUN pip3 --no-cache-dir install -r /tmp/requirements.txt    # this line append
...
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % vi requirements.txt
...
# Custom packages for AI Core Platfrom
tensorflow-datasets==4.3.0
tensorflow-estimator==2.5.0
kubeflow-fairing==1.0.2
msrestazure==0.6.4
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % mkdir -p versions/2.5.0gpu
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % vi versions/2.5.0gpu/version-config.json
{
  "BASE_IMAGE": "tensorflow/tensorflow:2.5.0-gpu-jupyter"
}
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % mkdir -p versions/2.5.0
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % vi versions/2.5.0/version-config.json
{
  "BASE_IMAGE": "tensorflow/tensorflow:2.5.0-jupyter"
}
yoosungjeon@ysjeon-Dev tensorflow-notebook-image %
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % ./build_image.sh Dockerfile repo.acp.kt.co.kr/kubeflow/kubeflow-images-private/tensorflow-2.5.0-notebook-cpu 1.0.0  versions/2.5.0/version-config.json
…
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % docker push repo.acp.kt.co.kr/kubeflow/kubeflow-images-private/tensorflow-2.5.0-notebook-cpu:1.0.0
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % ./build_image.sh Dockerfile repo.acp.kt.co.kr/kubeflow/kubeflow-images-private/tensorflow-2.5.0-notebook-gpu 1.0.0  versions/2.5.0gpu/version-config.json
…
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % docker push repo.acp.kt.co.kr/kubeflow/kubeflow-images-private/tensorflow-2.5.0-notebook-gpu:1.0.0
yoosungjeon@ysjeon-Dev tensorflow-notebook-image %
yoosungjeon@ysjeon-Dev tensorflow-notebook-image % docker run -it repo.acp.kt.co.kr/kubeflow/kubeflow-images-private/tensorflow-2.5.0-notebook-gpu:1.0.0  bash
tf-docker /tf > python -V
Python 3.6.9
tf-docker /tf > pip list | egrep 'tensor|kube|notebook|jupyterlab|kfserving’
jupyterlab                     3.0.16
jupyterlab-pygments            0.1.2
jupyterlab-server              2.6.0
jupyterlab-widgets             1.0.0
kfserving                      0.5.1
kubeflow-fairing               1.0.2
kubeflow-pytorchjob            0.1.3
kubeflow-tfjob                 0.1.3
kubernetes                     10.0.1
notebook                       6.3.0
tensorboard                    2.5.0
tensorboard-data-server        0.6.1
tensorboard-plugin-wit         1.8.0
tensorflow                     2.5.0
tensorflow-datasets            4.3.0
tensorflow-estimator           2.5.0
tensorflow-metadata            1.0.0
tf-docker /tf > ls /usr/local/cuda/lib64/libcudart.so*
/usr/local/cuda/lib64/libcudart.so  /usr/local/cuda/lib64/libcudart.so.11.0  /usr/local/cuda/lib64/libcudart.so.11.2.152
tf-docker /tf > ls /usr/lib/x86_64-linux-gnu/libcudnn.so*
/usr/lib/x86_64-linux-gnu/libcudnn.so.8  /usr/lib/x86_64-linux-gnu/libcudnn.so.8.1.0
tf-docker /tf >

 

b. Custom image 추가

$ k edit configmaps jupyter-web-app-jupyter-web-app-config-8kcgd8t8th -n kubeflow
…
        options:
          - repo.acp.kt.co.kr/kubeflow/kubeflow-images-private/tensorflow-2.5.0-notebook-cpu:1.0.0
          - repo.acp.kt.co.kr/kubeflow/kubeflow-images-private/tensorflow-2.5.0-notebook-gpu:1.0.0
          - gcr.io/kubeflow-images-public/tensorflow-1.15.2-notebook-cpu:1.0.0
          - gcr.io/kubeflow-images-public/tensorflow-1.15.2-notebook-gpu:1.0.0
          - gcr.io/kubeflow-images-public/tensorflow-2.1.0-notebook-cpu:1.0.0
          - gcr.io/kubeflow-images-public/tensorflow-2.1.0-notebook-gpu:1.0.0
…
$ k rollout restart deployment jupyter-web-app-deployment -n kubeflow
deployment.apps/jupyter-web-app-deployment restarted
$

 

- Custorm Images 추가 결과

 

 

4. Source

Dockerfile
0.00MB
requirements.txt
0.00MB
build_image.sh
0.00MB
build_image_acp.sh
0.00MB

 

'Kubeflow > Management' 카테고리의 다른 글

KFServing - Canary rollout 테스트  (0) 2021.10.17
KFServing - Deep dive  (0) 2021.10.14
Dex 인증 / 우회  (0) 2021.09.29

댓글