Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jupyter notebook.yaml to use node port and get rid of host network #412

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions K8/JupyterNotebook/jupyter_notebook_pod_deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
apiVersion: v1 # Jobs Default K8 API
kind: Pod # This tells kubernetes what kind of class it is working with
metadata:
name: stimuli-pipeline #
name: pipeline-jupyter #
labels:
app: stimuli-pipeline-jupyter # Reference this in your service
app: pipeline-jupyter # Reference this in your service
spec:
restartPolicy: Never # Options are OnFailure, and Never.
hostNetwork: true # This option will allow the pod to use the host network for internet access
volumes:
- name: mnt
hostPath:
path: /mnt # Directory on the host machine to be mounted
imagePullSecrets:
- name: docker-credentials
containers: # Container Level
- name: stimuli-pipeline # Container name (Can be set to whatever)
image: ninai/stimuli # Docker Image hosted on Docker Hub
- name: pipeline # Container name (Can be set to whatever)
image: ninai/pipeline:latest # Docker Image hosted on Docker Hub
ports:
- containerPort: 8888
volumeMounts: # Container reference to volumes define above
Expand Down Expand Up @@ -47,21 +44,26 @@ spec:
secretKeyRef:
name: github-credentials
key: GITHUB_PASSWORD
workingDir: /src
command: ["/bin/bash"] # Entry point for the container
args: ["-c", "pip3 install jupyter \
&& jupyter notebook --ip='*' --port=8888 --allow-root --no-browser --NotebookApp.token=${GITHUB_PASSWORD}"] # sh commands to clone and run python script
# Override the git pull below to pull your own fork, otherwise it clones the default master one from Cajal
args: ["-c", "pip3 install jupyter &&\
rm -r /data &&\
git clone https://$(GITHUB_USERNAME):$(GITHUB_PASSWORD)@github.com/cajal/pipeline.git &&\
jupyter notebook --ip='*' --port=8888 --allow-root --no-browser --NotebookApp.token=${GITHUB_PASSWORD}"]

---

# This is the node port service. After deployment run kubectl get svc to get the nodeport that was assign to this pod then go do <master-host-name>:<port-number> (should be in the range of 30000-32767)
kind: Service
apiVersion: v1
metadata:
name: stimuli-pipeline-jupyter-service
name: pipeline-jupyter
spec:
type: NodePort
selector:
app: stimuli-pipeline-jupyter
app: pipeline-jupyter
ports:
- protocol: TCP
nodePort: 30000 # Port might be taken so switch it to something else
port: 8888
targetPort: 8888