Skip to content

Instantly share code, notes, and snippets.

@jacobtomlinson
Last active February 2, 2023 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobtomlinson/397b277e6cc4b717d9ff04759f350b4a to your computer and use it in GitHub Desktop.
Save jacobtomlinson/397b277e6cc4b717d9ff04759f350b4a to your computer and use it in GitHub Desktop.
Kubernetes manifest to launch a Jupyter Notebook running RAPIDS ready for use with the Dask Operator
apiVersion: v1
kind: ServiceAccount
metadata:
name: jovyan
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: jovyan
rules:
- apiGroups: [""]
resources: ["pods", "services"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get", "list"]
- apiGroups: [kubernetes.dask.org]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: jovyan
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: jovyan
subjects:
- kind: ServiceAccount
name: jovyan
---
apiVersion: v1
kind: ConfigMap
metadata:
name: jupyter-server-proxy-config
data:
jupyter_server_config.py: |
c.ServerProxy.host_allowlist = lambda app, host: True
---
apiVersion: v1
kind: Service
metadata:
name: rapids-notebook
labels:
app: rapids-notebook
spec:
type: ClusterIP
ports:
- port: 8888
name: http
targetPort: notebook
selector:
app: rapids-notebook
---
apiVersion: v1
kind: Pod
metadata:
name: rapids-notebook
labels:
app: rapids-notebook
spec:
serviceAccountName: jovyan
securityContext:
fsGroup: 0
containers:
- name: rapids-notebook
image: rapidsai/rapidsai-core:22.12-cuda11.5-runtime-ubuntu20.04-py3.9
resources:
limits:
nvidia.com/gpu: 1
ports:
- containerPort: 8888
name: notebook
env:
- name: DASK_DISTRIBUTED__DASHBOARD__LINK
value: "/proxy/{host}:{port}/status"
volumeMounts:
- name: jupyter-server-proxy-config
mountPath: /root/.jupyter/jupyter_server_config.py
subPath: jupyter_server_config.py
volumes:
- name: jupyter-server-proxy-config
configMap:
name: jupyter-server-proxy-config
# Useful for prepulling image onto all nodes
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: prepull-rapids
spec:
selector:
matchLabels:
name: prepull-rapids
template:
metadata:
labels:
name: prepull-rapids
spec:
initContainers:
- name: prepull-rapids
image: rapidsai/rapidsai-core:22.12-cuda11.5-runtime-ubuntu20.04-py3.9
command: ["sh", "-c", "'true'"]
containers:
- name: pause
image: gcr.io/google_containers/pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment