Create a Image Pull secret with your NGC key
oc create secret docker-registry regcred --docker-server=nvcr.io/nvaie --docker-username=\$oauthtoken --docker-password=<YOUR_NGC_KEY> --docker-email=<your_email_id> -n default
Apply the custom yaml files accessing NVAIE Jupyter notebooks
In this example a TensorFlow container is leveraged to launch a Jupyter notebook. Create a new yaml file with contents below called
tensorflow.yaml
WarningWhere
<NVAIE-MAJOR-VERSION>:<NVAIE-CONTAINER-TAG>
fill the version and tag. Example:2-3:22.09-tf2-nvaie-2.3-py3
apiVersion: apps/v1 kind: Deployment metadata: name: tensorflow-jupyter-notebook labels: app: tensorflow-jupyter-notebook spec: replicas: 1 selector: matchLabels: app: tensorflow-jupyter-notebook template: metadata: labels: app: tensorflow-jupyter-notebook spec: containers: - name: tensorflow-container image: nvcr.io/nvaie/tensorflow-<NVAIE-MAJOR-VERSION>:<NVAIE-CONTAINER-TAG> ports: - containerPort: 8888 command: ["jupyter-notebook"] args: ["--NotebookApp.token=''"] resources: requests: nvidia.com/gpu: 1 limits: nvidia.com/gpu: 1 imagePullSecrets: - name: regcred --- kind: Service apiVersion: v1 metadata: name: tensorflow-jupyter-notebook spec: type: NodePort selector: app: tensorflow-jupyter-notebook ports: - protocol: TCP nodePort: 30040 port: 8888 targetPort: 8888
WarningLeverage routes in instead of Node Port for production deployments. Leverage the Red Hat Route Configuration document for route creation.
Run the command below to apply the yaml file.
oc apply -f tensorflow.yaml
Access the Jupyter notebook
Once the pod is started describe it with the following:
oc describe pod tensorflow-jupyter-notebook-6c87cb86f7-9hvpm
Note the FQDN or IP of the node it is running on and construct the URL for accessing the notebook.
http://<NODE_FQDN_OR_IP>:30040
NoteAdditional information for launching Jupyter Notebooks with OpenShift can be found in the Using Jupyter Project Images blog. Additional examples can be found in the Jupyter-Stack OpenShift Exampels Gitlab page.