Hey @manics
Thanks for update, However, i got this working using singleuser config.
As it was a configmap, is it possible to create PVC for files like we create configmap? I have learnt that PVC and PV is for storage classes not for the file use case. Please correct me if i am wrong.
I have configured a mount to user pod using singleuser as follows.
config:
singleuser.storage.extra-volume-mounts: '[{"name": "livy-config-json-nm", "mountPath": "/home/jovyan/.jupyter/"}]'
singleuser.storage.extra-volumes: '[{"name": "livy-config-json-nm","configMap":{"name": "livy-config-json"}}]'
however, it got mounted as below permissions:
lrwxrwxrwx 1 root root 31 Oct 8 06:39 ..data -> ..2019_10_08_06_39_11.554462931
lrwxrwxrwx 1 root root 18 Oct 8 06:39 config.json -> ..data/config.json
drwxr-sr-x 2 root 1000 4096 Oct 8 06:39 ..2019_10_08_06_39_11.554462931
error in pod logs
[I 2019-10-08 07:11:12.668 SingleUserNotebookApp restarter:110] KernelRestarter: restarting kernel (3/5), keep random ports
Traceback (most recent call last):
File "/export/apps/python/3.6.1/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/export/apps/python/3.6.1/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/sparkmagic/kernels/sparkkernel/sparkkernel.py", line 28, in <module>
IPKernelApp.launch_instance(kernel_class=SparkKernel)
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "</export/apps/python/3.6.1/lib/python3.6/site-packages/decorator.py:decorator-gen-138>", line 2, in initialize
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 465, in initialize
self.init_kernel()
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 376, in init_kernel
user_ns=self.user_ns,
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/sparkmagic/kernels/sparkkernel/sparkkernel.py", line 23, in __init__
language_info, session_language, **kwargs)
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/sparkmagic/kernels/wrapperkernel/sparkkernelbase.py", line 29, in __init__
self.logger = SparkLog(u"{}_jupyter_kernel".format(self.session_language))
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/sparkmagic/utils/sparklogger.py", line 10, in __init__
super(SparkLog, self).__init__(MAGICS_LOGGER_NAME, conf.logging_config(), class_name)
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/hdijupyterutils/configuration.py", line 17, in wrapped_f
_initialize(overrides, path, fsrw_class)
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/hdijupyterutils/configuration.py", line 51, in _initialize
new_overrides = _load(path, fsrw_class)
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/hdijupyterutils/configuration.py", line 63, in _load
config_text = config_file.read_lines()
File "/export/apps/python/3.6.1/lib/python3.6/site-packages/hdijupyterutils/filesystemreaderwriter.py", line 23, in read_lines
with open(self.path, "r+") as f:
PermissionError: [Errno 13] Permission denied: '/home/jovyan/.sparkmagic/config.json'
I did not get a way to change the permission in mountPath config. So I thought of changing ownership to jovyan from root in lifecycle hook and i am getting the error.
config:
singleuser.lifecycle-hooks: '{"postStart":{"exec":{"command": ["/bin/sh", "-c", "chown -R jovyan:users /home/jovyan/.jupyter/*"]}}}'
Error:
PostStartHookError: command '/bin/sh -c chown -R jovyan:root /home/jovyan/.jupyter/* > /home/jovyan/message2' exited with 1: chown: changing ownership of ‘/home/jovyan/.jupyter/jupyter_notebook_config.py’: Read-only file system
Can you please help me what can be done here?
Thanks