Skip to content

Instantly share code, notes, and snippets.

@deepaksood619
Created April 28, 2020 21:26
Show Gist options
  • Save deepaksood619/b488d02b49abcc16a1d544a9f645deec to your computer and use it in GitHub Desktop.
Save deepaksood619/b488d02b49abcc16a1d544a9f645deec to your computer and use it in GitHub Desktop.
Jupyterlab standalone deployment in Kubernetes cluster

Jupyterlab installation

kubectl apply -f jupyterlab-pvc.yaml
kubectl apply -f jupyterlab-deployment.yaml
kubectl apply -f jupyterlab-service.yaml

# change permission of home folder in pvc 
# since newly created pvc don't give permission 
# to jupyter user (jovian) to create notebook files
chmod 777 /home/jovyan

# you must perform above step with `sleep infinity` in command
# or can have init-container that does that for you
apiVersion: apps/v1
kind: Deployment
metadata:
name: jupyterlab
namespace: jlab
labels:
name: jupyterlab
spec:
replicas: 1
selector:
matchLabels:
name: jupyterlab
template:
metadata:
labels:
name: jupyterlab
spec:
securityContext:
runAsUser: 0
fsGroup: 0
containers:
- name: jupyterlab
image: jupyter/datascience-notebook:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8888
command:
- /bin/bash
- -c
- |
start.sh jupyter lab --LabApp.token='password' --LabApp.ip='0.0.0.0' --LabApp.allow_root=True
volumeMounts:
- name: jupyterlab-data
mountPath: /home/jovyan
resources:
requests:
memory: 500Mi
cpu: 250m
restartPolicy: Always
volumes:
- name: jupyterlab-data
persistentVolumeClaim:
claimName: jupyterlab-pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jupyterlab-pvc
namespace: jlab
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard-gp2-retain
apiVersion: v1
kind: Service
metadata:
name: jupyterlab
namespace: jlab
labels:
name: jupyterlab
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8888
protocol: TCP
name: http
selector:
name: jupyterlab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment