-
Notifications
You must be signed in to change notification settings - Fork 6
/
k8s.yaml
75 lines (75 loc) · 1.95 KB
/
k8s.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
apiVersion: apps/v1
kind: Deployment
metadata:
name: jupyter-deployment
spec:
replicas: 1
strategy:
type: "Recreate"
selector:
matchLabels:
app: jupyter
template:
metadata:
labels:
app: jupyter
pod.staroid.com/isolation: dedicated
pod.staroid.com/instance-type: standard-2
spec:
automountServiceAccountToken: true
securityContext:
runAsUser: 1000 # will be overrided by staroid
runAsGroup: 100 # writable directories are accessible with GID 100. see https://github.com/jupyter/docker-stacks/blob/master/base-notebook/Dockerfile
containers:
- name: jupyter
image: jupyter
command:
- "bash"
- "-c"
- >-
mkdir -p ~/.ssh && chmod 700 ~/.ssh &&
echo -n "$(echo $MLFLOW_TRACKING_URI | sed 's/.*\(mlflow[^:]*\).*/\1/g') " >> ~/.ssh/known_hosts &&
echo $MLFLOW_ARTIFACT_STORE_RSA_PUB | base64 --decode >> ~/.ssh/known_hosts &&
echo $MLFLOW_ARTIFACT_STORE_RSA_PRI | base64 --decode >> ~/.ssh/id_rsa &&
chmod 600 ~/.ssh/* &&
jupyter-lab --ip='*' --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*'
env:
- name: JUPYTER_ENABLE_LAB
value: "yes"
envFrom:
- configMapRef:
name: mlflow-env
volumeMounts:
- name: work-volume
mountPath: /home/jovyan/work
volumes:
- name: work-volume
persistentVolumeClaim:
claimName: work
---
kind: Service
apiVersion: v1
metadata:
name: jupyter
spec:
ports:
- name: http
port: 8888
selector:
app: jupyter
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: work
annotations:
storage.staroid.com/scope: Instance
storage.staroid.com/file-manager: "1000:100"
spec:
storageClassName: nfs
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 1Gi