Kubeflow by default runs notebook servers as a non-root user. It is sometimes useful to have root access to the notebook to be able to install additional dependencies. Users are able to use kubectl to modify their notebook servers.
Warning
This operation is destructive and will restart your notebook server. Any files not stored in
/home/jovyanor/home/jovyan/sharedwill be reset to the notebook defaults, including any manually installed Python packages.
To get root access, open a Terminal and enter this command:
kubectl patch notebook $(echo $NB_PREFIX | cut -d'/' -f4) --type=json --patch '[{"op": "add", "path": "/spec/template/spec/securityContext", "value": {"runAsNonRoot": false, "runAsUser": 0}}]'To restore non-root access:
kubectl patch notebook $(echo $NB_PREFIX | cut -d'/' -f4) --type=json --patch '[{"op": "remove", "path": "/spec/template/spec/securityContext"}]'