How do I make jupyter-hub access my private docker image repository?

5/17/2019

I want to deploy my own image on JuPyter-hub. However, I need to deploy it to some registry so that the image puller of JHub can pull it from there. In my case, the registry is private. Although I am able to push the image to my registry, I don't know how will I make the jupyterhub release and deployment be able to pull the image.

I tried reading this doc (https://github.com/jupyterhub/jupyterhub-deploy-docker) but it could not help me understand how am I to add authentication in the jupyter hub deployment.

I deploy jhub with this command:

#  Suggested values: advanced users of Kubernetes and Helm should feel
# free to use different values.
RELEASE=jhub
NAMESPACE=jhub

helm upgrade --install $RELEASE jupyterhub/jupyterhub \
  --namespace $NAMESPACE  \
  --version=0.8.0 \
  --values jupyter-hub-config.yaml

where the jupyter-hub-config.yaml is as follows:

proxy:
  secretToken: "abcd"
singleuser:
  image:
    name: jupyter/datascience-notebook
    tag: some_tag
  lifecycleHooks:
    postStart:
      exec:
        command: ["/bin/sh", "-c", 'ipython profile create; cd ~/.ipython/profile_default/startup; echo ''run_id = "sample" ''> aviral.py']

The helm chart is available here: https://jupyterhub.github.io/helm-chart/jupyterhub-0.8.2.tgz

And the tree of this helm chart is:

.
├── Chart.yaml
├── jupyter-hub-config.yaml
├── requirements.lock
├── schema.yaml
├── templates
│   ├── NOTES.txt
│   ├── _helpers.tpl
│   ├── hub
│   │   ├── configmap.yaml
│   │   ├── deployment.yaml
│   │   ├── image-credentials-secret.yaml
│   │   ├── netpol.yaml
│   │   ├── pdb.yaml
│   │   ├── pvc.yaml
│   │   ├── rbac.yaml
│   │   ├── secret.yaml
│   │   └── service.yaml
│   ├── image-puller
│   │   ├── _daemonset-helper.yaml
│   │   ├── daemonset.yaml
│   │   ├── job.yaml
│   │   └── rbac.yaml
│   ├── ingress.yaml
│   ├── proxy
│   │   ├── autohttps
│   │   │   ├── _README.txt
│   │   │   ├── configmap-nginx.yaml
│   │   │   ├── deployment.yaml
│   │   │   ├── ingress-internal.yaml
│   │   │   ├── rbac.yaml
│   │   │   └── service.yaml
│   │   ├── deployment.yaml
│   │   ├── netpol.yaml
│   │   ├── pdb.yaml
│   │   ├── secret.yaml
│   │   └── service.yaml
│   ├── scheduling
│   │   ├── _scheduling-helpers.tpl
│   │   ├── priorityclass.yaml
│   │   ├── user-placeholder
│   │   │   ├── pdb.yaml
│   │   │   ├── priorityclass.yaml
│   │   │   └── statefulset.yaml
│   │   └── user-scheduler
│   │       ├── _helpers.tpl
│   │       ├── configmap.yaml
│   │       ├── deployment.yaml
│   │       ├── pdb.yaml
│   │       └── rbac.yaml
│   └── singleuser
│       ├── image-credentials-secret.yaml
│       └── netpol.yaml
├── test-99.py
├── validate.py
└── values.yaml

All I want to do is to make jupyterhub access my private repo using secrets. In this case, I do not know how to make this available to it.

-- Aviral Srivastava
jupyter
jupyter-notebook
kubernetes
kubernetes-helm

1 Answer

5/17/2019

Image pull secret can be used to pull a image from private registry.

Append the jupyter-hub-config.yam with the following blob.

imagePullSecret:
    enabled: true
    registry:
    username:
    email:
    password:

With the Value

username:AWS

password:aws ecr get-login --region ${REGION} --registry-ids ${ACCOUNT} | cut -d' ' -f6

-- Suresh Vishnoi
Source: StackOverflow